Rename DELIVERY_VALIDATE into SHIPPING_VALIDATE to make a difference between sending (SHIPPING) and receiving module (DELIVERY).

This commit is contained in:
Laurent Destailleur 2010-05-18 07:22:58 +00:00
parent bb5d3bc421
commit 6ef1098734

View File

@ -362,11 +362,13 @@ class Expedition extends CommonObject
// Define new ref // Define new ref
$num = "EXP".$this->id; $num = "EXP".$this->id;
$now=dol_now();
// Validate // Validate
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET";
$sql.= " ref='".$num."'"; $sql.= " ref='".$num."'";
$sql.= ", fk_statut = 1"; $sql.= ", fk_statut = 1";
$sql.= ", date_valid = ".$this->db->idate(mktime()); $sql.= ", date_valid = '".$this->db->idate($now)."'";
$sql.= ", fk_user_valid = ".$user->id; $sql.= ", fk_user_valid = ".$user->id;
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
@ -374,8 +376,8 @@ class Expedition extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (! $resql) if (! $resql)
{ {
dol_syslog("Expedition::valid() Echec update - 10 - sql=".$sql, LOG_ERR); dol_syslog("Expedition::valid Echec update - 10 - sql=".$sql, LOG_ERR);
dol_print_error($this->db); $this->error=$this->db->lasterror();
$error++; $error++;
} }
@ -384,7 +386,7 @@ class Expedition extends CommonObject
// If stock increment is done on sending (recommanded choice) // If stock increment is done on sending (recommanded choice)
if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT) if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT)
{ {
require_once DOL_DOCUMENT_ROOT ."/product/stock/class/mouvementstock.class.php"; require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";
// Loop on each product line to add a stock movement // Loop on each product line to add a stock movement
// TODO possibilite d'expedier a partir d'une propale ou autre origine // TODO possibilite d'expedier a partir d'une propale ou autre origine
@ -420,7 +422,7 @@ class Expedition extends CommonObject
else else
{ {
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->error()." - sql=$sql"; $this->error=$this->db->error();
dol_syslog("Expedition::valid ".$this->error, LOG_ERR); dol_syslog("Expedition::valid ".$this->error, LOG_ERR);
return -2; return -2;
} }
@ -463,7 +465,7 @@ class Expedition extends CommonObject
// Appel des triggers // Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db); $interface=new Interfaces($this->db);
$result=$interface->run_triggers('DELIVERY_VALIDATE',$this,$user,$langs,$conf); $result=$interface->run_triggers('SHIPPING_VALIDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers // Fin appel triggers
} }
@ -475,9 +477,13 @@ class Expedition extends CommonObject
} }
else else
{ {
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::valid ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback(); $this->db->rollback();
$this->error=$this->db->lasterror(); return -1*$error;
return -1;
} }
} }
@ -630,15 +636,12 @@ class Expedition extends CommonObject
{ {
if (! $notrigger) if (! $notrigger)
{ {
// Uncomment this and change MYOBJECT to your own tag if you // Call triggers
// want this action call a trigger. include_once(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php");
$interface=new Interfaces($this->db);
//// Call triggers $result=$interface->run_triggers('SHIPPING_MODIFY',$this,$user,$langs,$conf);
//include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); if ($result < 0) { $error++; $this->errors=$interface->errors; }
//$interface=new Interfaces($this->db); // End call triggers
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
} }
} }