diff --git a/ChangeLog b/ChangeLog index a14ca245af2..e987a962f7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -26,6 +26,7 @@ For users: - New: Add a cron module to define scheduled jobs. - New: Add new graphical boxes (customer invoices and orders per month). - New: [ task #286 ] Enhance rounding function of prices to allow round of sum instead of sum of rounding. +- New: Can add an event automatically when a projet is create. - Qual: Implement same rule for return value of all command line scripts (0 when success, <>0 if error). For translators: diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 4e53a709d20..bdf2851855e 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -161,8 +161,9 @@ if (! empty($triggers)) if ($module == 'order_supplier' || $module == 'invoice_supplier') $module = 'fournisseur'; if ($module == 'shipping') $module = 'expedition_bon'; if ($module == 'member') $module = 'adherent'; + if ($module == 'project') $module = 'projet'; //print 'module='.$module.'
'; - if ($conf->$module->enabled) + if (! empty($conf->$module->enabled)) { $var=!$var; print ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index ea08cfcc98d..0310f5e0cdd 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -40,9 +40,9 @@ class ActionComm extends CommonObject var $id; var $type_id; // id into parent table llx_c_actioncomm (will be deprecated into future, link should not be required) - var $type_code; // code into parent table llx_c_actioncomm (will be deprecated into future, link should not be required) + var $type_code; // code into parent table llx_c_actioncomm (will be deprecated into future, link should not be required). With defautl setup, should be AC_OTH_AUTO or AC_OTH var $type; // label into parent table llx_c_actioncomm (will be deprecated into future, link should not be required) - var $code; + var $code; // Free code to identify action. Ie: Agenda trigger add here AC_TRIGGERNAME ('AC_COMPANY_CREATE', 'AC_PROPAL_VALIDATE', ...) var $label; var $datec; // Date creation record (datec) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 1bb55c93fc4..7b6b6399587 100755 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -555,6 +555,23 @@ class InterfaceActionsAuto $ok=1; } + // Projects + elseif ($action == 'PROJECT_CREATE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + $langs->load("other"); + $langs->load("projects"); + $langs->load("agenda"); + + $object->actiontypecode='AC_OTH_AUTO'; + if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); + $object->actionmsg=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); + $object->actionmsg.="\n".$langs->transnoentities("Project").': '.$object->ref; + $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; + $object->sendtoid=0; + $ok=1; + } + // If not found /* else diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index 64f21465797..9f7bf87229c 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -1,6 +1,6 @@ -- Copyright (C) 2001-2004 Rodolphe Quiedeville -- Copyright (C) 2003 Jean-Louis Bergamo --- Copyright (C) 2004-2011 Laurent Destailleur +-- Copyright (C) 2004-2013 Laurent Destailleur -- Copyright (C) 2004 Benoit Mortier -- Copyright (C) 2004 Guillaume Delecourt -- Copyright (C) 2005-2011 Regis Houssin @@ -57,3 +57,4 @@ insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (27,'MEMBER_DELETE','Member deleted','Executed when a member is deleted','member',25); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (28,'BILL_UNVALIDATE','Customer invoice unvalidated','Executed when a customer invoice status set back to draft','facture',10); insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (29,'FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',29); +insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (30,'PROJECT_CREATE','Project creation','Executed when a project is created','project',30); diff --git a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql index 858fb2a51e9..549397f99a0 100755 --- a/htdocs/install/mysql/migration/3.4.0-3.5.0.sql +++ b/htdocs/install/mysql/migration/3.4.0-3.5.0.sql @@ -72,3 +72,6 @@ DELETE FROM llx_boxes where box_id IN (SELECT rowid FROM llx_boxes_def where fil DELETE FROM llx_boxes_def where file='box_activity.php' AND note IS NULL; ALTER TABLE llx_cronjob ADD libname VARCHAR(255); + +INSERT INTO llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (30,'PROJECT_CREATE','Project creation','Executed when a project is created','project',30); + diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index 8c4624fb057..dd7f866505c 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -94,6 +94,7 @@ ConfirmCloneProject=Are you sure to clone this project ? ProjectReportDate=Change task date according project start date ErrorShiftTaskDate=Impossible to shift task date according to new project start date ProjectsAndTasksLines=Projects and tasks +ProjectCreatedInDolibarr=Project %s created ##### Types de contacts ##### TypeContact_project_internal_PROJECTLEADER=Project leader TypeContact_project_external_PROJECTLEADER=Project leader diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 6cec42521be..8eb71da8999 100644 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -94,6 +94,7 @@ ConfirmCloneProject=Êtes-vous sûr de vouloir cloner ce projet ? ProjectReportDate=Reporter les dates des tâches en fonction de la date de départ. ErrorShiftTaskDate=Une erreur c'est produite dans le report des dates des tâches. ProjectsAndTasksLines=Projets et tâches +ProjectCreatedInDolibarr=Projet %s créé ##### Types de contacts ##### TypeContact_project_internal_PROJECTLEADER=Chef de projet TypeContact_project_external_PROJECTLEADER=Chef de projet