X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIR.pm;h=f51ce4a4b3550f87a104dd23046f8fe2dc13260a;hb=66671e22ff33f493fae7d8a88145ac1ecf34b3b3;hp=e99a108cf31aed3953a80c503fb926356c2ae9a7;hpb=5c3ccca49f076038fe3d48cbd30c8a618ff876fc;p=kivitendo-erp.git diff --git a/SL/IR.pm b/SL/IR.pm index e99a108cf..f51ce4a4b 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -224,9 +224,8 @@ sub post_invoice { $dbh->do($query) || $form->dberror($query); - $form->update_balance($dbh, "parts", "onhand", - qq|id = $form->{"id_$i"}|, - $baseqty) + $form->update_balance($dbh, "parts", "onhand", qq|id = ?|, + $baseqty, $form->{"id_$i"}) unless $form->{shipped}; # check if we sold the item already and @@ -1013,13 +1012,15 @@ sub get_vendor { $query = qq|SELECT o.amount, (SELECT e.sell FROM exchangerate e - WHERE e.curr = o.curr AND e.transdate = o.transdate) + WHERE e.curr = o.curr AND e.transdate = o.transdate) AS exch FROM oe o WHERE o.vendor_id = ? AND o.quotation = '0' AND o.closed = '0'|; - while (my ($amount, $exch) = selectfirst_array_query($form, $dbh, $query, $form->{vendor_id})) { + my $sth = prepare_execute_query($form, $dbh, $query, $form->{vendor_id}); + while (my ($amount, $exch) = $sth->fetchrow_array()) { $exch = 1 unless $exch; $form->{creditremaining} -= $amount * $exch; } + $sth->finish(); # get shipto if we do not convert an order or invoice if (!$form->{shipto}) {