X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/840aea131eef33512dccc13184e01affafaafb37..b12e8d1411cb7af3a1a9b6f7637692f0758b4741:/SL/IS.pm diff --git a/SL/IS.pm b/SL/IS.pm index 310dcbb59..402df0d28 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -711,9 +711,8 @@ sub post_invoice { $sth->execute || $form->dberror($query); if ($sth->fetchrow_array) { - $form->update_balance($dbh, "parts", "onhand", - qq|id = $form->{"id_$i"}|, - $baseqty * -1) + $form->update_balance($dbh, "parts", "onhand", qq|id = ?|, + $baseqty * -1, $form->{"id_$i"}) unless $form->{shipped}; } $sth->finish; @@ -721,9 +720,8 @@ sub post_invoice { # record assembly item as allocated &process_assembly($dbh, $form, $form->{"id_$i"}, $baseqty); } else { - $form->update_balance($dbh, "parts", "onhand", - qq|id = $form->{"id_$i"}|, - $baseqty * -1) + $form->update_balance($dbh, "parts", "onhand", qq|id = ?|, + $baseqty * -1, $form->{"id_$i"}) unless $form->{shipped}; $allocated = &cogs($dbh, $form, $form->{"id_$i"}, $baseqty, $basefactor, $i); @@ -1705,7 +1703,7 @@ sub get_customer { map { $form->{$_} = $ref->{$_} } keys %$ref; my $query = qq|SELECT dnn.dunning_description AS max_dunning_level FROM dunning_config dnn - WHERE id in (SELECT dunning_config_id from ar WHERE paid < amount AND customer_id = ? AND dunning_id IS NOT NULL) + WHERE id in (SELECT dunning_config_id from ar WHERE paid < amount AND customer_id = ? AND dunning_config_id IS NOT NULL) ORDER BY dunning_level DESC LIMIT 1|; $ref = selectfirst_hashref_query($form, $dbh, $query, $form->{customer_id}); map { $form->{$_} = $ref->{$_} } keys %$ref;