From a2902877ce46ff5ea7283d6bf8e97778d0e760fc Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 10 Apr 2011 09:57:54 +0000 Subject: [PATCH] Fix: uniformize code --- htdocs/comm/propal/class/propal.class.php | 6 +++--- htdocs/commande/class/commande.class.php | 13 +++++-------- htdocs/compta/facture/class/facture.class.php | 15 +++++++-------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index bc8b46dd3f1..c5b4e6acee6 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -551,7 +551,7 @@ class Propal extends CommonObject // For triggers $line->fetch($lineid); - if ($line->delete($lineid)) + if ($line->delete() > 0) { $this->update_price(1); @@ -2484,13 +2484,13 @@ class PropaleLigne * Delete line in database * @return int <0 si ko, >0 si ok */ - function delete($rowid) + function delete() { global $conf,$langs,$user; $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$rowid; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".$this->rowid; dol_syslog("PropaleLigne::delete sql=".$sql, LOG_DEBUG); if ($this->db->query($sql) ) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f463b55d622..96db18bbd3a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1547,9 +1547,7 @@ class Commande extends CommonObject // For triggers $line->fetch($lineid); - $result=$line->delete($user); - - if ($result > 0) + if ($line->delete() > 0) { $result=$this->update_price(1); @@ -2663,13 +2661,12 @@ class OrderLine } /** - * \brief Supprime la ligne de commande en base - * \user User object - * \return int <0 si ko, >0 si ok + * Delete line in database + * @return int <0 si ko, >0 si ok */ - function delete($user) + function delete() { - global $langs, $conf; + global $conf, $user, $langs; $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';"; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d649b1c34fb..906714cbee9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1923,12 +1923,11 @@ class Facture extends CommonObject } /** - * \brief Supprime une ligne facture de la base - * \param rowid Id de la ligne de facture a supprimer - * \param user User object - * \return int <0 if KO, >0 if OK + * Delete line in database + * @param rowid Id of line to delete + * @return int <0 if KO, >0 if OK */ - function deleteline($rowid, $user='') + function deleteline($rowid) { global $langs, $conf; @@ -1962,7 +1961,7 @@ class Facture extends CommonObject // For triggers $line->fetch($rowid); - if ($line->delete($user) > 0) + if ($line->delete() > 0) { $result=$this->update_price(1); @@ -3410,13 +3409,13 @@ class FactureLigne * Delete line in database * @return int <0 si ko, >0 si ok */ - function delete($rowid) + function delete() { global $conf,$langs,$user; $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$rowid; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid; dol_syslog("FactureLigne::delete sql=".$sql, LOG_DEBUG); if ($this->db->query($sql) ) {