From d1358b1d2ccf9f856c118eceb29a73c74335f5e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 5 Aug 2006 16:44:43 +0000 Subject: [PATCH] =?UTF-8?q?R=E9ecriture=20gestion=20des=20notifications=20?= =?UTF-8?q?pour=20=EAtre=20g=E9r=E9es=20par=20un=20module=20ind=E9pendant?= =?UTF-8?q?=20et=20via=20le=20m=E9canisme=20des=20triggers.=20Ceci=20afin?= =?UTF-8?q?=20de=20simplifier=20le=20code=20et=20de=20permettre=20le=20not?= =?UTF-8?q?ifications=20sur=20n'importe=20quel=20=E9vennement=20Dolibarr.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/societe.php | 29 ++-- htdocs/comm/multiprix.php | 87 +++--------- htdocs/compta/facture.php | 17 ++- htdocs/compta/paiement/liste.php | 3 +- htdocs/conf/conf.class.php | 16 ++- htdocs/contact.class.php | 27 +++- htdocs/facture.class.php | 73 ++++------ htdocs/fichinter/fichinter.class.php | 58 +++----- .../includes/modules/modBookmark4u.class.php | 8 +- .../includes/modules/modClickToDial.class.php | 3 +- .../includes/modules/modOSCommerce2.class.php | 2 +- .../triggers/interface_demo.class.php | 17 +++ .../triggers/interface_notification.class.php | 132 ++++++++++++++++++ htdocs/langs/en_US/admin.lang | 5 + htdocs/langs/en_US/mails.lang | 8 +- htdocs/langs/fr_FR/admin.lang | 5 + htdocs/langs/fr_FR/mails.lang | 8 +- htdocs/lib/company.lib.php | 16 +-- htdocs/notify.class.php | 84 +++++++++-- htdocs/societe/notify/fiche.php | 39 +++++- htdocs/societe/notify/index.php | 95 +++++++------ htdocs/societe/notify/pre.inc.php | 53 +++---- htdocs/societe/pre.inc.php | 42 +++--- mysql/data/data.sql | 12 +- mysql/migration/2.0.0-2.1.0.sql | 3 + pgsql/data/data.sql | 12 +- 26 files changed, 532 insertions(+), 322 deletions(-) create mode 100644 htdocs/includes/triggers/interface_notification.class.php diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php index 3a4b45231ae..5d1367b1fb7 100644 --- a/htdocs/admin/societe.php +++ b/htdocs/admin/societe.php @@ -65,19 +65,6 @@ if ($_GET["action"] == 'setcodecompta') } } -if ($_POST["action"] == 'setdisablenotifications') -{ - if (dolibarr_set_const($db, "SOCIETE_DISABLE_NOTIFICATIONS",! $_POST["constvalue"])) - { - Header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dolibarr_print_error($db); - } -} - /* * Affichage page configuration module societe @@ -213,8 +200,8 @@ print "\n"; print '
'; -// Choix du module de gestion des codes compta - +// Autres options +/* print_titre($langs->trans("OtherOptions")); $var=true; @@ -228,16 +215,16 @@ print ' '; print "\n"; print '
'; -print ''; -print ''; +print ''; +print ''; $var=!$var; print ''; -print ''.$langs->trans("UseNotifications")."\n"; +print ''.$langs->trans("UseXXX")."\n"; print ''; -$form->selectyesnonum('constvalue',! $conf->global->SOCIETE_DISABLE_NOTIFICATIONS); +$form->selectyesnonum('constvalue',! $conf->global->XXX); print ''; -print ''.$langs->trans("NotificationsDesc").''; +print ''.$langs->trans("XXXDesc").''; print ''; print '   '; print ''; @@ -246,7 +233,7 @@ print "\n"; print '
'; print "\n"; - +*/ $db->close(); diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 8848eb6a1d8..d54cc92a9e1 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -69,82 +69,27 @@ if ($user->societe_id > 0) *********************************************************************************/ if ($_socid > 0) { - // On recupere les donnees societes par l'objet - $objsoc = new Societe($db); - $objsoc->id=$_socid; - $objsoc->fetch($_socid,$to); - - $dac = strftime("%Y-%m-%d %H:%M", time()); - if ($errmesg) - { - print '
'.$errmesg.'

'; - } - - /* - * Affichage onglets - */ - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Company"); - $h++; - - if ($objsoc->client==1) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; - } - if ($objsoc->client==2) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->socid; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($objsoc->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - - if ($conf->compta->enabled || $conf->comptaexpert->enabled) - { - $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Accountancy"); - $h++; - } + // On recupere les donnees societes par l'objet + $objsoc = new Societe($db); + $objsoc->id=$_socid; + $objsoc->fetch($_socid,$to); + + $dac = strftime("%Y-%m-%d %H:%M", time()); + if ($errmesg) + { + print '
'.$errmesg.'

'; + } + - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Note"); - $h++; + /* + * Affichage onglets + */ - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; - } + $head = societe_prepare_head($objsoc); - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT."/comm/index.php?socidp=$objsoc->id&action=add_bookmark"; - $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); - $head[$h][2] = 'image'; - } + dolibarr_fiche_head($head, 'notify', $objsoc->nom); - dolibarr_fiche_head($head, $hselected, $objsoc->nom); - /* - * - * - */ print '
'; print ''; print ''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index e94cfa6b4f5..ccd4c136f75 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1422,7 +1422,8 @@ else */ if ($_GET['action'] == 'delete') { - $html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('DeleteBill'),$langs->trans('ConfirmDeleteBill'),'confirm_delete'); + $text=$langs->trans('ConfirmDeleteBill'); + $html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$fac->id,$langs->trans('DeleteBill'),$text,'confirm_delete'); print '
'; } @@ -1433,7 +1434,7 @@ else { // on vérifie si la facture est en numérotation provisoire $facref = substr($fac->ref, 1, 4); - if ($facref == PROV) + if ($facref == 'PROV') { $numfa = $fac->getNextNumRef($soc); } @@ -1441,7 +1442,17 @@ else { $numfa = $fac->ref; } - $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$langs->trans('ConfirmValidateBill',$numfa),'confirm_valid'); + + $text=$langs->trans('ConfirmValidateBill',$numfa); + if ($conf->notification->enabled) + { + require_once(DOL_DOCUMENT_ROOT ."/notify.class.php"); + $notify=new Notify($db); + $text.='
'; + $text.=$notify->confirmMessage(2,$fac->socidp); + } + + $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$text,'confirm_valid'); print '
'; } diff --git a/htdocs/compta/paiement/liste.php b/htdocs/compta/paiement/liste.php index ae647646f6b..9f1ffea7a24 100644 --- a/htdocs/compta/paiement/liste.php +++ b/htdocs/compta/paiement/liste.php @@ -105,7 +105,6 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; - $var=True; $paramlist=($_GET["orphelins"]?"&orphelins=1":""); print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, "liste.php",$paramlist,$sortfield,$sortorder,'',$num); @@ -135,7 +134,7 @@ if ($resql) print "\n"; print ''; - + $var=true; while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php index 019937d5bed..f6677d85a6c 100644 --- a/htdocs/conf/conf.class.php +++ b/htdocs/conf/conf.class.php @@ -134,12 +134,19 @@ class Conf // Module bookmark4u $this->bookmark4u->enabled=defined('MAIN_MODULE_BOOKMARK4U')?MAIN_MODULE_BOOKMARK4U:0; $this->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0; + // Module deplacement $this->deplacement->enabled=defined("MAIN_MODULE_DEPLACEMENT")?MAIN_MODULE_DEPLACEMENT:0; + // Module mailing $this->mailing->enabled=defined("MAIN_MODULE_MAILING")?MAIN_MODULE_MAILING:0; + + // Module notification + $this->notification->enabled=defined("MAIN_MODULE_NOTIFICATION")?MAIN_MODULE_NOTIFICATION:0; + // Module externalrss $this->externalrss->enabled=defined("MAIN_MODULE_EXTERNALRSS")?MAIN_MODULE_EXTERNALRSS:0; + // Module commande client $this->commande->enabled=defined("MAIN_MODULE_COMMANDE")?MAIN_MODULE_COMMANDE:0; $this->commande->dir_output=DOL_DATA_ROOT."/commande"; @@ -340,12 +347,13 @@ class Conf $this->css = "theme/".$this->theme."/".$this->theme.".css"; // $this->email_from = email pour envoi par Dolibarr des mails auto (notifications, ...) - // $this->mailing->email_from = email pour envoi par Dolibarr des mailings - $this->email_from="dolibarr-robot@domain.com"; - if (defined('MAIN_EMAIL_FROM')) + $this->notification->email_from="dolibarr-robot@domain.com"; + if (defined('NOTIFICATION_EMAIL_FROM')) { - $this->email_from=MAIN_EMAIL_FROM; + $this->notification->email_from=NOTIFICATION_EMAIL_FROM; } + + // $this->mailing->email_from = email pour envoi par Dolibarr des mailings if (defined('MAILING_EMAIL_FROM')) { $this->mailing->email_from=MAILING_EMAIL_FROM; diff --git a/htdocs/contact.class.php b/htdocs/contact.class.php index a7154f5089f..61c8eb2b2b4 100644 --- a/htdocs/contact.class.php +++ b/htdocs/contact.class.php @@ -748,6 +748,31 @@ class Contact return -1; } } - + + /** + * \brief Renvoie nom clicable (avec eventuellement le picto) + * \param withpicto Inclut le picto dans le lien + * \param option Sur quoi pointe le lien + * \return string Chaine avec URL + */ + function getNomUrl($withpicto=0,$option='') + { + global $langs; + + $result=''; + + $lien = ''; + $lienfin=''; + + if ($option == 'xxx') + { + $lien = ''; + $lienfin=''; + } + + if ($withpicto) $result.=($lien.img_object($langs->trans("ShowContact"),'contact').$lienfin.' '); + $result.=$lien.$this->name.' '.$this->firstname.$lienfin; + return $result; + } } ?> diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 9de41fe2957..3c5516d84fc 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -32,7 +32,6 @@ */ require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php"); -require_once(DOL_DOCUMENT_ROOT .'/notify.class.php'); require_once(DOL_DOCUMENT_ROOT ."/product.class.php"); require_once(DOL_DOCUMENT_ROOT ."/client.class.php"); @@ -837,12 +836,11 @@ class Facture extends CommonObject // on vérifie si la facture est en numérotation provisoire $facref = substr($this->ref, 1, 4); - $action_notify = 2; // ne pas modifier cette valeur if ($force_number) { $numfa = $force_number; } - else if ($facref == PROV) + else if ($facref == 'PROV') { $numfa = $this->getNextNumRef($soc); } @@ -880,7 +878,7 @@ class Facture extends CommonObject // On vérifie si la facture était une provisoire - if ($facref == PROV) + if ($facref == 'PROV') { // On renomme repertoire facture ($this->ref = ancienne ref, $numfa = nouvelle ref) // afin de ne pas perdre les fichiers attachés @@ -947,35 +945,35 @@ class Facture extends CommonObject } */ - // On vérifie si la facture était une provisoire - if ($facref == PROV) + // On vérifie si la facture était une provisoire + if ($facref == 'PROV') { - /* - * Pour chaque produit, on met a jour indicateur nbvente - * On crée ici une dénormalisation des données pas forcément utilisée. - */ - $sql = 'SELECT fk_product FROM '.MAIN_DB_PREFIX.'facturedet'; - $sql.= ' WHERE fk_facture = '.$this->id; - $sql.= ' AND fk_product > 0'; - - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - $sql = 'UPDATE '.MAIN_DB_PREFIX.'product SET nbvente=nbvente+1 WHERE rowid = '.$obj->fk_product; - $resql2 = $this->db->query($sql); - $i++; - } - } - else - { - $error++; - } - } + /* + * Pour chaque produit, on met a jour indicateur nbvente + * On crée ici une dénormalisation des données pas forcément utilisée. + */ + $sql = 'SELECT fk_product FROM '.MAIN_DB_PREFIX.'facturedet'; + $sql.= ' WHERE fk_facture = '.$this->id; + $sql.= ' AND fk_product > 0'; + + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + $sql = 'UPDATE '.MAIN_DB_PREFIX.'product SET nbvente=nbvente+1 WHERE rowid = '.$obj->fk_product; + $resql2 = $this->db->query($sql); + $i++; + } + } + else + { + $error++; + } + } if ($error == 0) { @@ -989,17 +987,6 @@ class Facture extends CommonObject $result=$interface->run_triggers('BILL_VALIDATE',$this,$user,$langs,$conf); // Fin appel triggers - /* - * Notify - * \todo Mettre notifications dans triggers - */ - $facref = sanitize_string($this->ref); - $filepdf = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf'; - $mesg = 'La facture '.$this->ref." a été validée.\n"; - - $notify = New Notify($this->db); - $notify->send($action_notify, $this->socidp, $mesg, 'facture', $rowid, $filepdf); - $this->db->commit(); return 1; diff --git a/htdocs/fichinter/fichinter.class.php b/htdocs/fichinter/fichinter.class.php index 53095b26581..97d14e639ca 100644 --- a/htdocs/fichinter/fichinter.class.php +++ b/htdocs/fichinter/fichinter.class.php @@ -27,7 +27,6 @@ */ require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php"); -require_once(DOL_DOCUMENT_ROOT ."/notify.class.php"); /** \class Ficheinter @@ -227,57 +226,32 @@ class Fichinter extends CommonObject } } - /* - * - * + /** + * \brief Valide une fiche intervention + * \param user User qui valide + * \return int <0 si ko, >0 si ok */ - function valid($userid, $outputdir) + function valid($user, $outputdir) { - $action_notify = 1; // ne pas modifier cette valeur - - $this->fetch($this->id); - - $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter SET fk_statut = 1, date_valid=now(), fk_user_valid=$userid"; - $sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;"; - - if ($this->db->query($sql) ) + $sql = "UPDATE ".MAIN_DB_PREFIX."fichinter"; + $sql.= " SET fk_statut = 1, date_valid=now(), fk_user_valid=".$user->id; + $sql.= " WHERE rowid = ".$this->id." AND fk_statut = 0"; + $resql=$this->db->query($sql); + if ($resql) { - /* - * Set generates files readonly - */ - umask(0); - $file = $outputdir . "/$this->ref/$this->ref.tex"; - if (is_writeable($file)) - { - chmod($file, 0444); - } - $file = $outputdir . "/$this->ref/$this->ref.ps"; - if (is_writeable($file)) - { - chmod($file, 0444); - } - $filepdf = $conf->fichinter->dir_output . "/$this->ref/$this->ref.pdf"; - if (is_writeable($filepdf)) - { - chmod($filepdf, 0444); - } - - /* - * Notify - */ - $mesg = "La fiche d'intervention ".$this->ref." a été validée.\n"; - - $notify = New Notify($this->db); - $notify->send($action_notify, $this->societe_id, $mesg, "ficheinter", $this->id, $filepdf); + // Appel des triggers + include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('FICHEINTER_VALIDATE',$this,$user,$langs,$conf); + // Fin appel triggers return 1; } else { - print $this->db->error() . ' in ' . $sql; + $this->error=$this->db->error().' sql='.$sql; return -1; } - } /** diff --git a/htdocs/includes/modules/modBookmark4u.class.php b/htdocs/includes/modules/modBookmark4u.class.php index 2b9ab8b9fa0..cd372506eae 100644 --- a/htdocs/includes/modules/modBookmark4u.class.php +++ b/htdocs/includes/modules/modBookmark4u.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005 Laurent Destailleur +/* Copyright (C) 2005 Rodolphe Quiedeville + * Copyright (C) 2005-2006 Laurent Destailleur * * 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 @@ -54,7 +54,9 @@ class modBookmark4u extends DolibarrModules $this->family = "technic"; $this->name = "Bookmark4u"; $this->description = "Ajoute fonction pour générer un compte Bookmark4u depuis un compte Dolibarr"; - $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version + + $this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version + $this->const_name = 'MAIN_MODULE_BOOKMARK4U'; $this->special = 1; $this->picto='user'; diff --git a/htdocs/includes/modules/modClickToDial.class.php b/htdocs/includes/modules/modClickToDial.class.php index fac661cc80d..7d5b23845d5 100644 --- a/htdocs/includes/modules/modClickToDial.class.php +++ b/htdocs/includes/modules/modClickToDial.class.php @@ -55,8 +55,7 @@ class modClickToDial extends DolibarrModules $this->name = "ClickToDial"; $this->description = "Gestion du Click To Dial"; - $this->revision = explode(' ','$Revision$'); - $this->version = $this->revision[1]; + $this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_CLICKTODIAL'; $this->special = 1; diff --git a/htdocs/includes/modules/modOSCommerce2.class.php b/htdocs/includes/modules/modOSCommerce2.class.php index e5e75e87f31..e723eb9b6a1 100644 --- a/htdocs/includes/modules/modOSCommerce2.class.php +++ b/htdocs/includes/modules/modOSCommerce2.class.php @@ -55,7 +55,7 @@ class modOSCOmmerce2 extends DolibarrModules $this->family = "products"; $this->name = "OSCommerce 2"; $this->description = "Interface de visualisation d'une boutique OSCommerce via des Web services.\nCe module requiert d'installer les composants dans /oscommerce_ws/ws_server sur OSCommerce. Voir fichier README dans /oscommerce_ws/ws_server"; - $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version + $this->version = 'experimental'; // 'development' or 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_OSCOMMERCEWS'; $this->special = 1; diff --git a/htdocs/includes/triggers/interface_demo.class.php b/htdocs/includes/triggers/interface_demo.class.php index 1287a90f4ed..427b42e97ab 100644 --- a/htdocs/includes/triggers/interface_demo.class.php +++ b/htdocs/includes/triggers/interface_demo.class.php @@ -118,6 +118,7 @@ class InterfaceDemo { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); } + // Companies elseif ($action == 'COMPANY_CREATE') { @@ -131,6 +132,7 @@ class InterfaceDemo { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); } + // Products elseif ($action == 'PRODUCT_CREATE') { @@ -144,6 +146,7 @@ class InterfaceDemo { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); } + // Customer orders elseif ($action == 'ORDER_CREATE') { @@ -157,6 +160,7 @@ class InterfaceDemo { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); } + // Supplier orders elseif ($action == 'ORDER_SUPPLIER_CREATE') { @@ -166,6 +170,7 @@ class InterfaceDemo { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); } + // Proposals elseif ($action == 'PROPAL_CREATE') { @@ -187,6 +192,7 @@ class InterfaceDemo { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); } + // Contracts elseif ($action == 'CONTRACT_CREATE') { @@ -212,6 +218,7 @@ class InterfaceDemo { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); } + // Bills elseif ($action == 'BILL_CREATE') { @@ -233,6 +240,7 @@ class InterfaceDemo { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); } + // Payments elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { @@ -242,6 +250,13 @@ class InterfaceDemo { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); } + + // Interventions + elseif ($action == 'FICHEINTER_VALIDATE') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); + } + // Members elseif ($action == 'MEMBER_CREATE') { @@ -267,6 +282,8 @@ class InterfaceDemo { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); } + + // If not found else { dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran but no handler found for this action."); diff --git a/htdocs/includes/triggers/interface_notification.class.php b/htdocs/includes/triggers/interface_notification.class.php new file mode 100644 index 00000000000..02a60074036 --- /dev/null +++ b/htdocs/includes/triggers/interface_notification.class.php @@ -0,0 +1,132 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/includes/triggers/interface_notification.class.php + \ingroup notification + \brief Fichier de gestion des notifications sur evenement Dolibarr +*/ + + +/** + \class InterfaceNotification + \brief Classe des fonctions triggers des actions personalisées du workflow +*/ + +class InterfaceNotification +{ + var $db; + + /** + * \brief Constructeur. + * \param DB Handler d'accès base + */ + function InterfaceNotification($DB) + { + $this->db = $DB ; + + $this->name = "Notification"; + $this->family = "notification"; + $this->description = "Les triggers de ce composant sont les fonctions qui gèrent les notifications du module Notification"; + $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + } + + /** + * \brief Renvoi nom du lot de triggers + * \return string Nom du lot de triggers + */ + function getName() + { + return $this->name; + } + + /** + * \brief Renvoi descriptif du lot de triggers + * \return string Descriptif du lot de triggers + */ + function getDesc() + { + return $this->description; + } + + /** + * \brief Renvoi version du lot de triggers + * \return string Version du lot de triggers + */ + function getVersion() + { + global $langs; + $langs->load("admin"); + + if ($this->version == 'experimental') return $langs->trans("Experimental"); + elseif ($this->version == 'dolibarr') return DOL_VERSION; + elseif ($this->version) return $this->version; + else return $langs->trans("Unknown"); + } + + /** + * \brief Fonction appelée lors du déclenchement d'un évènement Dolibarr. + * D'autres fonctions run_trigger peuvent etre présentes dans includes/triggers + * \param action Code de l'evenement + * \param object Objet concerné + * \param user Objet user + * \param lang Objet lang + * \param conf Objet conf + * \return int <0 si ko, 0 si aucune action faite, >0 si ok + */ + function run_trigger($action,$object,$user,$langs,$conf) + { + // Si module notification non actif, on ne fait rien + if (! $conf->notification->enabled) return 0; + + require_once(DOL_DOCUMENT_ROOT .'/notify.class.php'); + + if ($action == 'BILL_VALIDATE') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); + + $action_notify = 2; + $ref = sanitize_string($object->ref); + $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; + $mesg = 'La facture '.$object->ref." a été validée.\n"; + + $notify = new Notify($this->db); + $notify->send($action_notify, $object->socidp, $mesg, 'facture', $object->id, $filepdf); + } + + if ($action == 'FICHEINTER_VALIDATE') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); + + $action_notify = 1; + $ref = sanitize_string($object->ref); + $filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf'; + $mesg = 'La fiche intervention '.$object->ref." a été validée.\n"; + + $notify = new Notify($this->db); + $notify->send($action_notify, $object->socidp, $mesg, 'ficheinter', $object->id, $filepdf); + } + + return 0; + } + +} +?> diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d3068002d51..6823bc34846 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -137,6 +137,8 @@ Module410Name=Webcalendar Module410Desc=Webcalendar integration Module500Name=Taxes and social contributions Module500Desc=Taxes and social contributions' management +Module600Name=Notification +Module600Desc=Send notifications (by email) on Dolibarr business events Module700Name=Donations Module700Desc=Donations' management Module800Name=OSCommerce 1 @@ -525,6 +527,9 @@ NewRSS=New RSS ##### Mailing ##### MailingSetup=Mailing module setup MailingEMailFrom=Sender EMail (From) for emails sent by emailing module +##### Notification ##### +NotificationSetup=Mailing module setup +NotificationEMailFrom=Sender EMail (From) for emails sent for notifications ##### Sendings ##### SendingsSetup=Sending module setup SendingsReceiptModel=Sending receipt model diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index ff5a1825421..84ad30f8123 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -73,4 +73,10 @@ ToClearAllRecipientsClickHere=To clear recipients' list for this emailing, click ToAddRecipientsChooseHere=To add recipients, choose in those lists NbOfEMailingsReceived=Mass emailings received IdRecord=ID record -DeliveryReceipt=Delivery Receipt \ No newline at end of file +DeliveryReceipt=Delivery Receipt + +# Module Notifications +Notifications=Notifications +NoNotificationsWillBeSent=No email notifications are planned for this event and company +ANotificationsWillBeSent=1 notification will be sent by email +SomeNotificationsWillBeSent=%s notifications will be sent by email \ No newline at end of file diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 9196873754c..8962a018244 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -137,6 +137,8 @@ Module410Name=Webcalendar Module410Desc=Interface avec le calendrier Webcalendar Module500Name=Taxes et charges sociales Module500Desc=Gestion des taxes et charges sociales +Module600Name=Notification +Module600Desc=Envoi de notifications (par mail) sur les évênements métiers Dolibarr Module700Name=Dons Module700Desc=Gestion des dons Module800Name=OSCommerce 1 @@ -525,6 +527,9 @@ NewRSS=Syndication d'un nouveau flux RSS ##### Mailing ##### MailingSetup=Configuration du module EMailing MailingEMailFrom=Email emetteur (From) des mails envoyés par EMailing +##### Notification ##### +NotificationSetup=Configuration du module Notification +NotificationEMailFrom=Email emetteur (From) des mails envoyés lors des notifications ##### Sendings ##### SendingsSetup=Configuration du module Expéditions/Livraisons SendingsReceiptModel=Modèle du bordereau d'expédition diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index aee0087a4fa..19287f6049f 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -73,4 +73,10 @@ ToClearAllRecipientsClickHere=Pour effacer la liste des destinataires de ce mail ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les listes ci-dessous NbOfEMailingsReceived=Mailings de masse reçus IdRecord=ID enregistrement -DeliveryReceipt=Accusé de réception \ No newline at end of file +DeliveryReceipt=Accusé de réception + +# Module Notifications +Notifications=Notifications +NoNotificationsWillBeSent=Aucune notification par email n'est prévue pour cet évenement et société +ANotificationsWillBeSent=1 notification va être envoyée par mail +SomeNotificationsWillBeSent=%s notifications vont être envoyées par mail \ No newline at end of file diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index d340a00b33f..0b639c4ccd9 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -87,7 +87,7 @@ function societe_prepare_head($objsoc) $h++; } - if (! $conf->global->SOCIETE_DISABLE_NOTIFICATIONS && $user->societe_id == 0) + if ($conf->notification->enabled && $user->societe_id == 0) { $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; $head[$h][1] = $langs->trans("Notifications"); @@ -95,13 +95,13 @@ function societe_prepare_head($objsoc) $h++; } - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; - $h++; - } + if ($user->societe_id == 0) + { + $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + } if ($conf->bookmark->enabled && $user->rights->bookmark->creer) { diff --git a/htdocs/notify.class.php b/htdocs/notify.class.php index 06e73e94035..894e4c3b993 100644 --- a/htdocs/notify.class.php +++ b/htdocs/notify.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * * 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 @@ -25,6 +25,7 @@ \brief Fichier de la classe de gestion des notifications \version $Revision$ */ +require_once(DOL_DOCUMENT_ROOT ."/lib/CMailFile.class.php"); /** @@ -45,7 +46,10 @@ class Notify var $note; var $projet_id; - + // Les codes actions sont définis dans la table llx_notify_def + // \todo utiliser des codes texte plutot que numérique + // 1 = Validation fiche inter + // 2 = Validation facture /** * \brief Constructeur @@ -54,13 +58,59 @@ class Notify function Notify($DB) { $this->db = $DB ; - include_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); } /** - * \brief Envoi mail et sauve trace - * + * \brief Renvoie le message signalant les notifications qui auront lieu sur + * un evenement pour affichage dans texte de confirmation evenement. + * \return string Message + */ + function confirmMessage($action,$socid) + { + global $langs; + $langs->load("mails"); + + $nb=$this->countDefinedNotifications($action,$socid); + if ($nb <= 0) $texte=$langs->trans("NoNotificationsWillBeSent"); + if ($nb == 1) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("ANotificationsWillBeSent"); + if ($nb >= 2) $texte=img_object($langs->trans("Notifications"),'email').' '.$langs->trans("SomeNotificationsWillBeSent",$nb); + return $texte; + } + + /** + * \brief Renvoie le nombre de notifications configurés pour l'action et la société donnée + * \return int <0 si ko, sinon nombre de notifications définies + */ + function countDefinedNotifications($action,$socid) + { + $num=-1; + + $sql = "SELECT s.nom, c.email, c.idp, c.name, c.firstname, a.titre,n.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s"; + $sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action"; + $sql .= " AND n.fk_soc = s.idp AND n.fk_action = ".$action; + $sql .= " AND s.idp = ".$socid; + + dolibarr_syslog("Notify.class::countDefinedNotifications $action, $socid"); + + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + } + else + { + $this->error=$this->db->error.' sql='.$sql; + return -1; + } + + return $num; + } + + /** + * \brief Vérifie si notification actice. Si oui, envoi mail et sauve trace + * \return int <0 si ko, sinon nombre de notifications faites */ function send($action, $socid, $texte, $objet_type, $objet_id, $file="") { @@ -72,6 +122,8 @@ class Notify $sql .= " AND n.fk_soc = s.idp AND n.fk_action = ".$action; $sql .= " AND s.idp = ".$socid; + dolibarr_syslog("Notify.class::send $action, $socid, $texte, $objet_type, $objet_id, $file"); + $result = $this->db->query($sql); if ($result) { @@ -85,19 +137,20 @@ class Notify if (strlen($sendto)) { - $subject = $langs->trans("DolibarrNotififcation"); + $subject = $langs->trans("DolibarrNotification"); $message = $texte; $filename = split("/",$file); - $replyto = $conf->email_from; + + $replyto = $conf->notification->email_from; $mailfile = new CMailFile($subject, - $sendto, - $replyto, - $message, - array($file), - array("application/pdf"), - array($filename[sizeof($filename)-1]) - ); + $sendto, + $replyto, + $message, + array($file), + array("application/pdf"), + array($filename[sizeof($filename)-1]) + ); if ( $mailfile->sendfile() ) { @@ -109,7 +162,6 @@ class Notify { dolibarr_print_error($db); } - } else { @@ -118,10 +170,12 @@ class Notify } $i++; } + return $i; } else { $this->error=$this->db->error(); + return -1; } } diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index a4748fa1220..862e29bc8ed 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -22,13 +22,14 @@ /** \file htdocs/societe/notify/fiche.php - \ingroup societe + \ingroup societe, notification \brief Onglet notifications pour une societe \version $Revision$ */ require("pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); $langs->load("companies"); @@ -151,11 +152,16 @@ if ( $soc->fetch($soc->id) ) print "\n"; + + print_fiche_titre($langs->trans("AddNewNotification")); + + print '
'; + // Ligne de titres print '
'; print ''; - print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name","","&socid=$socid",'',$sortfield); - print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre","","&socid=$socid",'',$sortfield); + print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',"&socid=$socid",'"width="45%"',$sortfield); + print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',"&socid=$socid",'"width="45%"',$sortfield); print ''; print ''; @@ -184,7 +190,6 @@ if ( $soc->fetch($soc->id) ) } $var=false; - print ''; print ''; print ''; print ''; print ''; + print '
 
'; $html->select_array("contactid",$soc->contact_email_array()); @@ -194,11 +199,25 @@ if ( $soc->fetch($soc->id) ) print '
'; + print ''; - + print '
'; + + + print_fiche_titre($langs->trans("ListOfActiveNotifications")); + $var=true; + + // Ligne de titres + print ''; + print ''; + print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name",'',"&socid=$socid",'"width="45%"',$sortfield); + print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre",'',"&socid=$socid",'"width="45%"',$sortfield); + print ''; + print ''; // Liste - $sql = "SELECT c.name, c.firstname, a.titre,n.rowid"; + $sql = "SELECT c.idp as id, c.name, c.firstname, a.titre, n.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n"; $sql.= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action AND n.fk_soc = ".$soc->id; @@ -207,13 +226,19 @@ if ( $soc->fetch($soc->id) ) { $num = $db->num_rows($resql); $i = 0; + + $contactstatic=new Contact($db); + while ($i < $num) { $var = !$var; $obj = $db->fetch_object($resql); - print ''; + $contactstatic->id=$obj->id; + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + print ''; print ''; print''; diff --git a/htdocs/societe/notify/index.php b/htdocs/societe/notify/index.php index 3cde6da2b5d..75b92352582 100644 --- a/htdocs/societe/notify/index.php +++ b/htdocs/societe/notify/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2006 Laurent Destailleur * * 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 @@ -19,22 +19,25 @@ * $Id$ * $Source$ */ + +/** + \file htdocs/societe/notify.index.php + \ingroup notification + \brief Liste des notifications réalisées + \version $Revision$ +*/ + require("./pre.inc.php"); $langs->load("companies"); $langs->load("banks"); -/* - * Sécurité accés client - */ +// Sécurité accés client if ($user->societe_id > 0) { - $action = ''; - $socid = $user->societe_id; + $action = ''; + $socid = $user->societe_id; } - -llxHeader(); - if ($sortorder == "") { $sortorder="ASC"; @@ -50,60 +53,62 @@ $offset = $conf->liste_limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; + + /* * Mode Liste * - * - * */ -print_barre_liste("Liste des societes", $page, "index.php"); + +llxHeader(); $sql = "SELECT s.nom, s.idp, c.name, c.firstname, a.titre,n.rowid FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n, ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action"; $sql .= " AND n.fk_soc = s.idp"; - -if ($socid > 0) { - $sql .= " AND s.idp = " . $user->societe_id; +if ($socid > 0) +{ + $sql .= " AND s.idp = " . $user->societe_id; } - $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); $result = $db->query($sql); if ($result) { - $num = $db->num_rows(); - $i = 0; - - - print "
 
