diff --git a/ChangeLog b/ChangeLog index a14ca245af207ed2783e4c47f80b4cf1b6253c42..e987a962f7abba8e7c390bbddcf0f6a56bc30e21 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 4e53a709d20c12c9b41aeafcd245eaf673bd025a..bdf2851855eebb4e12a16151845157f54f0d4c61 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.'<br>'; - if ($conf->$module->enabled) + if (! empty($conf->$module->enabled)) { $var=!$var; print '<tr '.$bc[$var].'>'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index ea08cfcc98d3a684824501156a4cf92f52f363a1..0310f5e0cdda43bed3058547e00aed0b39f1d803 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 1bb55c93fc48bf8e3d67ddaf22a458ac77dd7205..7b6b63995878f2e12d53c6fa7bc88e9cd5afec5c 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 64f21465797c8446b117b5072a08e991af6b797f..9f7bf87229cd5114291a2dcece0b15b62ed55c19 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 <rodolphe@quiedeville.org> -- Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> --- Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> +-- Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> -- Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> -- Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be> -- Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> @@ -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 858fb2a51e95ebb078037028eee1b017ed308244..549397f99a05db22e2d45592ad60ace305949bc4 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 8c4624fb0574ebd40788b675cbe2965b9f5cd3c0..dd7f866505cda1304109fb75060ef0d88215e8dc 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 6cec42521be406c2b6e225c8b14ff0ac9725811e..8eb71da89999e1186d95a0830b1cfce7db5514e8 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