Fix: uniformize code

This commit is contained in:
Regis Houssin 2011-04-10 09:57:54 +00:00
parent 75bf04ec71
commit a2902877ce
3 changed files with 15 additions and 19 deletions

View File

@ -551,7 +551,7 @@ class Propal extends CommonObject
// For triggers // For triggers
$line->fetch($lineid); $line->fetch($lineid);
if ($line->delete($lineid)) if ($line->delete() > 0)
{ {
$this->update_price(1); $this->update_price(1);
@ -2484,13 +2484,13 @@ class PropaleLigne
* Delete line in database * Delete line in database
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function delete($rowid) function delete()
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$this->db->begin(); $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); dol_syslog("PropaleLigne::delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {

View File

@ -1547,9 +1547,7 @@ class Commande extends CommonObject
// For triggers // For triggers
$line->fetch($lineid); $line->fetch($lineid);
$result=$line->delete($user); if ($line->delete() > 0)
if ($result > 0)
{ {
$result=$this->update_price(1); $result=$this->update_price(1);
@ -2663,13 +2661,12 @@ class OrderLine
} }
/** /**
* \brief Supprime la ligne de commande en base * Delete line in database
* \user User object * @return int <0 si ko, >0 si ok
* \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."';"; $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';";

View File

@ -1923,12 +1923,11 @@ class Facture extends CommonObject
} }
/** /**
* \brief Supprime une ligne facture de la base * Delete line in database
* \param rowid Id de la ligne de facture a supprimer * @param rowid Id of line to delete
* \param user User object * @return int <0 if KO, >0 if OK
* \return int <0 if KO, >0 if OK
*/ */
function deleteline($rowid, $user='') function deleteline($rowid)
{ {
global $langs, $conf; global $langs, $conf;
@ -1962,7 +1961,7 @@ class Facture extends CommonObject
// For triggers // For triggers
$line->fetch($rowid); $line->fetch($rowid);
if ($line->delete($user) > 0) if ($line->delete() > 0)
{ {
$result=$this->update_price(1); $result=$this->update_price(1);
@ -3410,13 +3409,13 @@ class FactureLigne
* Delete line in database * Delete line in database
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function delete($rowid) function delete()
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$this->db->begin(); $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); dol_syslog("FactureLigne::delete sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {