X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Foe.pl;h=a313fb3cf55a169d6610a75e35252fe0127304a0;hb=f0ad214336550a429014c0e496511dada80be935;hp=cc67e746fa01eb0c9f3f9543fcaae28a5eaad5fd;hpb=049e49fea3e4a3c7c78d7aebf055936b3cab40c5;p=kivitendo-erp.git diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index cc67e746f..a313fb3cf 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -375,7 +375,7 @@ sub form_header { @old_ids_cond, ]); - $TMPL_VAR{ALL_PROJECTS} = SL::DB::Manager::Project->get_all(query => \@conditions); + $TMPL_VAR{ALL_PROJECTS} = SL::DB::Manager::Project->get_all_sorted(query => \@conditions); # label subs my $employee_list_query_gen = sub { $::form->{$_[0]} ? [ or => [ id => $::form->{$_[0]}, deleted => 0 ] ] : [ deleted => 0 ] }; @@ -465,7 +465,7 @@ sub form_header { } } - $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase show_form_details show_history show_vc_details ckeditor/ckeditor ckeditor/adapters/jquery kivi.io)); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(kivi.SalesPurchase show_form_details show_history show_vc_details ckeditor/ckeditor ckeditor/adapters/jquery kivi.io autocomplete_customer autocomplete_part)); $form->header; if ($form->{CFDD_shipto} && $form->{CFDD_shipto_id} ) { @@ -678,16 +678,20 @@ sub update { if ($sellprice) { $form->{"sellprice_$i"} = $sellprice; } else { - my $record = _make_record(); - my $price_source = SL::PriceSource->new(record_item => $record->items->[$i-1], record => $record); - my $best_price = $price_source->best_price; + my $record = _make_record(); + my $price_source = SL::PriceSource->new(record_item => $record->items->[$i-1], record => $record); + my $best_price = $price_source->best_price; + my $best_discount = $price_source->best_discount; if ($best_price) { $::form->{"sellprice_$i"} = $best_price->price; $::form->{"active_price_source_$i"} = $best_price->source; } + if ($best_discount) { + $::form->{"discount_$i"} = $best_discount->discount; + $::form->{"active_discount_source_$i"} = $best_discount->source; + } - $form->{"sellprice_$i"} *= (1 - $form->{tradediscount}); $form->{"sellprice_$i"} /= $exchangerate; # if there is an exchange rate adjust sellprice } @@ -1419,6 +1423,7 @@ sub invoice { for (qw(ship qty sellprice listprice basefactor)) { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"}; } + $form->{"converted_from_orderitems_id_$i"} = delete $form->{"orderitems_id_$i"}; } my ($buysell, $orddate, $exchangerate); @@ -1815,6 +1820,7 @@ sub poso { # reset map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal delivered ordnumber); + $form->{"converted_from_quotation_orderitems_id_$_"} = $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; # always reset orderitems_id delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; # always reset orderitems_id # if purchase_order was generated from sales_order, use lastcost_$i as sellprice_$i @@ -1890,6 +1896,7 @@ sub delivery_order { for my $i (1 .. $form->{rowcount}) { map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice lastcost basefactor discount); + $form->{"converted_from_orderitems_id_$i"} = delete $form->{"orderitems_id_$i"}; } my %old_values = map { $_ => $form->{$_} } qw(customer_id oldcustomer customer vendor_id oldvendor vendor shipto_id);