'.$obj->firstname . " ".$obj->name.'
'.$contactstatic->getNomUrl(1).''.$obj->titre.''.img_delete().''; print '
"; - print ''; - print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","",'valign=\"center\"'); - print_liste_field_titre($langs->trans("Contact"),"index.php","c.name"); - print_liste_field_titre($langs->trans("Action"),"index.php","a.titre"); - print "\n"; - $var=True; - while ($i < $num) - { - $obj = $db->fetch_object( $i); - - $var=!$var; - - print ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
idp\">$obj->nom".$obj->firstname." ".$obj->name."".$obj->titre."
"; - $db->free(); + $num = $db->num_rows($result); + $i = 0; + + $paramlist=''; + print_barre_liste($langs->trans("ListOfNotificationsDone"), $page, "index.php", $paramlist, $sortfield,$sortorder,'',$num); + + print ''; + print ''; + print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","",'valign=\"center\"'); + print_liste_field_titre($langs->trans("Contact"),"index.php","c.name"); + print_liste_field_titre($langs->trans("Action"),"index.php","a.titre"); + print "\n"; + $var=True; + while ($i < $num) + { + $obj = $db->fetch_object($result); + + $var=!$var; + + print ""; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + $i++; + } + print "
idp\">$obj->nom".$obj->firstname." ".$obj->name."".$obj->titre."
"; + $db->free(); } else { - print $db->error() . ' ' . $sql; + dolibarr_print_error($db); } $db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/societe/notify/pre.inc.php b/htdocs/societe/notify/pre.inc.php index cfab795ba4c..3b712dd66eb 100644 --- a/htdocs/societe/notify/pre.inc.php +++ b/htdocs/societe/notify/pre.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2006 Laurent Destailleur * * 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 @@ -18,34 +18,39 @@ * * $Id$ * $Source$ - * */ +/** + \file htdocs/societe/notify/pre.inc.php + \ingroup product,service + \brief Fichier gestionnaire du menu gauche des notifications + \version $Revision$ +*/ require ("../../main.inc.php"); function llxHeader($head = "") { - global $langs, $user, $conf; - - top_menu($head); - - $menu = new Menu(); - - if ($conf->societe->enabled) - { - $menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company"); - - if ($conf->rights->societe->creer) - { - $menu->add_submenu(DOL_URL_ROOT."/soc.php?&action=create", $langs->trans("NewCompany")); - } - - $menu->add_submenu(DOL_URL_ROOT."/contact.php", $langs->trans("Contacts")); - - $menu->add_submenu("index.php", $langs->trans("Notifications")); - } - - left_menu($menu->liste); + global $langs, $user, $conf; + + top_menu($head); + + $menu = new Menu(); + + if ($conf->societe->enabled) + { + $menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company"); + + if ($conf->rights->societe->creer) + { + $menu->add_submenu(DOL_URL_ROOT."/soc.php?&action=create", $langs->trans("NewCompany")); + } + + $menu->add_submenu(DOL_URL_ROOT."/contact.php", $langs->trans("Contacts")); + + $menu->add_submenu("index.php", $langs->trans("Notifications")); + } + + left_menu($menu->liste); } ?> diff --git a/htdocs/societe/pre.inc.php b/htdocs/societe/pre.inc.php index 40a8be35416..082ac7419d6 100644 --- a/htdocs/societe/pre.inc.php +++ b/htdocs/societe/pre.inc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2006 Laurent Destailleur * * 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 @@ -18,34 +18,40 @@ * * $Id$ * $Source$ - * */ +/** + \file htdocs/societe/notify/pre.inc.php + \ingroup product,service + \brief Fichier gestionnaire du menu gauche des notifications + \version $Revision$ +*/ require ("../main.inc.php"); + function llxHeader($head = "") { - global $langs, $user, $conf; + global $langs, $user, $conf; - top_menu($head); + top_menu($head); - $menu = new Menu(); + $menu = new Menu(); - if ($conf->societe->enabled) - { - $menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company"); + if ($conf->societe->enabled) + { + $menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"),"company"); - if ($conf->rights->societe->creer) - { - $menu->add_submenu(DOL_URL_ROOT."/soc.php?&action=create", $langs->trans("NewCompany")); - } - - $menu->add_submenu(DOL_URL_ROOT."/contact.php", $langs->trans("Contacts")); + if ($conf->rights->societe->creer) + { + $menu->add_submenu(DOL_URL_ROOT."/soc.php?&action=create", $langs->trans("NewCompany")); + } - $menu->add_submenu("notify/index.php", $langs->trans("Notifications")); - } + $menu->add_submenu(DOL_URL_ROOT."/contact.php", $langs->trans("Contacts")); - left_menu($menu->liste); + $menu->add_submenu("notify/index.php", $langs->trans("Notifications")); + } + + left_menu($menu->liste); } ?> diff --git a/mysql/data/data.sql b/mysql/data/data.sql index ff3c6229a5b..b33e86f160e 100644 --- a/mysql/data/data.sql +++ b/mysql/data/data.sql @@ -60,7 +60,6 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_NOT_INSTA insert into llx_const (name, value, type, note, visible) values ('MAIN_UPLOAD_DOC','1','chaine','Autorise l\'upload de documents',0); insert into llx_const (name, value, type, note, visible) values ('MAIN_MONNAIE','EUR','chaine','Monnaie',0); -insert into llx_const (name, value, type, note, visible) values ('MAIN_EMAIL_FROM','dolibarr-robot@domain.com','chaine','EMail emetteur pour les envois automatiques Dolibarr (Notifications, ...)',1); insert into llx_const(name,value,type,visible,note) values('MAIN_FASTSEARCH_COMPANY','1','yesno',0,'Show form for quick company search'); insert into llx_const(name,value,type,visible,note) values('MAIN_FASTSEARCH_CONTACT','1','yesno',0,'Show form for quick contact search'); @@ -152,11 +151,14 @@ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_TEXT','%TYPE% n° %ID%\r\n%PRENOM% %NOM%\r\n<%EMAIL%>\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%','texte','Texte imprime sur la carte adherent',0); -- --- OsCommerce +-- OsCommerce 1 -- -insert into llx_const (name, value, type) values ('OSC_DB_NAME','catalog','chaine'); -insert into llx_const (name, value, type) values ('OSC_LANGUAGE_ID','1','chaine'); -insert into llx_const (name, value, type) values ('OSC_CATALOG_URL','http://osc.lafrere.lan/','chaine'); +insert into llx_const (name, value, type) values ('OSC_DB_HOST','localhost','chaine'); + +-- +-- Notification +-- +insert into llx_const (name, value, type, note, visible) values ('NOTIFICATION_EMAIL_FROM','dolibarr-robot@domain.com','chaine','EMail emetteur pour les notifications automatiques Dolibarr',1); -- -- Modeles de numerotation et generation document diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql index 746f63da445..d1f192279eb 100644 --- a/mysql/migration/2.0.0-2.1.0.sql +++ b/mysql/migration/2.0.0-2.1.0.sql @@ -155,9 +155,12 @@ update llx_const set name='MAIN_SIZE_LISTE_LIMIT' where name='SIZE_LISTE_LIMIT'; update llx_const set name='SOCIETE_FISCAL_MONTH_START' where name='FISCAL_MONTH_START'; update llx_const set visible=0 where name='FACTURE_DISABLE_RECUR'; update llx_const set visible=0 where name='MAILING_EMAIL_FROM'; +update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_MAIL_FROM'; +update llx_const set name='NOTIFICATION_EMAIL_FROM', visible=0 where name='MAIN_EMAIL_FROM'; insert into llx_const(name,value,type,visible,note) values('MAIN_SHOW_DEVELOPMENT_MODULES','0','yesno',1,'Make development modules visible'); +delete from llx_const where name in ('OSC_CATALOG_URL','OSC_LANGUAGE_ID'); alter table llx_paiementfourn add statut smallint(6) NOT NULL DEFAULT 0; diff --git a/pgsql/data/data.sql b/pgsql/data/data.sql index 223d1a5a961..17f031bab80 100644 --- a/pgsql/data/data.sql +++ b/pgsql/data/data.sql @@ -50,7 +50,6 @@ insert into llx_const (name, value, type, note, visible) values ('MAIN_MONNAIE', insert into llx_const (name, value, type, note, visible) values ('MAIN_UPLOAD_DOC','1','chaine','Autorise l\'upload de document',1); insert into llx_const (name, value, type, note, visible) values ('MAIN_NOT_INSTALLED','1','chaine','Test d\'installation',1); -insert into llx_const (name, value, type, note, visible) values ('MAIN_MAIL_FROM','dolibarr-robot@domain.com','chaine','EMail emetteur pour les notifications automatiques Dolibarr',1); insert into llx_const (name, value, type, note, visible) values ('MAIN_TITLE','Dolibarr','chaine','Titre des pages',0); @@ -124,11 +123,14 @@ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_ insert into llx_const (name, value, type, note, visible) values ('ADHERENT_CARD_TEXT','%TYPE% n° %ID%\r\n%PRENOM% %NOM%\r\n<%EMAIL%>\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%','texte','Texte imprime sur la carte adherent',0); -- --- OsCommerce +-- OsCommerce 1 -- -insert into llx_const (name, value, type) values ('DB_NAME_OSC','catalog','chaine'); -insert into llx_const (name, value, type) values ('OSC_LANGUAGE_ID','1','chaine'); -insert into llx_const (name, value, type) values ('OSC_CATALOG_URL','http://osc.lafrere.lan/','chaine'); +insert into llx_const (name, value, type) values ('OSC_DB_HOST','localhost','chaine'); + +-- +-- Notification +-- +insert into llx_const (name, value, type, note, visible) values ('NOTIFICATION_EMAIL_FROM','dolibarr-robot@domain.com','chaine','EMail emetteur pour les notifications automatiques Dolibarr',1); -- --