From 4f01604d858cc924226798096a201ad92e23d56b Mon Sep 17 00:00:00 2001 From: Michael Erdely Date: Tue, 31 Dec 2024 12:14:28 -0500 Subject: [PATCH] when marking as received, archive --- src/receive.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/receive.php b/src/receive.php index 31ad06b..56a427d 100644 --- a/src/receive.php +++ b/src/receive.php @@ -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(); }