X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=c55689e72ff1a48b2a5e6c1fb7f753101e95a5ed;hb=3b3ef5ba0b9d0d6fb45e082cbfafa524243ae6f7;hp=f8c47918a5d150f056a81870a759130e7e093404;hpb=df005c490a2d6a9b7e50ea44fc7557e39ce7d6ca;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index f8c47918a..c55689e72 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -205,7 +205,6 @@ sub order_links { $form->{jsscript} = 1; my $editing = $form->{id}; - $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes)); OE->retrieve(\%myconfig, \%$form); @@ -218,6 +217,7 @@ sub order_links { $form->{"$form->{vc}_id"} ||= $form->{"all_$form->{vc}"}->[0]->{id} if $form->{"all_$form->{vc}"}; + $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes)); $form->{shipto} = 1 if $form->{id}; # get customer / vendor @@ -237,7 +237,10 @@ sub order_links { } $form->{"old$form->{vc}"} = $form->{$form->{vc}}; - $form->{"old$form->{vc}"} .= qq|--$form->{"$form->{vc}_id"}| unless ($form->{"old$form->{vc}"} =~ m/--\d+$/); + + if ($form->{"old$form->{vc}"} !~ m/--\d+$/ && $form->{"$form->{vc}_id"}) { + $form->{"old$form->{vc}"} .= qq|--$form->{"$form->{vc}_id"}| + } $lxdebug->leave_sub(); } @@ -631,7 +634,7 @@ sub search { $form->header(); - print $form->parse_html_template('oe/search'); + print $form->parse_html_template('oe/search', { %myconfig }); $lxdebug->leave_sub(); } @@ -661,7 +664,7 @@ sub orders { $ordnumber = ($form->{type} =~ /_order$/) ? "ordnumber" : "quonumber"; - ($form->{ $form->{vc} }, $form->{"${form->{vc}}_id"}) = split(/--/, $form->{ $form->{vc} }); + ($form->{ $form->{vc} }, $form->{"$form->{vc}_id"}) = split(/--/, $form->{ $form->{vc} }); report_generator_set_default_sort('transdate', 1); @@ -1270,7 +1273,7 @@ sub invoice { require "bin/mozilla/$form->{script}"; - map { $form->{"select$_"} = "" } ($form->{vc}, currency); + map { $form->{"select$_"} = "" } ($form->{vc}, "currency"); $currency = $form->{currency}; &invoice_links; @@ -1609,7 +1612,7 @@ sub poso { ordnumber); for $i (1 .. $form->{rowcount}) { - map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor); + map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor discount); } my %saved_vars = map { $_ => $form->{$_} } grep { $form->{$_} } qw(currency); @@ -1620,6 +1623,12 @@ sub poso { &prepare_order; + # prepare_order assumes that the discount is in db-notation (0.05) and not user-notation (5) + # and therefore multiplies the values by 100 in the case of reading from db or making an order from several quotation, so we convert this back into percent-notation for the user interface by multiplying with 0.01 + for $i (1 .. $form->{rowcount}) { + $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * 0.01); + }; + # format amounts for $i (1 .. $form->{rowcount} - 1) { map { $form->{"${_}_$i"} =~ s/\"/"/g } qw(partnumber description unit); @@ -1648,6 +1657,7 @@ sub delivery_order { require "bin/mozilla/do.pl"; + $form->{script} = 'do.pl'; $form->{cp_id} *= 1; $form->{convert_from_oe_ids} = $form->{id}; $form->{transdate} = $form->current_date(\%myconfig); @@ -1660,7 +1670,7 @@ sub delivery_order { delete @{$form}{qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal closed delivered)}; for $i (1 .. $form->{rowcount}) { - map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor); + map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice basefactor discount); } my %old_values = map { $_ => $form->{$_} } qw(customer_id oldcustomer customer vendor_id oldvendor vendor);