X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fap.pl;h=f62294eaa7d2372d25c99464dc30f8cac9b1ab5d;hb=d4a434e1deba2695ef4d4a3fc0d51ac1b2044fb0;hp=d90b06209fe8590d6b40b4383fdc8a3686df71a0;hpb=79b83b02cf67cf4b701eb1654fa274095d84745a;p=kivitendo-erp.git diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index d90b06209..f62294eaa 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -195,7 +195,7 @@ sub form_header { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; - my $cgi = $main::cgi; + my $cgi = $::request->{cgi}; $main::auth->assert('general_ledger'); @@ -285,7 +285,8 @@ sub form_header { my $notes = qq||; - my $department = qq| + my $department; + $department = qq| | . $locale->text('Department') . qq| @@ -684,18 +685,26 @@ $jsscript # format amounts if ($form->{"paid_$i"}) { $form->{"paid_$i"} = - $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2); + $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2); } - $form->{"exchangerate_$i"} = - $form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); if ($form->{"exchangerate_$i"} == 0) { $form->{"exchangerate_$i"} = ""; + } else { + $form->{"exchangerate_$i"} = + $form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); } + print qq|{"acc_trans_id_$i"}>\n|; print qq|{"gldate_$i"}>\n|; - my $changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"}); - $form->{"payment_readonly_$i"} = ($changeable)? 0 : 1; - print qq|{"payment_readonly_$i"}>\n|; + my $changeable = 1; + if ($::lx_office_conf{features}->{payments_changeable} == 0) { + # never + $changeable = ($form->{"acc_trans_id_$i"})? 0 : 1; + } + if ($::lx_office_conf{features}->{payments_changeable} == 2) { + # on the same day + $changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"}); + } $exchangerate = qq| |; if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) { @@ -707,7 +716,7 @@ $jsscript $exchangerate = qq|{"exchangerate_$i"}>|; } else { - $exchangerate = qq|$form->{"exchangerate_$i"}|. + $exchangerate = qq|{"exchangerate_$i"}>$form->{"exchangerate_$i"}|; } } @@ -773,12 +782,12 @@ $jsscript qq|{"paid_project_id_$i"}>|; } - $column_data{"paid_$i"} = $paid; - $column_data{"AP_paid_$i"} = $AP_paid; - $column_data{"exchangerate_$i"} = qq|$exchangerate|; - $column_data{"datepaid_$i"} = $datepaid; - $column_data{"source_$i"} = $source; - $column_data{"memo_$i"} = $memo; + $column_data{"paid_$i"} = $paid; + $column_data{"AP_paid_$i"} = $AP_paid; + $column_data{"exchangerate_$i"} = qq|$exchangerate|; + $column_data{"datepaid_$i"} = $datepaid; + $column_data{"source_$i"} = $source; + $column_data{"memo_$i"} = $memo; $column_data{"paid_project_id_$i"} = $paid_project_id; map { print qq|$column_data{"${_}_$i"}\n| } @column_index; @@ -828,7 +837,7 @@ sub form_footer { my $form = $main::form; my %myconfig = %main::myconfig; my $locale = $main::locale; - my $cgi = $main::cgi; + my $cgi = $::request->{cgi}; $main::auth->assert('general_ledger'); @@ -1071,6 +1080,8 @@ sub post { $main::auth->assert('general_ledger'); + my ($inline) = @_; + # check if there is a vendor, invoice and due date $form->isblank("transdate", $locale->text("Invoice Date missing!")); $form->isblank("duedate", $locale->text("Due Date missing!")); @@ -1145,7 +1156,7 @@ sub post { # /saving the history remove_draft() if $form->{remove_draft}; # Dieser Text wird niemals ausgegeben: Probleme beim redirect? - $form->redirect($locale->text('Transaction posted!')); + $form->redirect($locale->text('Transaction posted!')) unless $inline; } else { $form->error($locale->text('Cannot post transaction!')); } @@ -1182,7 +1193,7 @@ sub use_as_template { $main::auth->assert('general_ledger'); - map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 gldate_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno); + map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno); $form->{paidaccounts} = 1; $form->{rowcount}--; $form->{invdate} = $form->current_date(\%myconfig);