diff --git a/htdocs/about.php b/htdocs/about.php index 88a7e085dce3eccecd4eed3e399122c74f965c8e..380a26ce4ba6ee0fa5918e3500bb9294f44ede13 100644 --- a/htdocs/about.php +++ b/htdocs/about.php @@ -39,6 +39,13 @@ print_fiche_titre("Dolibarr",'','setup'); print "<br>\n"; +print $langs->trans("Version").':'; +print '<ul>'; +print '<li>'.DOL_VERSION.'</li>'; +print '</ul>'; + +print "<br>\n"; + print $langs->trans("DolibarrLicense").':'; print '<ul>'; print '<li>GNU/GPL</li>'; @@ -108,7 +115,7 @@ if (eregi('^fr_',$langs->getDefaultLang())) print 'Vente / Support'; print '<ul>'; print '<li>'; - print 'Contactez Rodolphe Qui�deville sur <a target="blank" href="http://www.dolibarr.com/">www.dolibarr.com</a>'; + print 'Contactez Rodolphe Qui�deville sur <a target="blank" href="http://rodolphe.quiedeville.org">www.dolibarr.com</a>'; print '</li>'; print '</ul>'; } diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index 0855a6b0c3d89ad9e9fb26e8b71823f1690e2ea7..59d21409cff2252733461ad45fbe199e08b9897d 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -25,6 +25,7 @@ */ require("./pre.inc.php"); +include_once(DOL_DOCUMENT_ROOT ."/interfaces.class.php"); if (!$user->admin) accessforbidden(); @@ -61,7 +62,7 @@ function Activate($value) if ($modName) { $file = $modName . ".class.php"; - include_once("../includes/modules/$file"); + include_once("../includes/modules/".$file); $objMod = new $modName($db); $objMod->init(); } @@ -88,7 +89,7 @@ function UnActivate($value) if ($modName) { $file = $modName . ".class.php"; - include_once("../includes/modules/$file"); + include_once("../includes/modules/".$file); $objMod = new $modName($db); $objMod->remove(); } @@ -107,24 +108,26 @@ function UnActivate($value) llxHeader("",""); +$html = new Form($db); print_fiche_titre($langs->trans("TriggersAvailable"),'','setup'); +print "<br>\n"; print $langs->trans("TriggersDesc")."<br>"; print "<br>\n"; print "<table class=\"noborder\" width=\"100%\">\n"; print "<tr class=\"liste_titre\">\n"; print " <td colspan=\"2\">".$langs->trans("File")."</td>\n"; -print " <td>".$langs->trans("Description")."</td>\n"; +//print " <td>".$langs->trans("Description")."</td>\n"; print " <td align=\"center\">".$langs->trans("Version")."</td>\n"; -print " <td align=\"center\">".$langs->trans("Activated")."</td>\n"; -//print " <td align=\"center\">".$langs->trans("Action")."</td>\n"; +print " <td align=\"center\">".$langs->trans("Active")."</td>\n"; print " <td align=\"center\"> </td>\n"; print "</tr>\n"; - -$dir = DOL_DOCUMENT_ROOT . "/includes/triggers/"; +// Define dir directory +$interfaces=new Interfaces($db); +$dir = $interfaces->dir; $handle=opendir($dir); $files = array(); @@ -133,39 +136,38 @@ $orders = array(); $i = 0; while (($file = readdir($handle))!==false) { - if (is_readable($dir.$file) && ereg('^interface_(.*)\.class\.php',$file,$reg)) + if (is_readable($dir.'/'.$file) && ereg('^interface_([^_]+)_(.+)\.class\.php',$file,$reg)) { - $modName = 'Interface'.ucfirst($reg[1]); - if ($modName) - { - if (in_array($modName,$modules)) - { - $langs->load("errors"); - print '<div class="error">'.$langs->trans("Error").' : '.$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/").'</div>'; - $objMod = new $modName($db); - - $modules[$i] = $modName; - $files[$i] = $file; - $orders[$i] = "$objMod->family"; // Tri par famille - $i++; - } - else - { - include_once($dir.$file); - $objMod = new $modName($db); - - $modules[$i] = $modName; - $files[$i] = $file; - $orders[$i] = "$objMod->family"; // Tri par famille - $i++; - } - } + $modName = 'Interface'.ucfirst($reg[2]); + //print "file=$file"; print "modName=$modName"; exit; + if (in_array($modName,$modules)) + { + $langs->load("errors"); + print '<div class="error">'.$langs->trans("Error").' : '.$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/").'</div>'; + $objMod = new $modName($db); + + $modules[$i] = $modName; + $files[$i] = $file; + $orders[$i] = $objMod->family; // Tri par famille + $i++; + } + else + { + include_once($dir.'/'.$file); + $objMod = new $modName($db); + + $modules[$i] = $modName; + $files[$i] = $file; + $orders[$i] = $objMod->family; // Tri par famille + $i++; + } } } asort($orders); $var=True; +// Loop on each trigger foreach ($orders as $key => $value) { $tab=split('_',$value); @@ -180,46 +182,61 @@ foreach ($orders as $key => $value) $const_name = $objMod->const_name; $var=!$var; + + // Define disabledbyname and disabledbymodule + $disabledbyname=0; + $disabledbymodule=1; + $module=''; + if (eregi('NORUN$',$files[$key])) $disabledbyname=1; + if (eregi('^interface_([^_]+)_(.+)\.class\.php',$files[$key],$reg)) + { + // Check if trigger file is for a particular module + $module=eregi_replace('^mod','',$reg[1]); + $constparam='MAIN_MODULE_'.strtoupper($module); + if (strtolower($reg[1]) == 'all') $disabledbymodule=0; + else if (empty($conf->global->$constparam)) $disabledbymodule=2; + } + // Show line for trigger file print "<tr $bc[$var]>\n"; print '<td valign="top" width="14" align="center">'; print $objMod->picto?img_object('',$objMod->picto):img_object('','generic'); print '</td>'; print '<td valign="top">'.$files[$key]."</td>\n"; - print '<td valign="top">'.$objMod->getDesc()."</td>\n"; + //print '<td valign="top">'.$objMod->getDesc()."</td>\n"; print "<td valign=\"top\" align=\"center\">".$objMod->getVersion()."</td>\n"; - // \todo Activation trigger + // Etat trigger print "<td valign=\"top\" align=\"center\">"; - $statut_trigger=1; - if (eregi('NORUN$',$files[$key])) $statut_trigger=0; - - if ($statut_trigger == 1) + if ($disabledbyname > 0 || $disabledbymodule > 1) { - print img_tick(); + print " "; } else { - print " "; + print img_tick(); } - print "</td>\n"; -/* - print "<td valign=\"top\" align=\"center\">"; - if ($const_value == 1) - { - // Module actif - print "<a href=\"modules.php?id=".$objMod->numero."&action=reset&value=" . $modName . "&spe=" . $_GET["spe"] . "\">" . $langs->trans("Disable") . "</a></td>\n"; - } - else - { - // Module non actif - print "<a href=\"modules.php?id=".$objMod->numero."&action=set&value=" . $modName . "&spe=" . $_GET["spe"] . "\">" . $langs->trans("Activate") . "</a></td>\n"; - } -*/ - print "<td> </td>\n"; + print '<td valign="top">'; + $text ='<b>'.$langs->trans("Description").':</b><br>'; + $text.=$objMod->getDesc().'<br>'; + $text.='<br><b>'.$langs->trans("Status").':</b><br>'; + if ($disabledbyname == 1) + { + $text.=$langs->trans("TriggerDisabledByName").'<br>'; + if ($disabledbymodule == 2) $text.=$langs->trans("TriggerDisabledAsModuleDisabled",$module).'<br>'; + } + else + { + if ($disabledbymodule == 0) $text.=$langs->trans("TriggerAlwaysActive").'<br>'; + if ($disabledbymodule == 1) $text.=$langs->trans("TriggerActiveAsModuleActive",$module).'<br>'; + if ($disabledbymodule == 2) $text.=$langs->trans("TriggerDisabledAsModuleDisabled",$module).'<br>'; + } + print $html->textwithhelp('',$text); + print "</td>\n"; + print "</tr>\n"; } diff --git a/htdocs/includes/modules/modWebcalendar.class.php b/htdocs/includes/modules/modWebcalendar.class.php index 6fd9607f3decb988ae90c0300705ba0f58cf9aad..67debaf0104f30438092a26aa75a924fb9534f79 100644 --- a/htdocs/includes/modules/modWebcalendar.class.php +++ b/htdocs/includes/modules/modWebcalendar.class.php @@ -20,7 +20,7 @@ */ /** \defgroup webcalendar Module Webcalendar - \brief Module to include Webcalendar into Dolibarr and + \brief Module to include Webcalendar GUI into Dolibarr menu and add Dolibarr events directly inside a Webcalendar database. */ @@ -60,11 +60,11 @@ class modWebcalendar extends DolibarrModules $this->family = "projects"; // Module title used if translation string 'ModuleXXXName' not found (XXX is id value) $this->name = "Webcalendar"; - // Module descriptoin used translation string 'ModuleXXXDesc' not found (XXX is id value) + // Module description used if translation string 'ModuleXXXDesc' not found (XXX is id value) $this->description = "Interfa�age avec le calendrier Webcalendar"; - // Possible values for version are: 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version $this->version = 'dolibarr'; - // Id used in llx_const table to manage module status (enabled/disabled) + // Key used in llx_const table to save module status enabled/disabled (XXX is id value) $this->const_name = 'MAIN_MODULE_WEBCALENDAR'; // Where to store the module in setup page (0=common,1=interface,2=other) $this->special = 1; diff --git a/htdocs/includes/triggers/README b/htdocs/includes/triggers/README index 6e4a161516c2ccb15b158f49dc428e0cc42906c6..d06f4125d24245055cae257d027c430d0005cf58 100644 --- a/htdocs/includes/triggers/README +++ b/htdocs/includes/triggers/README @@ -1,8 +1,17 @@ +Directory content +-------------------------------------------------------- This directory contains all available Dolibarr triggers. -Name of some triggers ends with -NORUN. This means that they are not enabled and will -never be launched. -If you want to use them, just rename the file name removing the -NORUN part in their name. +Trigger file name syntax is: +> interface_modModule_mytrigger.php[-NORUN] + +where: +> modModule is part of module descriptor file name found in includes/modules + directory or value 'all' if not enabled by a particular module. +> Mytrigger is name of the trigger. The PHP class inside the trigger file + would be named InterfaceMytrigger. +> -NORUN is optionnal and disable completely a trigger file if set. To use + a trigger with such a name, rename file to remove the -NORUN part. $Id$ \ No newline at end of file diff --git a/htdocs/includes/triggers/README-FR b/htdocs/includes/triggers/README-FR index 19e0ecc158068efc1112bb4508bca5da25e12bb3..36b5cb7c5e5a4250bb39a5e3c6bd36b07f772736 100644 --- a/htdocs/includes/triggers/README-FR +++ b/htdocs/includes/triggers/README-FR @@ -1,9 +1,20 @@ -Ce r�pertoire contient tous les triggers Dolibarr disponibles. +Directory content +-------------------------------------------------------- +Ce r�pertoire contient tous les triggers Dolibarr. -Le nom de certain trigger se termine par -NORUN ce qui signigie que ceux-ci -ne seront pas actifs et ne se seront jamais �x�cut�s. -Si vous souhiatez les utiliser il suffit de rennommer ceux-ci en supprimant -la partie -NORUN de leur nom. +La syntaxe d'un fichier Trigger est: +> interface_modModule_mytrigger.php[-NORUN] + +where: +> modModule est la partie du nom du descripteur de module trouve dans le + repertoire includes/modules pour lequel le trigger doit etre. + actiff ou la valeure 'all' si ne doit pas etre actif pour un + module particulier. +> Mytrigger est le nom du trigger. La classe PHP dans le fichier trigger + aura pour nom InterfaceMytrigger. +> -NORUN est optionnel et desactive le fichier trigger si defini. Pour + utiliser un tel fichier trigger, renommer le fichier afin + d'enlever la partie -NORUN. $Id$ \ No newline at end of file diff --git a/htdocs/includes/triggers/interface_demo.class.php-NORUN b/htdocs/includes/triggers/interface_all_Demo.class.php similarity index 94% rename from htdocs/includes/triggers/interface_demo.class.php-NORUN rename to htdocs/includes/triggers/interface_all_Demo.class.php index dc30b6999b055736a4a0780d755695905026dcd4..c47cf3d4fcba81fb9dbd6ba92121eeda78c8bf0d 100644 --- a/htdocs/includes/triggers/interface_demo.class.php-NORUN +++ b/htdocs/includes/triggers/interface_all_Demo.class.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,17 +16,19 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** - \file htdocs/includes/triggers/interface_demo.class.php + \file htdocs/includes/triggers/interface_all_Demo.class.php \ingroup core \brief Fichier de demo de personalisation des actions du workflow \remarks Son propre fichier d'actions peut etre cr�� par recopie de celui-ci: - - Le nom du fichier doit etre interface_xxx.class.php + - Le nom du fichier doit etre: interface_modMymodule_Mytrigger.class.php + ou: interface_all_Mytrigger.class.php - Le fichier doit rester stock� dans includes/triggers - - Le nom de la classe doit etre InterfaceXxx + - 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 */ @@ -47,10 +49,10 @@ class InterfaceDemo { $this->db = $DB ; - $this->name = "Demo"; + $this->name = "Demo"; // Put here same value than in file and class name $this->family = "demo"; $this->description = "Les triggers de ce composant sont des fonctions vierges. Elles n'ont aucun effet. Ce composant est fourni � des fins de tutorial."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version } /** diff --git a/htdocs/includes/triggers/interface_ecotax.class.php-NORUN b/htdocs/includes/triggers/interface_modCommande_Ecotax.class.php-NORUN similarity index 95% rename from htdocs/includes/triggers/interface_ecotax.class.php-NORUN rename to htdocs/includes/triggers/interface_modCommande_Ecotax.class.php-NORUN index bc5749101bdf9f885ed4f88f999a7a5a7251facc..8ebfbad4bf5e87396687b20d86a992c86f761e8c 100644 --- a/htdocs/includes/triggers/interface_ecotax.class.php-NORUN +++ b/htdocs/includes/triggers/interface_modCommande_Ecotax.class.php-NORUN @@ -16,17 +16,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** - \file htdocs/includes/triggers/interface_ecotax.class.php + \file htdocs/includes/triggers/interface_modCommande_Ecotax.class.php \ingroup core - \brief Ecotax ajoute - \remarks Son propre fichier d'actions peut etre cr�� par recopie de celui-ci: - - Le nom du fichier doit etre interface_xxx.class.php - - Le fichier doit rester stock� dans includes/triggers - - Le nom de la classe doit etre InterfaceXxx + \brief Ajout Ecotax sur produit d'un certaine categorie */ diff --git a/htdocs/includes/triggers/interface_fraisport.class.php-NORUN b/htdocs/includes/triggers/interface_modCommande_Fraisport.class.php-NORUN similarity index 93% rename from htdocs/includes/triggers/interface_fraisport.class.php-NORUN rename to htdocs/includes/triggers/interface_modCommande_Fraisport.class.php-NORUN index d4929049e5a9e2f9e0b00b226bafe5bef533c547..253183afa62bd02ef3c592e45fde20c58081fd5f 100644 --- a/htdocs/includes/triggers/interface_fraisport.class.php-NORUN +++ b/htdocs/includes/triggers/interface_modCommande_Fraisport.class.php-NORUN @@ -16,22 +16,17 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** - \file htdocs/includes/triggers/interface_demo.class.php + \file htdocs/includes/triggers/interface_modCommande_fraisport.class.php \ingroup core - \brief Fichier de demo de personalisation des actions du workflow - \remarks Son propre fichier d'actions peut etre cr�� par recopie de celui-ci: - - Le nom du fichier doit etre interface_xxx.class.php - - Le fichier doit rester stock� dans includes/triggers - - Le nom de la classe doit etre InterfaceXxx + \brief Fichier trigger pour ajout frais port */ /** - \class InterfaceEditeur + \class InterfaceFraisport \brief Classe des fonctions triggers des actions personalis�es du workflow */ @@ -48,7 +43,7 @@ class InterfaceFraisport { $this->db = $DB ; - $this->name = "Frais de port"; + $this->name = "Fraisport"; $this->family = "facture"; $this->description = "Les triggers de ce composant calculent les frais de port."; $this->revision = explode(' ','$Revision$'); diff --git a/htdocs/includes/triggers/interface_editeur.class.php-NORUN b/htdocs/includes/triggers/interface_modEditeur_Editeur.class.php-NORUN similarity index 90% rename from htdocs/includes/triggers/interface_editeur.class.php-NORUN rename to htdocs/includes/triggers/interface_modEditeur_Editeur.class.php-NORUN index b254fbe9f7ff3a55e8dde6e95940110d084161b0..9313697174976b89dccd296671f02d8f2ca51394 100644 --- a/htdocs/includes/triggers/interface_editeur.class.php-NORUN +++ b/htdocs/includes/triggers/interface_modEditeur_Editeur.class.php-NORUN @@ -16,17 +16,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** - \file htdocs/includes/triggers/interface_demo.class.php + \file htdocs/includes/triggers/interface_modEditeur_editeur.class.php \ingroup core \brief Fichier de demo de personalisation des actions du workflow - \remarks Son propre fichier d'actions peut etre cr�� par recopie de celui-ci: - - Le nom du fichier doit etre interface_xxx.class.php - - Le fichier doit rester stock� dans includes/triggers - - Le nom de la classe doit etre InterfaceXxx */ @@ -50,7 +45,7 @@ class InterfaceEditeur $this->name = "Editeur"; $this->family = "editeur"; - $this->description = "Les triggers de ce composant s'appliquent sur les utilisateurs."; + $this->description = "Les triggers de ce composant tri les lignes commandes par stock_loc."; $this->revision = explode(' ','$Revision$'); $this->version = $this->revision[1]; } diff --git a/htdocs/includes/triggers/interface_ldap.class.php b/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php similarity index 97% rename from htdocs/includes/triggers/interface_ldap.class.php rename to htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php index 32d88b61399a4222c003265e687710a45342b2c9..89c8a82073857a325a7e8423c953355af97c9dfc 100644 --- a/htdocs/includes/triggers/interface_ldap.class.php +++ b/htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2005-2006 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,11 +16,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** - \file htdocs/includes/triggers/interface_ldap.class.php + \file htdocs/includes/triggers/interface_modLdap_Ldapsynchro.class.php \ingroup core \brief Fichier de gestion des triggers LDAP */ @@ -29,11 +28,11 @@ require_once (DOL_DOCUMENT_ROOT."/lib/ldap.class.php"); /** - \class InterfaceLdap + \class InterfaceLdapsynchro \brief Classe des fonctions triggers des actions de synchro LDAP */ -class InterfaceLdap +class InterfaceLdapsynchro { var $db; var $error; @@ -43,11 +42,11 @@ class InterfaceLdap * \brief Constructeur. * \param DB Handler d'acc�s base */ - function InterfaceLdap($DB) + function InterfaceLdapsynchro($DB) { $this->db = $DB ; - $this->name = "Ldap"; + $this->name = "Ldapsynchro"; $this->family = "ldap"; $this->description = "Les triggers de ce composant permettent d'effectuer les synchro de Dolibarr vers un annuaire LDAP."; $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version diff --git a/htdocs/includes/triggers/interface_notification.class.php b/htdocs/includes/triggers/interface_modNotification_Notification.class.php similarity index 94% rename from htdocs/includes/triggers/interface_notification.class.php rename to htdocs/includes/triggers/interface_modNotification_Notification.class.php index 7b2e70396cd26f0546fca011aa2ae56a20e81ec1..350baa5aab0861abb616284372968f2eab0e1cac 100644 --- a/htdocs/includes/triggers/interface_notification.class.php +++ b/htdocs/includes/triggers/interface_modNotification_Notification.class.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,11 +16,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** - \file htdocs/includes/triggers/interface_notification.class.php + \file htdocs/includes/triggers/interface_modNotification_notification.class.php \ingroup notification \brief Fichier de gestion des notifications sur evenement Dolibarr */ @@ -45,7 +44,7 @@ class InterfaceNotification $this->name = "Notification"; $this->family = "notification"; - $this->description = "Les triggers de ce composant sont les fonctions qui g�rent les notifications par mail du module Notification."; + $this->description = "Les triggers de ce composant envoie les notifications par mail selon configuration du module Notification."; $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version } diff --git a/htdocs/includes/triggers/interface_webcal.class.php b/htdocs/includes/triggers/interface_modWebcalendar_Webcalsynchro.class.php similarity index 96% rename from htdocs/includes/triggers/interface_webcal.class.php rename to htdocs/includes/triggers/interface_modWebcalendar_Webcalsynchro.class.php index cd1f984939931db89323334e7f4abeb28c314bb0..0d2f7a05fb98eb75dd22000b90d31e9a48738329 100644 --- a/htdocs/includes/triggers/interface_webcal.class.php +++ b/htdocs/includes/triggers/interface_modWebcalendar_Webcalsynchro.class.php @@ -16,28 +16,23 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** - \file htdocs/includes/triggers/interface_webcal.class.php + \file htdocs/includes/triggers/interface_modWebcalendar_webcalsynchro.class.php \ingroup webcalendar - \brief Fichier de demo de personalisation des actions du workflow - \remarks Son propre fichier d'actions peut etre cr�� par recopie de celui-ci: - - Le nom du fichier doit etre interface_xxx.class.php - - Le fichier doit rester stock� dans includes/triggers - - Le nom de la classe doit etre InterfaceXxx + \brief Fichier de gestion des triggers webcalendar */ include_once(DOL_DOCUMENT_ROOT.'/lib/webcal.class.php'); /** - \class InterfaceWebCal + \class InterfaceWebcalsynchro \brief Classe des fonctions triggers des actions webcalendar */ -class InterfaceWebCal +class InterfaceWebcalsynchro { var $db; var $error; @@ -51,11 +46,11 @@ class InterfaceWebCal * \brief Constructeur. * \param DB Handler d'acc�s base */ - function InterfaceWebCal($DB) + function InterfaceWebcalsynchro($DB) { $this->db = $DB ; - $this->name = "WebCal"; + $this->name = "Webcalsynchro"; $this->family = "webcal"; $this->description = "Les triggers de ce composant permettent d'ins�rer un �v�nement dans le calendrier webcalendar pour chaque grand �v�nement Dolibarr."; $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version diff --git a/htdocs/interfaces.class.php b/htdocs/interfaces.class.php index 742da60d8ffde78591b72598ddfc6299b3a134fd..2e507d7c914ef0ed88a9af702359aba8a1928e44 100644 --- a/htdocs/interfaces.class.php +++ b/htdocs/interfaces.class.php @@ -54,67 +54,86 @@ class Interfaces * \param user Objet user * \param lang Objet lang * \param conf Objet conf - * \return int Nb triggers d�clench�s si pas d'erreurs, -Nb en erreur sinon. + * \return int Nb triggers ayant agit si pas d'erreurs, -Nb en erreur sinon. */ function run_triggers($action,$object,$user,$lang,$conf) { - $handle=opendir($this->dir); $modules = array(); - $nbtotal = $nbok = $nbko = 0; + $nbfile = $nbtotal = $nbok = $nbko = 0; while (($file = readdir($handle))!==false) { - if (is_readable($this->dir."/".$file) && eregi('interface_(.*).class.php$',$file,$reg)) + if (is_readable($this->dir."/".$file) && eregi('^interface_([^_]+)_(.+)\.class\.php',$file,$reg)) { - $modName = "Interface".ucfirst($reg[1]); + $nbfile++; + + $modName = "Interface".ucfirst($reg[2]); //print "file=$file"; print "modName=$modName"; exit; - if ($modName) + if (in_array($modName,$modules)) + { + $langs->load("errors"); + dolibarr_syslog("Interface::run_triggers ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/"),LOG_ERR); + continue; + } + + // Check if trigger file is disabled by name + if (eregi('NORUN$',$file)) { - if (in_array($modName,$modules)) + continue; + } + // Check if trigger file is for a particular module + $qualified=true; + if (strtolower($reg[1]) != 'all') + { + $module=eregi_replace('^mod','',$reg[1]); + $constparam='MAIN_MODULE_'.strtoupper($module); + if (empty($conf->global->$constparam)) $qualified=false; + } + + if (! $qualified) + { + dolibarr_syslog("Interfaces::run_triggers Triggers for file '".$file."' need module to be enabled",LOG_INFO); + continue; + } + + include_once($this->dir."/".$file); + $objMod = new $modName($this->db); + if ($objMod) + { + $modules[$i] = $modName; + //dolibarr_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO); + $result=$objMod->run_trigger($action,$object,$user,$lang,$conf); + if ($result > 0) + { + // Action OK + $nbtotal++; + $nbok++; + } + if ($result == 0) { - $langs->load("errors"); - dolibarr_syslog($langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/"),LOG_ERR); + // Aucune action faite + $nbtotal++; } - else + if ($result < 0) { - include_once($this->dir."/".$file); - $objMod = new $modName($this->db); - if ($objMod) - { - $modules[$i] = $modName; - $result=$objMod->run_trigger($action,$object,$user,$lang,$conf); - if ($result > 0) - { - // Action OK - $nbtotal++; - $nbok++; - } - if ($result == 0) - { - // Aucune action faite - $nbtotal++; - } - if ($result < 0) - { - // Action KO - $nbtotal++; - $nbko++; - $this->errors[]=$objMod->error; - } - $i++; - } + // Action KO + $nbtotal++; + $nbko++; + $this->errors[]=$objMod->error; } + $i++; } } } if ($nbko) { - dolibarr_syslog("Interfaces::run_triggers Found: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko); + dolibarr_syslog("Interfaces::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR); return -$nbko; } else { + //dolibarr_syslog("Interfaces::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_DEBUG); return $nbok; } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index a81b98000f8cdabafbdfad43b46cfff96a8ed2e5..35a1d9b8109179142ea625c08be287ac82884763 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -48,6 +48,7 @@ MenuLimits=Limits and accuracy NotConfigured=Not configured Setup=Setup Activation=Activation +Active=Active SetupShort=Setup OtherOptions=Other options OtherSetup=Other setup @@ -480,6 +481,10 @@ CompanyFundationDesc=Edit on this page all known information of the company or f DisplayDesc=You can choose here all parameters related to the Dolibarr look and feel TriggersAvailable=Triggers available TriggersDesc=Triggers are files that, once copied into directory <b>htdocs/includes/triggers</b>, modify the behaviour of Dolibarr workflow. They realised new actions, activated on Dolibarr events (new company creation, invoice validation, ...). +TriggerDisabledByName=Triggers in this file are disabled by <b>-NORUN</b> suffix in name. +TriggerDisabledAsModuleDisabled=Triggers in this file are disabled as module <b>%s</b> is disabled. +TriggerAlwaysActive=Triggers in this file are always active, whatever are the activated Dolibarr modules. +TriggerActiveAsModuleActive=Triggers in this file are active as module <b>%s</b> is enabled. GeneratedPasswordDesc=Define here which rule you want to use to generate new password if you ask to have auto generated password DictionnaryDesc=Define here all reference datas. You can complete predefined value with yours ConstDesc=All other parameters not available in previous pages diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 5ad2fb021a0b8292b25d16fafad42949c24f28ec..b69ffc1a22500a3c778c593c4eafba771596482b 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -1,5 +1,5 @@ # Dolibarr language file - en_US - errors -ErrorDuplicateTrigger=A trigger file named '<b>%s</b>' is already loaded. Remove duplicate trigger file in directory '<b>%s</b>'. +ErrorDuplicateTrigger=A trigger file with class nam '<b>%s</b>' is present sevaral times. Remove duplicate trigger file in directory '<b>%s</b>'. ErrorFailToDeleteFile=Failed to remove file '<b>%s</b>'. ErrorThisContactIsAlreadyDefinedAsThisType=This contact is already defined as contact for this type. ErrorCashAccountAcceptsOnlyCashMoney=This bank account is a cash account, so it accepts payments of type cash only. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 69a1b32e4693102aa9f4e34144b6df2dff878bb4..8bc7de5fbceb29367f67d01856e5b09149f2e239 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -48,6 +48,7 @@ MenuLimits=Limites et pr NotConfigured=Non configur� Setup=Configuration Activation=Activation +Active=Actif SetupShort=Config OtherOptions=Autres options OtherSetup=Divers @@ -479,6 +480,10 @@ CompanyFundationDesc= DisplayDesc=Vous pouvez choisir ici tous les param�tres li�s � l'apparence de Dolibarr TriggersAvailable=Triggers disponibles TriggersDesc=Les triggers sont des fichiers qui, une fois d�pos�s dans le r�pertoire <b>htdocs/includes/triggers</b>, modifient le comportement du workflow de Dolibarr. Ils r�alisent des actions suppl�mentaires, d�clench�es par les �v�nements Dolibarr (cr�ation soci�t�, validation facture, cl�ture contrat...). +TriggerDisabledByName=Triggers de ce fichier d�sactiv�s par le suffix <b>-NORUN</b> dans le nom du fichier. +TriggerDisabledAsModuleDisabled=Triggers de ce fichier d�sactiv�s car le module <b>%s</b> n'est pas actif. +TriggerAlwaysActive=Triggers de ce fichier toujours actifs, quelque soient les modules Dolibarr activ�s. +TriggerActiveAsModuleActive=Triggers de ce fichier actifs car le module <b>%s</b> est actif. GeneratedPasswordDesc=Definissez ici quelle r�gle vous voulez utilisez pour g�n�rer les mots de passe quand vous demander � fabriquer un nouveau mot de passe DictionnaryDesc=Definissez ici les donn�es de r�f�rence. Vous pouvez compl�ter/modifier les donn�es pr�d�finies avec les votres ConstDesc=Tout autre parametre non editable dans les pages pr�c�dentes diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index ece093961455872f9a44b7e20f1fb224b84d4503..b67a0004778934dc80e1b0235e1d3edce565d25b 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -1,5 +1,5 @@ # Dolibarr language file - fr_FR - errors -ErrorDuplicateTrigger=Un fichier trigger du nom de '<b>%s</b>' est deja charg�. Supprimer le doublon du r�pertoire '<b>%s</b>'. +ErrorDuplicateTrigger=Un fichier trigger de classe '<b>%s</b>' est present plusieurs fois. Supprimer le doublon du r�pertoire '<b>%s</b>'. ErrorFailToDeleteFile=Echec de l'effacement du fichier '<b>%s</b>'. ErrorThisContactIsAlreadyDefinedAsThisType=Ce contact est d�j� d�fini comme contact pour ce type. ErrorCashAccountAcceptsOnlyCashMoney=Ce compte bancaire est de type caisse et n'accepte que les mode de r�glement de type <b>esp�ce</b>.