Cleanup set_draft in syslog

This commit is contained in:
Francis Appels 2019-05-01 09:38:27 +02:00
parent 61bf731d17
commit 18c5c586ab
4 changed files with 15 additions and 20 deletions

View File

@ -499,7 +499,7 @@ class Commande extends CommonOrder
return -1; return -1;
} }
dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$this->db->begin(); $this->db->begin();

View File

@ -2532,7 +2532,6 @@ class Facture extends CommonInvoice
return true; return true;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set draft status * Set draft status
* *
@ -2540,7 +2539,7 @@ class Facture extends CommonInvoice
* @param int $idwarehouse Id warehouse to use for stock change. * @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function setDraft($user, $idwarehouse = -1) public function setDraft($user, $idwarehouse = -1)
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -2549,11 +2548,11 @@ class Facture extends CommonInvoice
if ($this->statut == self::STATUS_DRAFT) if ($this->statut == self::STATUS_DRAFT)
{ {
dol_syslog(get_class($this)."::set_draft already draft status", LOG_WARNING); dol_syslog(__METHOD__." already draft status", LOG_WARNING);
return 0; return 0;
} }
dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$this->db->begin(); $this->db->begin();
@ -2564,10 +2563,10 @@ class Facture extends CommonInvoice
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
if (! $error) if (! $error)
{ {
$this->oldcopy= clone $this; $this->oldcopy= clone $this;
} }
// Si on decremente le produit principal et ses composants a la validation de facture, on réincrement // Si on decremente le produit principal et ses composants a la validation de facture, on réincrement
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
@ -2595,15 +2594,15 @@ class Facture extends CommonInvoice
$this->brouillon = 1; $this->brouillon = 1;
$this->statut = self::STATUS_DRAFT; $this->statut = self::STATUS_DRAFT;
// Call trigger // Call trigger
$result=$this->call_trigger('BILL_UNVALIDATE', $user); $result=$this->call_trigger('BILL_UNVALIDATE', $user);
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
$this->statut=$old_statut; $this->statut=$old_statut;
$this->brouillon=0; $this->brouillon=0;
} }
// End call triggers // End call triggers
} else { } else {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;

View File

@ -1474,8 +1474,6 @@ class FactureFournisseur extends CommonInvoice
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set draft status * Set draft status
* *
@ -1492,11 +1490,11 @@ class FactureFournisseur extends CommonInvoice
if ($this->statut == self::STATUS_DRAFT) if ($this->statut == self::STATUS_DRAFT)
{ {
dol_syslog(get_class($this)."::set_draft already draft status", LOG_WARNING); dol_syslog(__METHOD__." already draft status", LOG_WARNING);
return 0; return 0;
} }
dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
$this->db->begin(); $this->db->begin();

View File

@ -1763,8 +1763,6 @@ class Reception extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set draft status * Set draft status
* *
@ -1797,7 +1795,7 @@ class Reception extends CommonObject
$sql.= " SET fk_statut = ".self::STATUS_DRAFT; $sql.= " SET fk_statut = ".self::STATUS_DRAFT;
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::set_draft", LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
// If stock increment is done on closing // If stock increment is done on closing