Revision 2b32359d
Von Jan Büren vor fast 10 Jahren hinzugefügt
SL/DO.pm | ||
---|---|---|
373 | 373 |
conv_i($sinfo->{bin_id}), $sinfo->{chargenumber}, conv_date($sinfo->{bestbefore}), |
374 | 374 |
conv_i($sinfo->{"delivery_order_items_stock_id"})); |
375 | 375 |
do_statement($form, $h_item_stock, $q_item_stock, @values); |
376 |
push @processed_dois, $sinfo->{"delivery_order_items_stock_id"}; |
|
376 | 377 |
} |
377 | 378 |
|
378 | 379 |
CVar->save_custom_variables(module => 'IC', |
... | ... | |
394 | 395 |
$query = sprintf 'DELETE FROM delivery_order_items WHERE id IN (%s)', join ', ', ("?") x scalar @orphaned_ids; |
395 | 396 |
do_query($form, $dbh, $query, @orphaned_ids); |
396 | 397 |
} |
398 |
# search for orphaned dois |
|
399 |
$query = sprintf 'SELECT id FROM delivery_order_items_stock WHERE delivery_order_item_id in |
|
400 |
(select id from delivery_order_items where delivery_order_id = ?) AND NOT id IN (%s)', join ', ', ("?") x scalar @processed_dois; |
|
401 |
@values = (conv_i($form->{id}), map { conv_i($_) } @processed_dois); |
|
402 |
my @orphaned_dois_ids = map { $_->{id} } selectall_hashref_query($form, $dbh, $query, @values); |
|
403 |
if (scalar @orphaned_dois_ids) { |
|
404 |
# clean up delivery_order_items_stock |
|
405 |
$query = sprintf 'DELETE FROM delivery_order_items_stock WHERE id IN (%s)', join ', ', ("?") x scalar @orphaned_dois_ids; |
|
406 |
do_query($form, $dbh, $query, @orphaned_dois_ids); |
|
407 |
} |
|
397 | 408 |
$h_item->finish(); |
398 | 409 |
$h_item_stock->finish(); |
399 | 410 |
|
Auch abrufbar als: Unified diff
delivery_order_items_stock persistent machen Teil 2
Testfall:
Mittlere Position in stock_in/out_form löschen => i.O.
Update drücken (alles wird erneuert) => n.i.O. (alle ids werden gelöscht)