Fix: add more triggers

This commit is contained in:
Regis Houssin 2011-07-04 10:35:48 +00:00
parent 71466414d6
commit c10f895d77
7 changed files with 58 additions and 13 deletions

View File

@ -22,7 +22,7 @@
* \file htdocs/comm/propal/index.php
* \ingroup propal
* \brief Home page of proposal area
* \version $Id$
* \version $Id: index.php,v 1.6 2011/07/04 10:35:49 hregis Exp $
*/
require("../../main.inc.php");
@ -249,7 +249,7 @@ if ($resql)
print '<td width="16" align="right" class="nobordernopadding">';
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$filedir=$conf->propale->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
$formfile->show_documents('commande',$filename,$filedir,$urlsource,'','','',1,'',1);
print '</td></tr></table>';
@ -416,6 +416,6 @@ print '</td></tr></table>';
$db->close();
llxFooter('$Date$ - $Revision$');
llxFooter('$Date: 2011/07/04 10:35:49 $ - $Revision: 1.6 $');
?>

View File

@ -25,7 +25,7 @@
* \file htdocs/commande/class/commande.class.php
* \ingroup commande
* \brief Fichier des classes de commandes
* \version $Id: commande.class.php,v 1.117 2011/07/04 09:36:29 eldy Exp $
* \version $Id: commande.class.php,v 1.118 2011/07/04 10:35:49 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php");
@ -258,6 +258,8 @@ class Commande extends CommonObject
if (! $error)
{
$this->oldref='';
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
@ -273,6 +275,8 @@ class Commande extends CommonObject
if (@rename($dirsource, $dirdest))
{
$this->oldref = $comref;
dol_syslog("Rename ok");
// Suppression ancien fichier PDF dans nouveau rep
dol_delete_file($conf->commande->dir_output.'/'.$snum.'/'.$comref.'.*');

View File

@ -28,7 +28,7 @@
* \file htdocs/compta/facture/class/facture.class.php
* \ingroup facture
* \brief Fichier de la classe des factures clients
* \version $Id: facture.class.php,v 1.122 2011/06/30 13:27:20 hregis Exp $
* \version $Id: facture.class.php,v 1.123 2011/07/04 10:35:48 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
@ -1664,6 +1664,8 @@ class Facture extends CommonObject
if (! $error)
{
$this->oldref = '';
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
@ -1679,6 +1681,8 @@ class Facture extends CommonObject
if (@rename($dirsource, $dirdest))
{
$this->oldref = $facref;
dol_syslog("Rename ok");
// Suppression ancien fichier PDF dans nouveau rep
dol_delete_file($conf->facture->dir_output.'/'.$snumfa.'/'.$facref.'.*');
@ -1690,7 +1694,7 @@ class Facture extends CommonObject
// Set new ref and define current statut
if (! $error)
{
$this->ref = $num;
$this->ref = $num;
$this->facnumber=$num;
$this->statut=1;
}

View File

@ -26,7 +26,7 @@
* \ingroup commande
* \brief Fichier contenant la classe mere de generation des commandes en PDF
* et la classe mere de numerotation des commandes
* \version $Id$
* \version $Id: modules_commande.php,v 1.47 2011/07/04 10:35:49 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
@ -146,7 +146,7 @@ class ModeleNumRefCommandes
*/
function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$langs;
global $conf,$user,$langs;
$langs->load("orders");
$dir = "/includes/modules/commande/";
@ -198,6 +198,14 @@ function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0
$outputlangs->charset_output=$sav_charset_output;
// on supprime l'image correspondant au preview
commande_delete_preview($db, $object->id);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('ORDER_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return 1;
}
else

View File

@ -25,7 +25,7 @@
* \ingroup facture
* \brief Fichier contenant la classe mere de generation des factures en PDF
* et la classe mere de numerotation des factures
* \version $Id$
* \version $Id: modules_facture.php,v 1.92 2011/07/04 10:35:48 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
@ -147,7 +147,8 @@ class ModeleNumRefFactures
*/
function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$langs;
global $conf,$user,$langs;
$langs->load("bills");
// Increase limit for PDF build
@ -218,6 +219,14 @@ function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hide
facture_delete_preview($db, $object->id);
$outputlangs->charset_output=$sav_charset_output;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('BILL_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return 1;
}
else

View File

@ -24,7 +24,7 @@
* \ingroup propale
* \brief Fichier contenant la classe mere de generation des propales en PDF
* et la classe mere de numerotation des propales
* \version $Id: modules_propale.php,v 1.61 2011/07/04 08:53:01 eldy Exp $
* \version $Id: modules_propale.php,v 1.62 2011/07/04 10:35:49 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
@ -143,7 +143,7 @@ class ModeleNumRefPropales
*/
function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$langs;
global $conf,$user,$langs;
$langs->load("propale");
$dir = "/includes/modules/propale/";
@ -197,6 +197,14 @@ function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0,
$outputlangs->charset_output=$sav_charset_output;
// on supprime l'image correspondant au preview
propale_delete_preview($db, $object->id);
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db);
$result=$interface->run_triggers('PROPAL_BUILDDOC',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
return 1;
}
else

View File

@ -28,7 +28,7 @@
* - Le nom de la classe doit etre InterfaceMytrigger
* - Le nom de la methode constructeur doit etre InterfaceMytrigger
* - Le nom de la propriete name doit etre Mytrigger
* \version $Id$
* \version $Id: interface_all_Demo.class.php-NORUN,v 1.26 2011/07/04 10:35:49 hregis Exp $
*/
@ -225,6 +225,10 @@ class InterfaceDemo
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -269,6 +273,10 @@ class InterfaceDemo
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -341,6 +349,10 @@ class InterfaceDemo
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);