IMMER die orderitems_id in sub poso löschen, nicht nur in
der if-bedingung
Angebot -> Auftrag i.O.
Auftrag - > Angebot i.O.
Kundenauftrag -> Lieferantenauftrag i.O.
# reset
map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued customer vendor creditlimit creditremaining discount tradediscount oldinvtotal delivered ordnumber);
+ 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
# also reset discounts
for my $i (1 .. $form->{rowcount}) {
$form->{"sellprice_${i}"} = $form->{"lastcost_${i}"};
$form->{"discount_${i}"} = 0;
- delete $form->{"orderitems_id_$_"};
};
};