X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fap.pl;h=35fef992ea8584aa8524cd8ad4f6e22809542d8f;hb=c9902d7658d0cacdf665971b32de0e054637efd0;hp=91836ebb7aad6e58567affe7d131b10c366d76e9;hpb=05174f19ea29a44817ef9172c7fbdb7f89212806;p=kivitendo-erp.git diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 91836ebb7..35fef992e 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -244,17 +244,10 @@ sub form_header { $form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'sell'); $form->{exchangerate} = $form->{forex} if $form->{forex}; - # format amounts - $form->{exchangerate} = - $form->format_amount(\%myconfig, $form->{exchangerate}); - if ($form->{exchangerate} == 0) { - $form->{exchangerate} = ""; - } - $form->{creditlimit} = - $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); - $form->{creditremaining} = - $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0"); + $form->{exchangerate} = $form->{exchangerate} ? $form->format_amount(\%myconfig, $form->{exchangerate}) : ''; + $form->{creditlimit} = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0"); + $form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0"); my $exchangerate = qq| {forex}> @@ -661,7 +654,7 @@ $jsscript "; my @triggers = (); - my $totalpaid = 0; + $form->{totalpaid} = 0; $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); for my $i (1 .. $form->{paidaccounts}) { @@ -676,7 +669,7 @@ $jsscript '-labels' => \%AP_paid_labels, '-default' => $form->{"AP_paid_$i"})); - $totalpaid += $form->{"paid_$i"}; + $form->{totalpaid} += $form->{"paid_$i"}; # format amounts if ($form->{"paid_$i"}) { @@ -732,14 +725,14 @@ $jsscript push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i"); } - my $paid_missing = $form->{invtotal_unformatted} - $totalpaid; + my $paid_missing = $form->{invtotal_unformatted} - $form->{totalpaid}; print qq| | . $locale->text('Total') . qq| - | . H($form->format_amount(\%myconfig, $totalpaid, 2)) . qq| + | . H($form->format_amount(\%myconfig, $form->{totalpaid}, 2)) . qq| @@ -818,9 +811,8 @@ $follow_ups_block |; } # ToDO: - insert a global check for stornos, so that a storno is only possible a limited time after saving it - our $total_paid; print qq| | - if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ap') && !IS->is_storno(\%myconfig, $form, 'ap', $form->{id}) && (($total_paid == 0) || ($total_paid eq ""))); + if ($form->{id} && !IS->has_storno(\%myconfig, $form, 'ap') && !IS->is_storno(\%myconfig, $form, 'ap', $form->{id}) && (($form->{totalpaid} == 0) || ($form->{totalpaid} eq ""))); print qq| @@ -973,7 +965,8 @@ sub post_payment { $form->{defaultcurrency} = $form->get_default_currency(\%myconfig); - our $invdate; + my $invdate = $form->datetonum($form->{transdate}, \%myconfig); + for my $i (1 .. $form->{paidaccounts}) { if ($form->parse_amount(\%myconfig, $form->{"paid_$i"})) { my $datepaid = $form->datetonum($form->{"datepaid_$i"}, \%myconfig); @@ -1064,7 +1057,7 @@ sub post { my ($vendor) = split /--/, $form->{vendor}; if ($form->{oldvendor} ne "$vendor--$form->{vendor_id}") { &update; - exit; + ::end_of_request(); } my ($debitaccno, $debittaxkey) = split /--/, $form->{AP_amountselected}; my ($taxkey, $NULL) = split /--/, $form->{taxchartselected}; @@ -1081,7 +1074,7 @@ sub post { if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "POSTED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history remove_draft() if $form->{remove_draft}; @@ -1107,7 +1100,7 @@ sub post_as_new { if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "POSTED AS NEW"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history &post; @@ -1190,7 +1183,7 @@ sub yes { if(!exists $form->{addition}) { $form->{snumbers} = qq|invnumber_| . $form->{invnumber}; $form->{addition} = "DELETED"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history $form->redirect($locale->text('Transaction deleted!')); @@ -1342,6 +1335,7 @@ sub ap_transactions { 'attachment_basename' => $locale->text('vendor_invoice_list') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; # add sort and escape callback, this one we use for the add sub $form->{callback} = $href .= "&sort=$form->{sort}"; @@ -1433,7 +1427,7 @@ sub storno { if(!exists $form->{addition} && $form->{id} ne "") { $form->{snumbers} = "ordnumber_$form->{ordnumber}"; $form->{addition} = "STORNO"; - $form->save_history($form->dbconnect(\%myconfig)); + $form->save_history; } # /saving the history