]> wagnertech.de Git - mfinanz.git/commitdiff
Merge branch 'master' of github.com:kivitendo/kivitendo-erp
authorSven Schöling <s.schoeling@linet-services.de>
Wed, 8 Jan 2014 10:42:41 +0000 (11:42 +0100)
committerSven Schöling <s.schoeling@linet-services.de>
Wed, 8 Jan 2014 10:42:41 +0000 (11:42 +0100)
bin/mozilla/do.pl
bin/mozilla/io.pl

index 0258966f00496d08dc3ea0764562d9b1f6c9e1cd..776a9927494ff16e54e09b4ff414b3ee702c3f1f 100644 (file)
@@ -38,6 +38,7 @@ use SL::DB::DeliveryOrder;
 use SL::DO;
 use SL::IR;
 use SL::IS;
+use SL::MoreCommon qw(ary_diff);
 use SL::ReportGenerator;
 use SL::WH;
 require "bin/mozilla/arap.pl";
@@ -415,6 +416,12 @@ sub update_delivery_order {
         $form->{"sellprice_$i"}          = $form->format_amount(\%myconfig, $form->{"sellprice_$i"} * (1 - $form->{tradediscount}));
         $form->{"lastcost_$i"}          = $form->format_amount(\%myconfig, $form->{"lastcost_$i"});
         $form->{"qty_$i"}                = $form->format_amount(\%myconfig, $form->{"qty_$i"});
+
+        # get pricegroups for parts
+        IS->get_pricegroups_for_parts(\%myconfig, \%$form);
+
+        # build up html code for prices_$i
+        &set_pricegroup($i);
       }
 
       display_form();
@@ -687,8 +694,8 @@ sub save {
 
   $form->{simple_save} = 1;
   if (!$params{no_redirect} && !$form->{print_and_save}) {
-    set_headings("edit");
-    update();
+    delete @{$form}{ary_diff([keys %{ $form }], [qw(login id script type cursor_fokus)])};
+    edit();
     ::end_of_request();
   }
   $main::lxdebug->leave_sub();
@@ -829,7 +836,7 @@ sub invoice {
     $form->{"sellprice_pg_$i"} = join '--', $form->{"sellprice_$i"}, $form->{"pricegroup_id_$i"};
   }
   IS->get_pricegroups_for_parts(\%myconfig, \%$form);
-  set_pricegroup($_) for 1 .. $form->{rowcount};
+  set_pricegroup($form->{rowcount});
 
   display_form();
 
index 0ba19916fdec50418feb273a504ef207ace9fc09..480de97663b418aede6d88d8ecc27f58e985bf47 100644 (file)
@@ -421,7 +421,9 @@ sub display_row {
 
     if ($is_delivery_order) {
       map { $form->{"${_}_${i}"} = $form->format_amount(\%myconfig, $form->{"${_}_${i}"}) } qw(sellprice discount lastcost);
-      push @hidden_vars, qw(sellprice discount not_discountable price_factor_id lastcost pricegroup_id);
+      $form->{"pricegroup_id_$i"} = $form->{"pricegroup_old_$i"} if $form->{"pricegroup_old_$i"};
+      $form->{"sellprice_pg_$i"}  = $form->{"hidden_prices_$i"}  if $form->{"hidden_prices_$i"};
+      push @hidden_vars, grep { defined $form->{"${_}_${i}"} } qw(sellprice discount not_discountable price_factor_id lastcost pricegroup_id sellprice_pg);
       push @hidden_vars, "stock_${stock_in_out}_sum_qty", "stock_${stock_in_out}";
     }
 
@@ -483,6 +485,10 @@ sub set_pricegroup {
       $form->{"sellprice_$j"}      = $item->{price}           if $item->{selected} &&  $item->{pricegroup_id};
       $form->{"price_new_$j"}      = $form->{"sellprice_$j"}  if $item->{selected} || !$item->{pricegroup_id};
     }
+
+    # save hidden pricegroups for delivery_orders
+    next unless my @selected_prices = grep { $_->{selected} } @{ $form->{PRICES}{$j} };
+    $form->{"hidden_prices_$j"} = $selected_prices[-1]{price} . "--" . $selected_prices[-1]{pricegroup_id};
   }
   $main::lxdebug->leave_sub();
 }