Skip to content

Commit

Permalink
New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to
Browse files Browse the repository at this point in the history
create an automatic event into agenda.
Qual: Removed hard coded rowid into data init.
  • Loading branch information
eldy committed Jul 6, 2014
1 parent 823e976 commit ce3fa14
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 46 deletions.
5 changes: 4 additions & 1 deletion ChangeLog
Expand Up @@ -12,7 +12,9 @@ For users:
- New: Form to add a photo is immediatly available on photo page if
permissions are ok (save one click per photo to add).
- New: Add option PRODUCT_MAX_VISIBLE_PHOTO to limit number of photos
shown on main product card.
shown on main product card.
- New: Add event FICHINTER_CLASSIFY_BILLED into list of possible events to
create an automatic event into agenda.
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
- Fix: [ bug #1470, #1472, #1473] User trigger problem
- Fix: [ bug #1489, #1491 ] Intervention trigger problem
Expand All @@ -29,6 +31,7 @@ For translators:
For developers:
- New: Add hook "searchAgendaFrom".
- New: Add trigger DON_UPDATE, DON_DELETE
- Qual: Removed hard coded rowid into data init of table llx_c_action_trigger.

WARNING: Following change may create regression for some external modules, but was necessary to make
Dolibarr better:
Expand Down
9 changes: 7 additions & 2 deletions htdocs/admin/agenda.php
@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
*
Expand Down Expand Up @@ -36,11 +36,11 @@
$action = GETPOST('action','alpha');
$cancel = GETPOST('cancel','alpha');


// Get list of triggers available
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype";
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a";
$sql.= " ORDER BY a.rang ASC";

$resql=$db->query($sql);
if ($resql)
{
Expand All @@ -67,6 +67,7 @@
/*
* Actions
*/

if ($action == "save" && empty($cancel))
{
$i=0;
Expand Down Expand Up @@ -153,6 +154,7 @@
print '<td colspan="2">'.$langs->trans("ActionsEvents").'</td>';
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=selectall">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone">'.$langs->trans("None").'</a>';
print '</tr>'."\n";
// Show each trigger
if (! empty($triggers))
{
foreach ($triggers as $trigger)
Expand All @@ -165,6 +167,9 @@
//print 'module='.$module.'<br>';
if (! empty($conf->$module->enabled))
{
// Discard special case.
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;

$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$trigger['code'].'</td>';
Expand Down
33 changes: 26 additions & 7 deletions htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
Expand Up @@ -116,8 +116,8 @@ function run_trigger($action,$object,$user,$langs,$conf)
$key='MAIN_AGENDA_ACTIONAUTO_'.$action;
//dol_syslog("xxxxxxxxxxx".$key);

if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
if (empty($conf->global->$key)) return 0; // Log events not enabled for this action
if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
if (empty($conf->global->$key)) return 0; // Do not log events not enabled for this action

$ok=0;

Expand Down Expand Up @@ -370,11 +370,26 @@ function run_trigger($action,$object,$user,$langs,$conf)
$object->actionmsg=$langs->transnoentities("InterventionSentByEMail",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;

// Parameters $object->sendotid defined by caller
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'SHIPPING_VALIDATE')
elseif ($action == 'FICHINTER_CLASSIFY_BILLED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("interventions");
$langs->load("agenda");

$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilled",$object->ref);
$object->actionmsg=$langs->transnoentities("InterventionClassifiedBilled",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;

$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'SHIPPING_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
Expand Down Expand Up @@ -470,7 +485,7 @@ function run_trigger($action,$object,$user,$langs,$conf)
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
}

// Parameters $object->sendotid defined by caller
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
Expand Down Expand Up @@ -629,6 +644,7 @@ function run_trigger($action,$object,$user,$langs,$conf)
$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;
}
Expand All @@ -647,6 +663,7 @@ function run_trigger($action,$object,$user,$langs,$conf)
$object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;

$object->sendtoid=0;
$ok=1;
}

Expand All @@ -662,6 +679,7 @@ function run_trigger($action,$object,$user,$langs,$conf)
$object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;

$object->sendtoid=0;
$ok=1;
}

Expand All @@ -677,6 +695,7 @@ function run_trigger($action,$object,$user,$langs,$conf)
$object->actionmsg.="\n".$langs->transnoentities("Task").': '.$object->ref;
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;

$object->sendtoid=0;
$ok=1;
}

Expand Down Expand Up @@ -723,8 +742,8 @@ function run_trigger($action,$object,$user,$langs,$conf)
$actioncomm->contact = $contactforaction;
$actioncomm->societe = $societeforaction;
$actioncomm->author = $user; // User saving action
//$actioncomm->usertodo = $user; // User affected to action
$actioncomm->userdone = $user; // User doing action
$actioncomm->usertodo = $user; // User owner of action
//$actioncomm->userdone = $user; // User doing action

$actioncomm->fk_element = $object->id;
$actioncomm->elementtype = $object->element;
Expand Down

0 comments on commit ce3fa14

Please sign in to comment.