Fix: Missing triggers for suppliers invoices
This commit is contained in:
parent
bf2bf8893a
commit
9626a1bc4f
@ -336,8 +336,8 @@ class Facture extends CommonObject
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$resql=$this->update_price();
|
||||
if ($resql)
|
||||
$result=$this->update_price();
|
||||
if ($result > 0)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/interfaces.class.php");
|
||||
@ -346,11 +346,20 @@ class Facture extends CommonObject
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans('FailedToUpdatePrice');
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
@ -1223,7 +1232,7 @@ class Facture extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \brief Tag la facture comme abandonnee, sans paiement dessus (exemple car facture de remplacement) + appel trigger BILL_CANCEL
|
||||
* \brief Tag la facture comme abandonnee, sans paiement dessus (exemple car facture de remplacement) + appel trigger BILL_CANCELED
|
||||
* \param user Objet utilisateur qui modifie
|
||||
* \param close_code Code de fermeture
|
||||
* \param close_note Commentaire de fermeture
|
||||
|
||||
@ -19,10 +19,10 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/fourn/fournisseur.class.php
|
||||
\ingroup fournisseur,societe
|
||||
\brief Fichier de la classe des fournisseurs
|
||||
\version $Id$
|
||||
* \file htdocs/fourn/fournisseur.class.php
|
||||
* \ingroup fournisseur,societe
|
||||
* \brief Fichier de la classe des fournisseurs
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/societe/societe.class.php");
|
||||
@ -31,8 +31,8 @@ require_once(DOL_DOCUMENT_ROOT."/fourn/fournisseur.product.class.php");
|
||||
|
||||
|
||||
/**
|
||||
\class Fournisseur
|
||||
\brief Classe permettant la gestion des fournisseur
|
||||
* \class Fournisseur
|
||||
* \brief Classe permettant la gestion des fournisseur
|
||||
*/
|
||||
|
||||
class Fournisseur extends Societe
|
||||
@ -41,7 +41,7 @@ class Fournisseur extends Societe
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB handler acc<EFBFBD>s base de donn<EFBFBD>es
|
||||
* \param DB handler acces base de donnees
|
||||
* \param id id societe (0 par defaut)
|
||||
*/
|
||||
|
||||
@ -196,7 +196,7 @@ class Fournisseur extends Societe
|
||||
}
|
||||
$sql.= " ".$clause." s.fournisseur = 1";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -251,7 +251,7 @@ class Fournisseur extends Societe
|
||||
function ListArray()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$arr = array();
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom";
|
||||
|
||||
@ -179,10 +179,26 @@ class FactureFournisseur extends Facture
|
||||
}
|
||||
}
|
||||
// Update total price
|
||||
if ($this->update_price() > 0)
|
||||
$result=$this->update_price();
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('BILL_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -276,7 +276,7 @@ class InterfaceActionsAuto
|
||||
$object->orderrowid=$object->propalrowid=0;
|
||||
$ok=1;
|
||||
}
|
||||
elseif ($action == 'BILL_CANCELED')
|
||||
elseif ($action == 'BILL_CANCEL')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("other");
|
||||
@ -341,6 +341,40 @@ class InterfaceActionsAuto
|
||||
$object->orderrowid=$object->propalrowid=0;
|
||||
$ok=1;
|
||||
}
|
||||
elseif ($action == 'BILL_SUPPLIER_PAYED')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("other");
|
||||
$langs->load("bills");
|
||||
$langs->load("agenda");
|
||||
|
||||
$object->actiontypecode='AC_OTH';
|
||||
$object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
|
||||
$object->actionmsg=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
|
||||
|
||||
$object->sendtoid=0;
|
||||
$object->facid=0;
|
||||
$object->orderrowid=$object->propalrowid=0;
|
||||
$ok=1;
|
||||
}
|
||||
elseif ($action == 'BILL_SUPPLIER_CANCELED')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("other");
|
||||
$langs->load("bills");
|
||||
$langs->load("agenda");
|
||||
|
||||
$object->actiontypecode='AC_OTH';
|
||||
$object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
|
||||
$object->actionmsg=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
|
||||
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
|
||||
|
||||
$object->sendtoid=0;
|
||||
$object->facid=0;
|
||||
$object->orderrowid=$object->propalrowid=0;
|
||||
$ok=1;
|
||||
}
|
||||
|
||||
// Members
|
||||
elseif ($action == 'MEMBER_VALIDATE')
|
||||
|
||||
@ -247,7 +247,7 @@ class InterfacePhenixsynchro
|
||||
$this->desc=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
|
||||
$this->desc.="\n".$langs->transnoentities("Author").': '.$user->login;
|
||||
}
|
||||
elseif ($action == 'BILL_CANCELED')
|
||||
elseif ($action == 'BILL_CANCEL')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("other");
|
||||
|
||||
@ -190,7 +190,7 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_AGENDA_AC
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_AGENDA_ACTIONAUTO_ORDER_SENTBYMAIL','1','chaine','',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_AGENDA_ACTIONAUTO_BILL_VALIDATE','1','chaine','',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_AGENDA_ACTIONAUTO_BILL_PAYED','1','chaine','',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_AGENDA_ACTIONAUTO_BILL_CANCELED','1','chaine','',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_AGENDA_ACTIONAUTO_BILL_CANCEL','1','chaine','',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_AGENDA_ACTIONAUTO_BILL_SENTBYMAIL','1','chaine','',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_VALIDATE','1','chaine','',0);
|
||||
insert into llx_const (name, value, type, note, visible) values ('MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_VALIDATE','1','chaine','',0);
|
||||
|
||||
@ -150,7 +150,7 @@ insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_A
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_AGENDA_ACTIONAUTO_ORDER_SENTBYMAIL','1','chaine','',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_AGENDA_ACTIONAUTO_BILL_VALIDATE','1','chaine','',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_AGENDA_ACTIONAUTO_BILL_PAYED','1','chaine','',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_AGENDA_ACTIONAUTO_BILL_CANCELED','1','chaine','',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_AGENDA_ACTIONAUTO_BILL_CANCEL','1','chaine','',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_AGENDA_ACTIONAUTO_BILL_SENTBYMAIL','1','chaine','',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_AGENDA_ACTIONAUTO_ORDER_SUPPLIER_VALIDATE','1','chaine','',0,__ENTITY__);
|
||||
insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_VALIDATE','1','chaine','',0,__ENTITY__);
|
||||
|
||||
@ -224,7 +224,7 @@ class InterfaceWebcalsynchro
|
||||
$this->desc=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
|
||||
$this->desc.="\n".$langs->transnoentities("Author").': '.$user->login;
|
||||
}
|
||||
elseif ($action == 'BILL_CANCELED')
|
||||
elseif ($action == 'BILL_CANCEL')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("other");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user