commit
dbb2d464db
@ -47,6 +47,7 @@ For developers:
|
|||||||
- New: Add trigger DON_UPDATE, DON_DELETE
|
- New: Add trigger DON_UPDATE, DON_DELETE
|
||||||
- New: Add country iso code on 3 chars into table of countries.
|
- New: Add country iso code on 3 chars into table of countries.
|
||||||
- Qual: Removed hard coded rowid into data init of table llx_c_action_trigger.
|
- Qual: Removed hard coded rowid into data init of table llx_c_action_trigger.
|
||||||
|
- LINEBILL_DELETE, LINK_DELETE, ORDER_SUPPLIER_DELETE, RESOURCE_DELETE trigger called before SQL delete
|
||||||
- New: [ Task #1481 ] Add trigger BILL_SUPPLIER_UPDATE.
|
- New: [ Task #1481 ] Add trigger BILL_SUPPLIER_UPDATE.
|
||||||
- New: [ Task #1495 ] Add trigger LINECONTRACT_CREATE.
|
- New: [ Task #1495 ] Add trigger LINECONTRACT_CREATE.
|
||||||
|
|
||||||
|
|||||||
@ -238,6 +238,7 @@ class Commande extends CommonOrder
|
|||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,8 +260,13 @@ class Commande extends CommonOrder
|
|||||||
$mouvP->origin = &$this;
|
$mouvP->origin = &$this;
|
||||||
// We decrement stock of product (and sub-products)
|
// We decrement stock of product (and sub-products)
|
||||||
$result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr",$num));
|
$result=$mouvP->livraison($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderValidatedInDolibarr",$num));
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$error++;
|
||||||
|
$this->error=$mouvP->error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if ($error) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -296,12 +302,10 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_VALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_VALIDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set new ref and current status
|
// Set new ref and current status
|
||||||
@ -319,7 +323,6 @@ class Commande extends CommonOrder
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,12 +433,10 @@ class Commande extends CommonOrder
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_REOPEN',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_REOPEN',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -491,12 +492,10 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_CLOSE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_CLOSE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -558,8 +557,11 @@ class Commande extends CommonOrder
|
|||||||
$mouvP = new MouvementStock($this->db);
|
$mouvP = new MouvementStock($this->db);
|
||||||
// We increment stock of product (and sub-products)
|
// We increment stock of product (and sub-products)
|
||||||
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref));
|
$result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, $this->lines[$i]->subprice, $langs->trans("OrderCanceledInDolibarr",$this->ref));
|
||||||
if ($result < 0) {
|
if ($result < 0)
|
||||||
|
{
|
||||||
$error++;
|
$error++;
|
||||||
|
$this->error=$mouvP->error;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -567,14 +569,10 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_CANCEL',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_CANCEL',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -585,8 +583,6 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$mouvP->error;
|
|
||||||
|
|
||||||
foreach($this->errors as $errmsg)
|
foreach($this->errors as $errmsg)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::cancel ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::cancel ".$errmsg, LOG_ERR);
|
||||||
@ -812,12 +808,10 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
@ -909,12 +903,10 @@ class Commande extends CommonOrder
|
|||||||
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('ORDER_CLONE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_CLONE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End
|
// End
|
||||||
@ -2228,14 +2220,10 @@ class Commande extends CommonOrder
|
|||||||
dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG);
|
dol_syslog(get_class($this)."::classifyBilled", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_CLASSIFY_BILLED',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_CLASSIFY_BILLED',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -2247,8 +2235,6 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
|
||||||
|
|
||||||
foreach($this->errors as $errmsg)
|
foreach($this->errors as $errmsg)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::classifyBilled ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::classifyBilled ".$errmsg, LOG_ERR);
|
||||||
@ -2453,16 +2439,13 @@ class Commande extends CommonOrder
|
|||||||
|
|
||||||
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('ORDER_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Check for error after each action. If one failed we rollback, don't waste time to do action if previous fail
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Delete order details
|
// Delete order details
|
||||||
@ -2471,6 +2454,7 @@ class Commande extends CommonOrder
|
|||||||
if (! $this->db->query($sql) )
|
if (! $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
|
$this->errors[]=$this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete order
|
// Delete order
|
||||||
@ -2479,6 +2463,7 @@ class Commande extends CommonOrder
|
|||||||
if (! $this->db->query($sql) )
|
if (! $this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
|
$this->errors[]=$this->db->lasterror();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete linked object
|
// Delete linked object
|
||||||
@ -2538,7 +2523,6 @@ class Commande extends CommonOrder
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
foreach($this->errors as $errmsg)
|
foreach($this->errors as $errmsg)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||||
@ -3197,12 +3181,10 @@ class OrderLine extends CommonOrderLine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEORDER_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('LINEORDER_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -3322,12 +3304,10 @@ class OrderLine extends CommonOrderLine
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEORDER_INSERT',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('LINEORDER_INSERT',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
@ -3439,12 +3419,10 @@ class OrderLine extends CommonOrderLine
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEORDER_UPDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result = $interface->run_triggers('LINEORDER_UPDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
|||||||
@ -482,14 +482,10 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
else if ($reshook < 0) $error++;
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -655,14 +651,10 @@ class Facture extends CommonInvoice
|
|||||||
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('BILL_CLONE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_CLONE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End
|
// End
|
||||||
@ -1100,14 +1092,10 @@ class Facture extends CommonInvoice
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1262,14 +1250,10 @@ class Facture extends CommonInvoice
|
|||||||
|
|
||||||
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('BILL_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Removed extrafields
|
// Removed extrafields
|
||||||
@ -1403,7 +1387,6 @@ class Facture extends CommonInvoice
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->lasterror();
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -1439,14 +1422,10 @@ class Facture extends CommonInvoice
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_PAYED',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_PAYED',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1495,14 +1474,10 @@ class Facture extends CommonInvoice
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_UNPAYED',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_UNPAYED',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1562,18 +1537,14 @@ class Facture extends CommonInvoice
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_CANCEL',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('BILL_CANCEL',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
@ -1791,14 +1762,11 @@ class Facture extends CommonInvoice
|
|||||||
// Trigger calls
|
// Trigger calls
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_VALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_VALIDATE',$this,$user,$langs,$conf);
|
//TODO: Restoring ref, facnumber, statut, brouillon to previous value if trigger fail
|
||||||
if ($result < 0) {
|
// End call triggers
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1872,17 +1840,15 @@ class Facture extends CommonInvoice
|
|||||||
$old_statut=$this->statut;
|
$old_statut=$this->statut;
|
||||||
$this->brouillon = 1;
|
$this->brouillon = 1;
|
||||||
$this->statut = 0;
|
$this->statut = 0;
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_UNVALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('BILL_UNVALIDATE',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->statut=$old_statut;
|
$this->statut=$old_statut;
|
||||||
$this->brouillon=0;
|
$this->brouillon=0;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
} else {
|
} else {
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
@ -3567,18 +3533,14 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEBILL_INSERT',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result = $interface->run_triggers('LINEBILL_INSERT',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -3683,18 +3645,14 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEBILL_UPDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result = $interface->run_triggers('LINEBILL_UPDATE',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
@ -3720,25 +3678,21 @@ class FactureLigne extends CommonInvoiceLine
|
|||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('LINEBILL_DELETE',$user);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid;
|
||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result = $interface->run_triggers('LINEBILL_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -104,12 +104,12 @@ class Localtax extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."localtax");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."localtax");
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LOCALTAX_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('LOCALTAX_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
//FIXME: Add rollback if trigger fail
|
||||||
|
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
@ -165,12 +165,12 @@ class Localtax 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('LOCALTAX_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('LOCALTAX_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
//FIXME: Add rollback if trigger fail
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -253,6 +253,12 @@ class Localtax extends CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('LOCALTAX_DELETE',$user);
|
||||||
|
if ($result < 0) return -1;
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."localtax";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
@ -264,12 +270,6 @@ class Localtax extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('LOCALTAX_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -124,14 +124,12 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Start triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PAYMENT_SALARY_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('PAYMENT_SALARY_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
//FIXME: Add rollback if trigger fail
|
||||||
}
|
|
||||||
// End triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -225,6 +223,12 @@ class PaymentSalary extends CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('PAYMENT_SALARY_DELETE',$user);
|
||||||
|
if ($result < 0) return -1;
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
@ -236,15 +240,6 @@ class PaymentSalary extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('PAYMENT_SALARY_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// End triggers
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,34 +423,21 @@ class PaymentSalary extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PAYMENT_SALARY_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $ok=0;
|
||||||
$result=$interface->run_triggers('PAYMENT_SALARY_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// End triggers
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else $ok=0;
|
else $ok=0;
|
||||||
|
|
||||||
if ($ok)
|
if ($ok)
|
||||||
{
|
{
|
||||||
if ($ok)
|
$this->db->commit();
|
||||||
{
|
return $this->id;
|
||||||
$this->db->commit();
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->db->rollback();
|
|
||||||
return -3;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,13 +121,12 @@ class Tva extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva");
|
||||||
|
|
||||||
// Start triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('TVA_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('TVA_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End triggers
|
|
||||||
|
|
||||||
|
//FIXME: Add rollback if trigger fail
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -187,12 +186,12 @@ class Tva extends CommonObject
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Start triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('TVA_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('TVA_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End triggers
|
//FIXME: Add rollback if trigger fail
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -280,6 +279,11 @@ class Tva extends CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('TVA_DELETE',$user);
|
||||||
|
if ($result < 0) return -1;
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."tva";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."tva";
|
||||||
$sql.= " WHERE rowid=".$this->id;
|
$sql.= " WHERE rowid=".$this->id;
|
||||||
|
|
||||||
@ -291,12 +295,6 @@ class Tva extends CommonObject
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('TVA_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End triggers
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -541,12 +539,15 @@ class Tva extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva"); // TODO should be called paiementtva
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."tva"); // TODO should be called paiementtva
|
||||||
|
|
||||||
// Start triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
//XXX: Should be done just befor commit no ?
|
||||||
$interface=new Interfaces($this->db);
|
$result=$this->call_trigger('TVA_ADDPAYMENT',$user);
|
||||||
$result=$interface->run_triggers('TVA_ADDPAYMENT',$this,$user,$langs,$conf);
|
if ($result < 0)
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
{
|
||||||
// End triggers
|
$this->id = 0;
|
||||||
|
$ok = 0;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
if ($this->id > 0)
|
if ($this->id > 0)
|
||||||
{
|
{
|
||||||
@ -595,7 +596,6 @@ class Tva extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,15 +99,10 @@ class Link extends CommonObject
|
|||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "links");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "links");
|
||||||
|
|
||||||
if ($this->id > 0) {
|
if ($this->id > 0) {
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINK_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('LINK_CREATE', $this, $user, $langs, $conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$this->errors = $interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
} else {
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -190,15 +185,10 @@ class Link extends CommonObject
|
|||||||
{
|
{
|
||||||
if ($call_trigger)
|
if ($call_trigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINK_MODIFY',$user);
|
||||||
$interface = new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result = $interface->run_triggers('LINK_MODIFY', $this, $user, $langs, $conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$this->errors = $interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -339,6 +329,11 @@ class Link extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('LINK_DELETE',$user);
|
||||||
|
if ($result < 0) return -1;
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Remove link
|
// Remove link
|
||||||
@ -353,18 +348,6 @@ class Link extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (! $error) {
|
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result = $interface->run_triggers('LINK_DELETE', $this, $user, $langs, $conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$this->errors = $interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
|
|||||||
@ -388,18 +388,14 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_SUPPLIER_VALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
{
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -653,12 +649,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_SUPPLIER_APPROVE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_SUPPLIER_APPROVE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -714,17 +708,16 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
if ($error == 0)
|
if ($error == 0)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_SUPPLIER_REFUSE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('ORDER_SUPPLIER_REFUSE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
else
|
||||||
|
$this->db->commit();
|
||||||
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -772,12 +765,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$result = 0;
|
$result = 0;
|
||||||
$this->log($user, $statut, time());
|
$this->log($user, $statut, time());
|
||||||
|
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_SUPPLIER_CANCEL',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_SUPPLIER_CANCEL',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if ($error == 0)
|
if ($error == 0)
|
||||||
{
|
{
|
||||||
@ -967,18 +958,14 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('ORDER_SUPPLIER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('ORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
{
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -1041,12 +1028,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
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('ORDER_SUPPLIER_CLONE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('ORDER_SUPPLIER_CLONE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End
|
// End
|
||||||
@ -1222,18 +1207,14 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEORDER_SUPPLIER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('LINEORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
{
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->update_price('','auto');
|
$this->update_price('','auto');
|
||||||
@ -1295,18 +1276,14 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEORDER_SUPPLIER_DISPATCH',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('LINEORDER_SUPPLIER_DISPATCH',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
{
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -1369,15 +1346,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEORDER_SUPPLIER_DELETE',$user);
|
||||||
$result = 0;
|
if ($result < 0) $error++;
|
||||||
$interface=new Interfaces($this->db);
|
// End call triggers
|
||||||
$result = $interface->run_triggers('LINEORDER_SUPPLIER_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1425,6 +1397,16 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('ORDER_SUPPLIER_DELETE',$user);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =". $this->id ;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =". $this->id ;
|
||||||
@ -1461,18 +1443,6 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('ORDER_SUPPLIER_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// We remove directory
|
// We remove directory
|
||||||
@ -1828,18 +1798,14 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEORDER_SUPPLIER_UPDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('LINEORDER_SUPPLIER_UPDATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
{
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour info denormalisees au niveau facture
|
// Mise a jour info denormalisees au niveau facture
|
||||||
|
|||||||
@ -254,12 +254,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$result=$this->update_price();
|
$result=$this->update_price();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_SUPPLIER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -671,13 +669,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_SUPPLIER_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_DELETE',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -769,12 +764,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_SUPPLIER_PAYED',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_PAYED',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -819,12 +812,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_SUPPLIER_UNPAYED',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_UNPAYED',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -960,12 +951,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
// Triggers call
|
// Triggers call
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_SUPPLIER_VALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_VALIDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1127,18 +1116,14 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEBILL_SUPPLIER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('LINEBILL_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -1261,18 +1246,14 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINEBILL_SUPPLIER_UPDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('LINEBILL_SUPPLIER_UPDATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update total price into invoice record
|
// Update total price into invoice record
|
||||||
@ -1310,14 +1291,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
|
|
||||||
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('LINEBILL_SUPPLIER_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
@ -203,14 +203,10 @@ class ProductFournisseur extends Product
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
$result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_UPDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('SUPPLIER_PRODUCT_BUYPRICE_UPDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++; $this->error=$interface->errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($error))
|
if (empty($error))
|
||||||
{
|
{
|
||||||
@ -289,14 +285,10 @@ class ProductFournisseur extends Product
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
$result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('SUPPLIER_PRODUCT_BUYPRICE_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
$error++; $this->error=$interface->errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($error))
|
if (empty($error))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -201,12 +201,10 @@ class PaiementFourn extends Paiement
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PAYMENT_SUPPLIER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('PAYMENT_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -120,12 +120,9 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece
|
|||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$commande->call_trigger('ORDER_SUPPLIER_DISPATCH',$user);
|
||||||
$interface=new Interfaces($db);
|
// End call triggers
|
||||||
$result_trigger=$interface->run_triggers('ORDER_SUPPLIER_DISPATCH',$commande,$user,$langs,$conf);
|
|
||||||
if ($result_trigger < 0) { $error++; $commande->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
|
|||||||
@ -313,12 +313,10 @@ class Import
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('IMPORT_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('IMPORT_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -142,12 +142,10 @@ class Opensurveysondage extends CommonObject
|
|||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
//// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('OPENSURVEY_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('OPENSURVEY_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
//// End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,12 +336,10 @@ class Opensurveysondage extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
//// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('OPENSURVEY_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('OPENSURVEY_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
//// End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -245,17 +245,17 @@ class MouvementStock
|
|||||||
|
|
||||||
if ($movestock && ! $error)
|
if ($movestock && ! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
|
|
||||||
$this->product_id = $fk_product;
|
$this->product_id = $fk_product;
|
||||||
$this->entrepot_id = $entrepot_id;
|
$this->entrepot_id = $entrepot_id;
|
||||||
$this->qty = $qty;
|
$this->qty = $qty;
|
||||||
|
|
||||||
$result=$interface->run_triggers('STOCK_MOVEMENT',$this,$user,$langs,$conf);
|
// Call trigger
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
$result=$this->call_trigger('STOCK_MOVEMENT',$user);
|
||||||
// Fin appel triggers
|
if ($result < 0) $error++;
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
//FIXME: Restore previous value of product_id, entrepot_id, qty if trigger fail
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
@ -332,6 +332,14 @@ class Resource extends CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('RESOURCE_DELETE',$user);
|
||||||
|
if ($result < 0) return -1;
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."resource";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."resource";
|
||||||
$sql.= " WHERE rowid =".$rowid;
|
$sql.= " WHERE rowid =".$rowid;
|
||||||
|
|
||||||
@ -343,18 +351,6 @@ class Resource extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
if (! $notrigger)
|
|
||||||
{
|
|
||||||
// Call triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('RESOURCE_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// End call triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -734,15 +730,10 @@ class Resource extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Call trigger
|
||||||
// want this action calls a trigger.
|
$result=$this->call_trigger('RESOURCE_MODIFY',$user);
|
||||||
|
if ($result < 0) $error++;
|
||||||
// Call triggers
|
// End call triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('RESOURCE_MODIFY',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -441,12 +441,10 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
if ($ret >= 0)
|
if ($ret >= 0)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('COMPANY_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('COMPANY_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
else $error++;
|
else $error++;
|
||||||
|
|
||||||
@ -879,12 +877,10 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
if (! $error && $call_trigger)
|
if (! $error && $call_trigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('COMPANY_MODIFY',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('COMPANY_MODIFY',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1247,15 +1243,10 @@ class Societe extends CommonObject
|
|||||||
{
|
{
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if (! $error)
|
// Call trigger
|
||||||
{
|
$result=$this->call_trigger('COMPANY_DELETE',$user);
|
||||||
// Appel des triggers
|
if ($result < 0) $error++;
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
// End call triggers
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('COMPANY_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user