X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fdo.pl;h=f8a57e4449018867af416acd2622126dc8027956;hb=0e60202e4d9de0e0377e63fccc3a2f93e68bd24f;hp=86d2295ed5a0a6cf6f48f159531bd26b9c033bcf;hpb=819758a1dc10086cc6b18efa4df444ab43685b74;p=kivitendo-erp.git diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 86d2295ed..f8a57e444 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -24,7 +24,8 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1335, USA. #====================================================================== # # Delivery orders @@ -828,7 +829,10 @@ sub invoice { } for my $i (1 .. $form->{rowcount}) { + map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice lastcost basefactor discount); # für bug 1284 + # adds a customer/vendor discount, unless we have a workflow case + # CAVEAT: has to be done, after the above parse_amount unless ($form->{"ordnumber"}) { if ($form->{discount}) { # Falls wir einen Lieferanten-/Kundenrabatt haben # und rabattfähig sind, dann @@ -837,7 +841,6 @@ sub invoice { } } } - map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice lastcost basefactor); $form->{"donumber_$i"} = $form->{donumber}; $form->{"converted_from_delivery_order_items_id_$i"} = delete $form->{"delivery_order_items_id_$i"}; } @@ -1796,6 +1799,11 @@ sub sort { # hashify partnumbers, positions. key is delivery_order_items_id for my $i (1 .. ($form->{rowcount}) ) { $temp_hash{$form->{"delivery_order_items_id_$i"}} = { runningnumber => $form->{"runningnumber_$i"}, partnumber => $form->{"partnumber_$i"} }; + if ($form->{id} && $form->{"discount_$i"}) { + # prepare_order assumes a db value if there is a form->id and multiplies *100 + # We hope for new controller code (no more format_amount/parse_amount distinction) + $form->{"discount_$i"} /=100; + } } # naturally sort partnumbers and get a sorted array of doi_ids my @sorted_doi_ids = sort { Sort::Naturally::ncmp($temp_hash{$a}->{"partnumber"}, $temp_hash{$b}->{"partnumber"}) } keys %temp_hash; @@ -1807,6 +1815,12 @@ sub sort { $form->{"runningnumber_$temp_hash{$_}->{runningnumber}"} = $new_number; $new_number++; } + # all parse_amounts changes are in form (i.e. , to .) therefore we need + # another format_amount to change it back, for the next save ;-( + # works great except for row discounts (see above comment) + prepare_order(); + + $main::lxdebug->leave_sub(); save(); }