diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 33c9d5a70bb91a264d58c089d986a0ca52c26bc6..c96af2a8bf3fd45667f465457c41f69718f32083 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -39,17 +39,16 @@ $action=$_POST["action"]; // List of all events supported by triggers $eventstolog=array( -// array('id'=>'USER_CREATE', 'test'=>1), -// array('id'=>'GROUP_CREATE', 'test'=>1), -// array('id'=>'COMPANY_CREATE', 'test'=>$conf->societe->enabled), -// array('id'=>'CONTRACT_VALIDATE', 'test'=>$conf->contrat->enabled), -// array('id'=>'PROPAL_VALIDATE', 'test'=>$conf->propal->enabled), + array('id'=>'COMPANY_CREATE', 'test'=>$conf->societe->enabled), + array('id'=>'CONTRACT_VALIDATE', 'test'=>$conf->contrat->enabled), + array('id'=>'PROPAL_VALIDATE', 'test'=>$conf->propal->enabled), array('id'=>'PROPAL_SENTBYMAIL', 'test'=>$conf->propal->enabled), -// array('id'=>'BILL_VALIDATE', 'test'=>$conf->facture->enabled), -// array('id'=>'BILL_PAYED', 'test'=>$conf->facture->enabled), -// array('id'=>'BILL_CANCELED', 'test'=>$conf->facture->enabled), - array('id'=>'BILL_SENTBYMAIL', 'test'=>$conf->facture->enabled), + array('id'=>'ORDER_VALIDATE', 'test'=>$conf->commande->enabled), array('id'=>'ORDER_SENTBYMAIL', 'test'=>$conf->commande->enabled), + array('id'=>'BILL_VALIDATE', 'test'=>$conf->facture->enabled), + array('id'=>'BILL_PAYED', 'test'=>$conf->facture->enabled), + array('id'=>'BILL_CANCELED', 'test'=>$conf->facture->enabled), + array('id'=>'BILL_SENTBYMAIL', 'test'=>$conf->facture->enabled), // array('id'=>'PAYMENT_CUSTOMER_CREATE','test'=>$conf->facture->enabled), // array('id'=>'PAYMENT_SUPPLIER_CREATE','test'=>$conf->fournisseur->enabled), // array('id'=>'MEMBER_VALIDATE', 'test'=>$conf->adherent->enabled), diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 6c55219dc20a873277b8994343775f523767fc7a..cac11b53ca723b1ccd0c5668f5c9c9ddd7f16f38 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -52,14 +52,16 @@ $eventstolog=array( array('id'=>'ACTION_CREATE', 'test'=>$conf->societe->enabled), array('id'=>'COMPANY_CREATE', 'test'=>$conf->societe->enabled), array('id'=>'CONTRACT_VALIDATE', 'test'=>$conf->contrat->enabled), - array('id'=>'CONTRACT_CANCEL', 'test'=>$conf->contrat->enabled), - array('id'=>'CONTRACT_CLOSE', 'test'=>$conf->contrat->enabled), array('id'=>'PROPAL_VALIDATE', 'test'=>$conf->propal->enabled), array('id'=>'PROPAL_CLOSE_SIGNED', 'test'=>$conf->propal->enabled), array('id'=>'PROPAL_CLOSE_REFUSED', 'test'=>$conf->propal->enabled), + array('id'=>'PROPAL_SENTBYMAIL', 'test'=>$conf->propal->enabled), + array('id'=>'ORDER_VALIDATE', 'test'=>$conf->commande->enabled), + array('id'=>'ORDER_SENTBYMAIL', 'test'=>$conf->commande->enabled), array('id'=>'BILL_VALIDATE', 'test'=>$conf->facture->enabled), array('id'=>'BILL_PAYED', 'test'=>$conf->facture->enabled), array('id'=>'BILL_CANCELED', 'test'=>$conf->facture->enabled), + array('id'=>'BILL_SENTBYMAIL', 'test'=>$conf->facture->enabled), array('id'=>'PAYMENT_CUSTOMER_CREATE','test'=>$conf->facture->enabled), array('id'=>'PAYMENT_SUPPLIER_CREATE','test'=>$conf->fournisseur->enabled), array('id'=>'MEMBER_CREATE', 'test'=>$conf->adherent->enabled), diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 7e7478a55b295270d0d632be5ffaebe1c1794c05..b98cd6b9d6b8cb73479744c46ff3095d68a2baf6 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -56,14 +56,6 @@ if ($_GET["action"] == 'builddoc') $result=$cat->generate($_GET["id"]); } -if ($action=='delete_action') -{ - $actioncomm = new ActionComm($db); - $actioncomm->fetch($actionid); - $result=$actioncomm->delete(); -} - - /* * Affichage liste diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 6745d37e3e2b6b3b08fa1112b17699a8829ddd2d..2591044609259b49d6eb495d90ac13aba0db8ea9 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -339,6 +339,8 @@ if ($_POST['action'] == 'send') if (strlen($sendto)) { + $langs->load("commercial"); + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $message = $_POST['message']; @@ -363,7 +365,7 @@ if ($_POST['action'] == 'send') $actionmsg.=$message; } - $actionmsg2=$langs->transnoentities('SendPropalByMail'); + $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); } $filepath[0] = $file; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 9e0565550d36cf984b9da25ec4359a2cc207d64c..3f22559fffbb3a2632fd6ad4f220416f2fbd59a2 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -605,6 +605,8 @@ if ($_POST['action'] == 'send') if (strlen($sendto)) { + $langs->load("commercial"); + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $message = $_POST['message']; @@ -629,7 +631,7 @@ if ($_POST['action'] == 'send') $actionmsg.=$message; } - $actionmsg2=$langs->transnoentities('SendOrderByMail'); + $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); } $filepath[0] = $file; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a4947e5cc8c83a356e0ac93ae0b1ce1e09d30a1d..567c1db6cd4c4fd72521042addcce3c91b0f45c5 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -989,6 +989,8 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c if (strlen($sendto)) { + $langs->load("commercial"); + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $message = $_POST['message']; @@ -1007,7 +1009,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c } $actiontypecode='AC_FAC'; - $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->trans('To').' '.$sendto.".\n"; + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n"; if ($message) { @@ -1015,7 +1017,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c $actionmsg.=$message; } - $actionmsg2=$langs->transnoentities('SendInvoiceByMail'); + $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); } if ($_POST['action'] == 'relance') { @@ -1026,7 +1028,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c $actionmsg.=$langs->transnoentities('TextUsedInTheMessageBody').":\n"; $actionmsg.=$message; } - $actionmsg2=$langs->transnoentities('ReSendInvoiceByMail'); + $actionmsg2=$langs->transnoentities('Action'.$actiontypecode); } $filepath[0] = $file; diff --git a/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php b/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php index 0dcdd46eccb707406272a5bd9c3de0ecffa167d3..aaa4f98aee69022140ac7d3ef3c3653f04bfa876 100644 --- a/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php +++ b/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php @@ -17,7 +17,7 @@ */ /** - \file htdocs/includes/triggers/interface_all_ActionsAuto.class.php + \file htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php \ingroup core \brief Trigger file for \version $Id$ @@ -102,28 +102,184 @@ class InterfaceActionsAuto //dolibarr_syslog("xxxxxxxxxxx".$key); if (empty($conf->global->$key)) return 0; // Log events not enabled for this action + // Following properties must be filled: + // $object->actiontypecode; + // $object->actionmsg (label) + // $object->actionmsg2 (note) + // $object->sendtoid + // $object->socid + // Optionnal: + // $object->facid + // $object->propalrowid + // $object->orderrowid + $ok=0; // Actions - if ($action == 'PROPAL_SENTBYMAIL') + if ($action == 'COMPANY_CREATE') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("companies"); + + $object->actiontypecode='AC_OTH'; + $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); + $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); + if ($object->prefix) $object->actionmsg.=" (".$object->prefix.")"; + //$this->desc.="\n".$langs->transnoentities("Customer").': '.yn($object->client); + //$this->desc.="\n".$langs->transnoentities("Supplier").': '.yn($object->fournisseur); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $object->facid=$object->orderrowid=$object->propalrowid=0; + $ok=1; + } + elseif ($action == 'CONTRACT_VALIDATE') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("contracts"); + + $object->actiontypecode='AC_OTH'; + $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $object->facid=$object->orderrowid=$object->propalrowid=0; + $ok=1; + } + elseif ($action == 'PROPAL_VALIDATE') { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); + $langs->load("propal"); + + $object->actiontypecode='AC_OTH'; + $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $object->propalrowid=$object->id; + $object->facid=$object->orderrowid=0; $ok=1; } - if ($action == 'BILL_SENTBYMAIL') + elseif ($action == 'PROPAL_SENTBYMAIL') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("propal"); + $ok=1; + + // Parameters $object->xxx defined by caller + } + elseif ($action == 'PROPAL_CLOSE_SIGNED') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("propal"); + + $object->actiontypecode='AC_OTH'; + $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $object->propalrowid=$object->id; + $object->facid=$object->orderrowid=0; + $ok=1; + } + elseif ($action == 'PROPAL_CLOSE_REFUSED') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("propal"); + + $object->actiontypecode='AC_OTH'; + $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $object->propalrowid=$object->id; + $object->facid=$object->orderrowid=0; + $ok=1; + } + elseif ($action == 'ORDER_VALIDATE') { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); + $langs->load("orders"); + + $object->actiontypecode='AC_OTH'; + $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $object->orderrowid=$object->id; + $object->propalrowid=$object->facid=0; $ok=1; } elseif ($action == 'ORDER_SENTBYMAIL') { dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("users"); + $langs->load("orders"); $ok=1; - } + // Parameters $object->xxx defined by caller + } + elseif ($action == 'BILL_VALIDATE') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("bills"); + + $object->actiontypecode='AC_OTH'; + $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $object->facid=$object->id; + $object->orderrowid=$object->propalrowid=0; + $ok=1; + } + elseif ($action == 'BILL_SENTBYMAIL') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("bills"); + $ok=1; + + // Parameters $object->xxx defined by caller + } + elseif ($action == 'BILL_PAYED') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("bills"); + + $object->actiontypecode='AC_OTH'; + $object->actionmsg2=$langs->transnoentities("InvoicePayedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("InvoicePayedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + + $object->sendtoid=0; + $object->facid=$object->id; + $object->orderrowid=$object->propalrowid=0; + $ok=1; + } + elseif ($action == 'BILL_CANCELED') + { + dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("bills"); + + $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=$object->id; + $object->orderrowid=$object->propalrowid=0; + $ok=1; + } + + + + // If not found /* else @@ -140,7 +296,6 @@ class InterfaceActionsAuto require_once(DOL_DOCUMENT_ROOT.'/contact.class.php'); require_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); $actioncomm = new ActionComm($this->db); - $actioncomm->type_id = $object->actiontypeid; $actioncomm->type_code = $object->actiontypecode; $actioncomm->label = $object->actionmsg2; $actioncomm->note = $object->actionmsg; @@ -160,7 +315,7 @@ class InterfaceActionsAuto } else { - $error ="Failed to insert : ".$webcal->error." "; + $error ="Failed to insert : ".$actioncomm->error." "; $this->error=$error; //dolibarr_syslog("interface_webcal.class.php: ".$this->error); diff --git a/htdocs/includes/triggers/interface_modWebcalendar_Webcalsynchro.class.php b/htdocs/includes/triggers/interface_modWebcalendar_Webcalsynchro.class.php index 7247ecb635d6fe36713752933ef34818cbca036d..fd423ca65a35cebbea73b470abb40e957a6068f8 100644 --- a/htdocs/includes/triggers/interface_modWebcalendar_Webcalsynchro.class.php +++ b/htdocs/includes/triggers/interface_modWebcalendar_Webcalsynchro.class.php @@ -165,28 +165,6 @@ class InterfaceWebcalsynchro $this->desc=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); $this->desc.="\n".$langs->transnoentities("Author").': '.$user->login; } - elseif ($action == 'CONTRACT_CANCEL') - { - dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - - $this->date=time(); - $this->duree=0; - $this->texte=$langs->transnoentities("ContractCanceledInDolibarr",$object->ref); - $this->desc=$langs->transnoentities("ContractCanceledInDolibarr",$object->ref); - $this->desc.="\n".$langs->transnoentities("Author").': '.$user->login; - } - elseif ($action == 'CONTRACT_CLOSE') - { - dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load("other"); - - $this->date=time(); - $this->duree=0; - $this->texte=$langs->transnoentities("ContractClosedInDolibarr",$object->ref); - $this->desc=$langs->transnoentities("ContractClosedInDolibarr",$object->ref); - $this->desc.="\n".$langs->transnoentities("Author").': '.$user->login; - } // Proposals elseif ($action == 'PROPAL_VALIDATE')