From 8acf9732c5d1e425f3a5d12ad031745fcaec47fa Mon Sep 17 00:00:00 2001 From: oscim Date: Tue, 8 Aug 2023 21:17:38 +0200 Subject: [PATCH] Update bookkeeping.class.php (#25589) add support $mode for delete row in bookeeping in other methode to delete --- htdocs/accountancy/class/bookkeeping.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 49bda65ba2b..bd8a446ec6e 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1480,15 +1480,16 @@ class BookKeeping extends CommonObject * Delete bookkeeping by importkey * * @param string $importkey Import key + * @param string $mode Mode * @return int Result */ - public function deleteByImportkey($importkey) + public function deleteByImportkey($importkey , $mode = '' ) { $this->db->begin(); // first check if line not yet in bookkeeping $sql = "DELETE"; - $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE import_key = '".$this->db->escape($importkey)."'"; $resql = $this->db->query($sql); @@ -1562,9 +1563,10 @@ class BookKeeping extends CommonObject * Delete bookkeeping by piece number * * @param int $piecenum Piecenum to delete + * @param string $mode Mode * @return int Result */ - public function deleteMvtNum($piecenum) + public function deleteMvtNum($piecenum , $mode = '') { global $conf; @@ -1572,7 +1574,7 @@ class BookKeeping extends CommonObject // first check if line not yet in bookkeeping $sql = "DELETE"; - $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; $sql .= " WHERE piece_num = ".(int) $piecenum; $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features