diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f8fa0774400..ba4c7260519 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -41,7 +41,7 @@ $action = GETPOST('action', 'aZ09'); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id', 'int'); // id of record -$mode = GETPOST('mode', 'aZ09'); // '' or 'tmp' +$mode = GETPOST('mode', 'aZ09'); // '' or '_tmp' $piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id) // Security check diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 0162a98394e..a700ebecb1b 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1127,7 +1127,7 @@ class BookKeeping extends CommonObject * * @param User $user User that modifies * @param bool $notrigger false=launch triggers after, true=disable triggers - * @param string $mode Mode + * @param string $mode Mode ('' or _tmp') * @return int <0 if KO, >0 if OK */ public function update(User $user, $notrigger = false, $mode = '') @@ -1254,12 +1254,12 @@ class BookKeeping extends CommonObject } /** - * Update movement + * Update accounting movement * * @param string $piece_num Piece num * @param string $field Field * @param string $value Value - * @param string $mode Mode + * @param string $mode Mode ('' or _tmp') * @return number <0 if KO, >0 if OK */ public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '') @@ -1268,9 +1268,9 @@ class BookKeeping extends CommonObject $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode." as ab"; - $sql .= ' SET ab.'.$field.'='.(is_numeric($value) ? $value : "'".$this->db->escape($value)."'"); - $sql .= ' WHERE ab.piece_num='.$piece_num; + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode; + $sql .= ' SET '.$field.'='.(is_numeric($value) ? $value : "'".$this->db->escape($value)."'"); + $sql .= " WHERE piece_num = '".$this->db->escape($piece_num)."'"; $resql = $this->db->query($sql); if (!$resql) {