X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fis.pl;h=a4f9e85b9d7415cb52c85ea316121eb85ffdc0cc;hb=7e19c2165ee3b934f4e685b256bb3a261d59a915;hp=7e14454dfed6c298e9dca0984effa36dbd2b015e;hpb=0560b39eef592a150913baf51cd198a407b31a7a;p=kivitendo-erp.git diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 7e14454df..a4f9e85b9 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -554,11 +554,8 @@ sub update { my $rows = scalar @{ $form->{item_list} }; - # Falls kein Kundenrabatt vorhanden ist, den aktuellen Rabatt nicht mit 0% überschreiben, - # da hier der Anwender schon manual einen Wert eingetragen haben könnte (analog zu qty) Bugfix: 1412 - if ($form->{customer_discount}){ - $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{customer_discount} * 100); - } + $form->{"discount_$i"} = $form->parse_amount(\%myconfig, $form->{"discount_$i"}) / 100.0; + $form->{"discount_$i"} ||= $form->{customer_discount}; if ($rows) { $form->{"qty_$i"} = $form->parse_amount(\%myconfig, $form->{"qty_$i"}); @@ -568,7 +565,7 @@ sub update { if ($rows > 1) { - select_item(mode => 'IS'); + select_item(mode => 'IS', pre_entered_qty => $form->{"qty_$i"}); ::end_of_request(); } else { @@ -609,7 +606,7 @@ sub update { $form->{"listprice_$i"} /= $exchangerate; - my $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"} / 100); + my $amount = $form->{"sellprice_$i"} * $form->{"qty_$i"} * (1 - $form->{"discount_$i"}); map { $form->{"${_}_base"} = 0 } split / /, $form->{taxaccounts}; map { $form->{"${_}_base"} += $amount } split / /, $form->{"taxaccounts_$i"}; map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{"taxaccounts_$i"} if !$form->{taxincluded}; @@ -618,7 +615,8 @@ sub update { map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, $decimalplaces) } qw(sellprice lastcost); - $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); + $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); + $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100.0); } &display_form; @@ -785,21 +783,30 @@ sub post { if ($::instance_conf->get_is_transfer_out && $form->{type} ne 'credit_note' && !$form->{storno}) { require SL::DB::Inventory; my $rose_db = SL::DB::Inventory->new->db; - my $error; + my @errors; if (!$rose_db->with_transaction(sub { if (!eval { - IS->post_invoice(\%myconfig, \%$form, $rose_db->dbh); - IS->transfer_out(\%$form); + if (!IS->post_invoice(\%myconfig, \%$form, $rose_db->dbh)) { + push @errors, $locale->text('Cannot post invoice!'); + die 'posting error'; + } + my $err = IS->transfer_out(\%$form, $rose_db->dbh); + if (@{ $err }) { + push @errors, @{ $err }; + die 'transfer error'; + } + 1; }) { - $error = $EVAL_ERROR; - return; + push @errors, $EVAL_ERROR; + die 'transaction error'; } 1; })) { - $form->error($locale->text("Cannot post invoice and/or transfer out!\nError was:\n") . $locale->text($error)); + push @errors, $rose_db->error; + $form->error($locale->text('Cannot post invoice and/or transfer out! Error message:') . "\n" . join("\n", @errors)); } } else { if (!IS->post_invoice(\%myconfig, \%$form)) {