New: Can add an event automatically when a projet is create.

This commit is contained in:
Laurent Destailleur 2013-07-10 14:46:16 +02:00
parent f94f516a12
commit a4abfe1abc
8 changed files with 29 additions and 4 deletions

View File

@ -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:

View File

@ -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].'>';

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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