commit
5c81074483
@ -26,6 +26,14 @@ For users:
|
|||||||
- Fix: [ bug #1494 ] CATEGORY_CREATE and CATEGORY_MODIFY triggers do not intercept trigger action
|
- Fix: [ bug #1494 ] CATEGORY_CREATE and CATEGORY_MODIFY triggers do not intercept trigger action
|
||||||
- Fix: [ bug #1502 ] DON_CREATE trigger does not intercept trigger action
|
- Fix: [ bug #1502 ] DON_CREATE trigger does not intercept trigger action
|
||||||
- Fix: [ bug #1505, #1504] Project trigger problem
|
- Fix: [ bug #1505, #1504] Project trigger problem
|
||||||
|
- Fix: [ bug #1463, #1464 ] Proposal triggers problem
|
||||||
|
- Fix: [ bug #1498, #1499 ] Shipment/Delivery triggers problem
|
||||||
|
- Fix: [ bug #1465, #1466 ] Product triggers problem
|
||||||
|
- Fix: [ bug #1508 ] STOCK_MOVEMENT does not show trigger error message
|
||||||
|
- Fix: [ bug #1501 ] DEPLACEMENT_CREATE trigger do not intercept trigger action
|
||||||
|
- Fix: [ bug #1506, #1507 ] ECM trigger error problem
|
||||||
|
- Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message
|
||||||
|
|
||||||
|
|
||||||
For translators:
|
For translators:
|
||||||
- Update language files.
|
- Update language files.
|
||||||
|
|||||||
@ -856,24 +856,22 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROPAL_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('PROPAL_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -885,7 +883,6 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -1006,14 +1003,10 @@ class Propal extends CommonObject
|
|||||||
if ($reshook < 0) $error++;
|
if ($reshook < 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROPAL_CLONE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('PROPAL_CLONE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End
|
// End
|
||||||
@ -1326,14 +1319,10 @@ class Propal extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROPAL_VALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('PROPAL_VALIDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1668,25 +1657,24 @@ class Propal extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROPAL_REOPEN',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('PROPAL_REOPEN',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Commit or rollback
|
// Commit or rollback
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
foreach($this->errors as $errmsg)
|
if (!empty($this->errors))
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
foreach($this->errors as $errmsg)
|
||||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
{
|
||||||
}
|
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1*$error;
|
return -1*$error;
|
||||||
}
|
}
|
||||||
@ -1751,14 +1739,10 @@ class Propal extends CommonObject
|
|||||||
propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL?$conf->global->PROPALE_ADDON_PDF_ODT_TOBILL:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROPAL_CLOSE_SIGNED',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('PROPAL_CLOSE_SIGNED',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1777,18 +1761,21 @@ class Propal extends CommonObject
|
|||||||
propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
propale_pdf_create($this->db, $this, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED?$conf->global->PROPALE_ADDON_PDF_ODT_CLOSED:$this->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROPAL_CLOSE_REFUSED',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('PROPAL_CLOSE_REFUSED',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
}
|
||||||
$error++; $this->errors=$interface->errors;
|
if ( ! $error )
|
||||||
}
|
{
|
||||||
// Fin appel triggers
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2039,15 +2026,11 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PROPAL_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('PROPAL_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2145,7 +2128,6 @@ class Propal extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2931,14 +2913,14 @@ class PropaleLigne extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEPROPAL_INSERT',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result = $interface->run_triggers('LINEPROPAL_INSERT',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) {
|
$this->db->rollback();
|
||||||
$error++; $this->errors=$interface->errors;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -2981,14 +2963,14 @@ class PropaleLigne extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEPROPAL_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result = $interface->run_triggers('LINEPROPAL_DELETE',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) {
|
$this->db->rollback();
|
||||||
$error++; $this->errors=$interface->errors;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
@ -3091,14 +3073,14 @@ class PropaleLigne extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEPROPAL_UPDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result = $interface->run_triggers('LINEPROPAL_UPDATE',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) {
|
$this->db->rollback();
|
||||||
$error++; $this->errors=$interface->errors;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|||||||
@ -126,15 +126,15 @@ class Deplacement extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."deplacement");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."deplacement");
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('DEPLACEMENT_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('DEPLACEMENT_CREATE',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) {
|
$this->db->rollback();
|
||||||
$error++; $this->errors=$interface->errors;
|
return -2;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
|
|
||||||
$result=$this->update($user);
|
$result=$this->update($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -183,12 +183,10 @@ class Contact extends CommonObject
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CONTACT_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CONTACT_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -304,12 +302,10 @@ class Contact extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CONTACT_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CONTACT_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -319,7 +315,6 @@ class Contact extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=join(',',$this->errors);
|
|
||||||
dol_syslog(get_class($this)."::update Error ".$this->error,LOG_ERR);
|
dol_syslog(get_class($this)."::update Error ".$this->error,LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -$error;
|
return -$error;
|
||||||
@ -777,14 +772,10 @@ class Contact extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CONTACT_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CONTACT_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if ($error) $this->error=join(',',$this->errors);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1067,12 +1058,10 @@ class Contact extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::setstatus", LOG_DEBUG);
|
dol_syslog(get_class($this)."::setstatus", LOG_DEBUG);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('CONTACT_ENABLEDISABLE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('CONTACT_ENABLEDISABLE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
|
|||||||
@ -138,19 +138,30 @@ if (empty($reshook))
|
|||||||
if ($action == 'disable')
|
if ($action == 'disable')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->setstatus(0);
|
if ($object->setstatus(0)<0)
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
{
|
||||||
exit;
|
setEventMessage($object->error,'errors');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirmation activation
|
// Confirmation activation
|
||||||
if ($action == 'enable')
|
if ($action == 'enable')
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->setstatus(1);
|
if ($object->setstatus(1)<0)
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
{
|
||||||
exit;
|
setEventMessage($object->error,'errors');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add contact
|
// Add contact
|
||||||
@ -235,7 +246,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error=$object->error; $errors=$object->errors;
|
setEventMessage($object->error,'errors');
|
||||||
|
setEventMessage($object->errors,'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +307,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error=$object->error; $errors=$object->errors;
|
setEventMessage($object->error,'errors');
|
||||||
|
setEventMessage($object->errors,'errors');
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -367,6 +380,8 @@ else
|
|||||||
|
|
||||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||||
dol_fiche_head($head, 'card', $title, 0, 'contact');
|
dol_fiche_head($head, 'card', $title, 0, 'contact');
|
||||||
|
|
||||||
|
dol_htmloutput_events();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->rights->societe->contact->creer)
|
if ($user->rights->societe->contact->creer)
|
||||||
|
|||||||
@ -211,6 +211,10 @@ class InterfaceDemo
|
|||||||
{
|
{
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
}
|
||||||
|
elseif ($action == 'CONTACT_ENABLEDISABLE')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
|
||||||
// Products
|
// Products
|
||||||
elseif ($action == 'PRODUCT_CREATE')
|
elseif ($action == 'PRODUCT_CREATE')
|
||||||
@ -222,6 +226,30 @@ class InterfaceDemo
|
|||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
}
|
||||||
elseif ($action == 'PRODUCT_DELETE')
|
elseif ($action == 'PRODUCT_DELETE')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'PRODUCT_PRICE_MODIFY')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Stock mouvement
|
||||||
|
elseif ($action == 'STOCK_MOVEMENT')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//MYECMDIR
|
||||||
|
elseif ($action == 'MYECMDIR_DELETE')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'MYECMDIR_CREATE')
|
||||||
|
{
|
||||||
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
|
}
|
||||||
|
elseif ($action == 'MYECMDIR_MODIFY')
|
||||||
{
|
{
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,12 +152,10 @@ class EcmDirectory // extends CommonObject
|
|||||||
$result=dol_mkdir($dir);
|
$result=dol_mkdir($dir);
|
||||||
if ($result < 0) { $error++; $this->error="ErrorFailedToCreateDir"; }
|
if ($result < 0) { $error++; $this->error="ErrorFailedToCreateDir"; }
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('MYECMDIR_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('MYECMDIR_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -219,12 +217,10 @@ class EcmDirectory // extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('MYECMDIR_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('MYECMDIR_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -352,7 +348,18 @@ class EcmDirectory // extends CommonObject
|
|||||||
$this->error="Error ".$this->db->lasterror();
|
$this->error="Error ".$this->db->lasterror();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('MYECMDIR_DELETE',$user);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
if ($mode != 'databaseonly')
|
if ($mode != 'databaseonly')
|
||||||
{
|
{
|
||||||
$file = $conf->ecm->dir_output . "/" . $relativepath;
|
$file = $conf->ecm->dir_output . "/" . $relativepath;
|
||||||
@ -371,16 +378,6 @@ class EcmDirectory // extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('MYECMDIR_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error) return 1;
|
if (! $error) return 1;
|
||||||
else return -1;
|
else return -1;
|
||||||
}
|
}
|
||||||
@ -696,5 +693,38 @@ class EcmDirectory // extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Call trigger based on this instance
|
||||||
|
*
|
||||||
|
* NB: Error from trigger are stacked in errors
|
||||||
|
* NB2: if trigger fail, action should be canceled.
|
||||||
|
* NB3: Should be deleted if EcmDirectory extend CommonObject
|
||||||
|
*
|
||||||
|
* @param string $trigger_name trigger's name to execute
|
||||||
|
* @param User $user Object user
|
||||||
|
* @return int Result of run_triggers
|
||||||
|
*/
|
||||||
|
function call_trigger($trigger_name, $user)
|
||||||
|
{
|
||||||
|
global $langs,$conf;
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
$interface=new Interfaces($this->db);
|
||||||
|
$result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf);
|
||||||
|
if ($result < 0) {
|
||||||
|
if (!empty($this->errors))
|
||||||
|
{
|
||||||
|
$this->errors=array_merge($this->errors,$interface->errors);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errors=$interface->errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -275,12 +275,10 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
$result=$this->call_trigger('SHIPPING_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('SHIPPING_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -656,12 +654,10 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
$result=$this->call_trigger('SHIPPING_VALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('SHIPPING_VALIDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -867,12 +863,10 @@ class Expedition extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
$result=$this->call_trigger('SHIPPING_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('SHIPPING_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -982,12 +976,10 @@ class Expedition extends CommonObject
|
|||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
$result=$this->call_trigger('SHIPPING_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('SHIPPING_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -241,26 +241,34 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped
|
|||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$result = $object->valid($user);
|
$result = $object->valid($user);
|
||||||
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang='';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
|
||||||
if (! empty($newlang))
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate("",$conf);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
}
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
|
||||||
{
|
|
||||||
$ret=$object->fetch($id); // Reload to get new records
|
|
||||||
$result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs);
|
|
||||||
}
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,$result);
|
$langs->load("errors");
|
||||||
exit;
|
setEventMessage($langs->trans($object->error),'errors');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Define output language
|
||||||
|
$outputlangs = $langs;
|
||||||
|
$newlang='';
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||||
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
|
$outputlangs = new Translate("",$conf);
|
||||||
|
$outputlangs->setDefaultLang($newlang);
|
||||||
|
}
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||||
|
{
|
||||||
|
$ret=$object->fetch($id); // Reload to get new records
|
||||||
|
$result=expedition_pdf_create($db,$object,$object->modelpdf,$outputlangs);
|
||||||
|
}
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
dol_print_error($db,$result);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -446,15 +446,12 @@ class Livraison extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
$result=$this->call_trigger('DELIVERY_VALIDATE',$user);
|
||||||
$interface = new Interfaces($this->db);
|
// End call triggers
|
||||||
$result = $interface->run_triggers('DELIVERY_VALIDATE', $this, $user, $langs, $conf);
|
|
||||||
// Fin appel triggers
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->error = $interface->errors;
|
|
||||||
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -604,14 +601,14 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
|
$result=$this->call_trigger('DELIVERY_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('DELIVERY_DELETE',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) {
|
$this->db->rollback();
|
||||||
$error++; $this->errors=$interface->errors;
|
return -4;
|
||||||
}
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -427,12 +427,10 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PRODUCT_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('PRODUCT_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -665,12 +663,10 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PRODUCT_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('PRODUCT_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref))
|
if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref))
|
||||||
@ -763,34 +759,33 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PRODUCT_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) { $error++; }
|
||||||
$result=$interface->run_triggers('PRODUCT_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete all child tables
|
// Delete all child tables
|
||||||
$elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock');
|
if (! $error)
|
||||||
foreach($elements as $table)
|
|
||||||
{
|
{
|
||||||
if (! $error)
|
$elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock');
|
||||||
{
|
foreach($elements as $table)
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table;
|
{
|
||||||
$sql.= " WHERE fk_product = ".$id;
|
if (! $error)
|
||||||
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
|
{
|
||||||
$result = $this->db->query($sql);
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX.$table;
|
||||||
if (! $result)
|
$sql.= " WHERE fk_product = ".$id;
|
||||||
{
|
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
|
||||||
$error++;
|
$result = $this->db->query($sql);
|
||||||
$this->errors[] = $this->db->lasterror();
|
if (! $result)
|
||||||
}
|
{
|
||||||
}
|
$error++;
|
||||||
|
$this->errors[] = $this->db->lasterror();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete product
|
// Delete product
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -1227,6 +1222,8 @@ class Product extends CommonObject
|
|||||||
$localtax2=get_localtax($newvat,2);
|
$localtax2=get_localtax($newvat,2);
|
||||||
if (empty($localtax1)) $localtax1=0; // If = '' then = 0
|
if (empty($localtax1)) $localtax1=0; // If = '' then = 0
|
||||||
if (empty($localtax2)) $localtax2=0; // If = '' then = 0
|
if (empty($localtax2)) $localtax2=0; // If = '' then = 0
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
// Ne pas mettre de quote sur les numeriques decimaux.
|
// Ne pas mettre de quote sur les numeriques decimaux.
|
||||||
// Ceci provoque des stockages avec arrondis en base au lieu des valeurs exactes.
|
// Ceci provoque des stockages avec arrondis en base au lieu des valeurs exactes.
|
||||||
@ -1264,19 +1261,21 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
$this->level = $level; // Store level of price edited for trigger
|
$this->level = $level; // Store level of price edited for trigger
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
$result=$this->call_trigger('PRODUCT_PRICE_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('PRODUCT_PRICE_MODIFY',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0)
|
$this->db->rollback();
|
||||||
{
|
return -1;
|
||||||
$error++; $this->errors=$interface->errors;
|
}
|
||||||
}
|
// End call triggers
|
||||||
// Fin appel triggers
|
|
||||||
|
$this->db->commit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
$this->db->rollback();
|
||||||
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2876,7 +2875,7 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
$this->error=$movementstock->error;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -3473,7 +3472,7 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
$this->error=$movementstock->error;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -154,6 +154,11 @@ if ($action == "correct_stock" && ! $cancel)
|
|||||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id);
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessage($product->error,'errors');
|
||||||
|
$action='correction';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,6 +258,8 @@ if ($id > 0 || $ref)
|
|||||||
$titre=$langs->trans("CardProduct".$product->type);
|
$titre=$langs->trans("CardProduct".$product->type);
|
||||||
$picto=($product->type==1?'service':'product');
|
$picto=($product->type==1?'service':'product');
|
||||||
dol_fiche_head($head, 'stock', $titre, 0, $picto);
|
dol_fiche_head($head, 'stock', $titre, 0, $picto);
|
||||||
|
|
||||||
|
dol_htmloutput_events();
|
||||||
|
|
||||||
$form = new Form($db);
|
$form = new Form($db);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user