when marking as received, archive

This commit is contained in:
Michael Erdely 2024-12-31 12:14:28 -05:00
parent ad5abb2af3
commit 4f01604d85
Signed by: mike
SSH key fingerprint: SHA256:ukbnfrRMaRYlBZXENtBTyO2jLnql5AA5m+SzZCfYQe0

View file

@ -73,13 +73,16 @@ try {
if ($quantity == 1) {
/* just delete the alloc and the item and get out.
yes, it's possible the item was RESERVED, not PURCHASED. */
deleteImageForItem($itemid, $smarty->dbh(), $smarty->opt());
// don't delete images for archived items
// deleteImageForItem($itemid, $smarty->dbh(), $smarty->opt());
/*
$stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}allocs WHERE itemid = ?");
$stmt->bindParam(1, $itemid, PDO::PARAM_INT);
$stmt->execute();
*/
$stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}items WHERE itemid = ?");
$stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}items SET archive=true WHERE itemid = ?");
$stmt->bindParam(1, $itemid, PDO::PARAM_INT);
$stmt->execute();
@ -97,8 +100,9 @@ try {
if ($actual == $quantity) {
// now they're all gone.
deleteImageForItem($itemid, $smarty->dbh(), $smarty->opt());
$stmt = $smarty->dbh()->prepare("DELETE FROM {$opt["table_prefix"]}items WHERE itemid = ?");
// don't delete images for archived items
// deleteImageForItem($itemid, $smarty->dbh(), $smarty->opt());
$stmt = $smarty->dbh()->prepare("UPDATE {$opt["table_prefix"]}items SET archive=true WHERE itemid = ?");
$stmt->bindParam(1, $itemid, PDO::PARAM_INT);
$stmt->execute();
}