diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
index b9de189b996..c2843716cea 100644
--- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
+++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
@@ -59,10 +59,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
* $object->sendtoid (id of contact or array of ids of contacts)
* $object->socid (id of thirdparty)
* $object->fk_project
- * $object->fk_element
- * $object->elementtype
+ * $object->fk_element (ID of object to link action event to)
+ * $object->elementtype (->element of object to link action to)
+ * $object->module (if defined, elementtype in llx_actioncomm will be elementtype@module)
*
- * @param string $action Event action code
+ * @param string $action Event action code ('CONTRACT_MODIFY', 'RECRUITMENTCANDIDATURE_MODIFIY', ...)
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
@@ -74,6 +75,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
$key = 'MAIN_AGENDA_ACTIONAUTO_'.$action;
+ //var_dump($action.' - '.$conf->global->$key);exit;
// Do not log events not enabled for this action
if (empty($conf->global->$key)) {
@@ -778,15 +780,29 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid = 0;
}
// TODO Merge all previous cases into this generic one
- else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, ...
+ else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ...
{
// Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function).
// Note that these key can be set in agenda setup, only if defined into c_action_trigger
// Load translation files required by the page
- $langs->loadLangs(array("agenda", "other"));
-
- if (empty($object->actionmsg2)) $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", $object->ref);
- if (empty($object->actionmsg)) $object->actionmsg = $langs->transnoentities($action."InDolibarr", $object->ref);
+ if (empty($object->actionmsg2)) {
+ if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key
+ $langs->loadLangs(array("agenda", "other"));
+ $object->actionmsg2 = $langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref));
+ } else { // generic translation key
+ $tmp = explode('_', $action);
+ $object->actionmsg2 = $langs->transnoentities($tmp[count($tmp)-1]."InDolibarr", ($object->newref ? $object->newref : $object->ref));
+ }
+ }
+ if (empty($object->actionmsg)) {
+ if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key
+ $langs->loadLangs(array("agenda", "other"));
+ $object->actionmsg = $langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref));
+ } else { // generic translation key
+ $tmp = explode('_', $action);
+ $object->actionmsg = $langs->transnoentities($tmp[count($tmp)-1]."InDolibarr", ($object->newref ? $object->newref : $object->ref));
+ }
+ }
if (! isset($object->sendtoid) || ! is_array($object->sendtoid)) {
$object->sendtoid = 0;
@@ -827,14 +843,15 @@ class InterfaceActionsAuto extends DolibarrTriggers
$projectid = isset($object->fk_project) ? $object->fk_project : 0;
if ($object->element == 'project') $projectid = $object->id;
- $elementid = $object->id;
+ $elementid = $object->id; // id of object
$elementtype = $object->element;
+ $elementmodule = $object->module;
if ($object->element == 'subscription')
{
$elementid = $object->fk_adherent;
$elementtype = 'member';
}
- //var_dump($societeforaction);var_dump($contactforaction);exit;
+ //var_dump($societeforaction);var_dump($contactforaction);var_dump($elementid);var_dump($elementtype);exit;
// Insertion action
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@@ -867,7 +884,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
if (!in_array($elementtype, array('societe', 'contact', 'project')))
{
$actioncomm->fk_element = $elementid;
- $actioncomm->elementtype = $elementtype;
+ $actioncomm->elementtype = $elementtype.($elementmodule ? '@'.$elementmodule : '');
}
if (property_exists($object, 'attachedfiles') && is_array($object->attachedfiles) && count($object->attachedfiles) > 0) {
diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php
index 4657b49899d..28c0b86d765 100644
--- a/htdocs/fourn/class/fournisseur.commande.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.class.php
@@ -768,7 +768,7 @@ class CommandeFournisseur extends CommonOrder
global $langs, $conf, $user;
$result = '';
- $label = ''.$langs->trans("ShowOrder").'';
+ $label = ''.$langs->trans("PurchaseOrder").'';
if (!empty($this->ref))
$label .= '
'.$langs->trans('Ref').': '.$this->ref;
if (!empty($this->ref_supplier))
diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql
index d54ac24a203..eeca137dbc0 100644
--- a/htdocs/install/mysql/data/llx_c_action_trigger.sql
+++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql
@@ -124,13 +124,23 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_CLOSE','BOM disabled','Executed when a BOM is disabled','bom',652);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_VALIDATE','MO validated','Executed when a MO is validated','mrp',660);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_PRODUCED','MO produced','Executed when a MO is produced','mrp',661);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_DELETE','MO deleted','Executed when a MO is deleted','mrp',662);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MRP_MO_CANCEL','MO canceled','Executed when a MO is canceled','mrp',663);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_CREATE','Contact address created','Executed when a contact is created','contact',50);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact adress card','contact',51);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_SENTBYMAIL','Mails sent from third party card','Executed when you send email from contact address record','contact',51);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('CONTACT_DELETE','Contact address deleted','Executed when a contact is deleted','contact',52);
+
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_DELETE','Job deleted','Executed when a job is deleted','recruitment',7506);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_CREATE','Candidature created','Executed when a candidature is created','recruitment',7510);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_MODIFY','Candidature modified','Executed when a candidature is modified','recruitment',7512);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516);
+
-- actions not enabled by default : they are excluded when we enable the module Agenda (except TASK_...)
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_CREATE','Task created','Executed when a project task is created','project',150);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',151);
diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
index 3ff02c889bc..108dc94f485 100644
--- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
+++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
@@ -270,3 +270,13 @@ ALTER TABLE llx_ecm_files CHANGE COLUMN date_m tms timestamp;
INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'$conf->recruitment->enabled',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,
\n\n__(YourCandidatureAnswer)__
\n
\n__(Sincerely)__
__USER_SIGNATURE__',null, 0);
+ALTER TABLE llx_c_action_trigger MODIFY COLUMN code varchar(64) NOT NULL;
+
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_CREATE','Job created','Executed when a job is created','recruitment',7500);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_MODIFY','Job modified','Executed when a job is modified','recruitment',7502);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_SENTBYMAIL','Mails sent from job record','Executed when you send email from job record','recruitment',7504);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTJOBPOSITION_DELETE','Job deleted','Executed when a job is deleted','recruitment',7506);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_CREATE','Candidature created','Executed when a candidature is created','recruitment',7510);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_MODIFY','Candidature modified','Executed when a candidature is modified','recruitment',7512);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_SENTBYMAIL','Mails sent from candidature record','Executed when you send email from candidature record','recruitment',7514);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('RECRUITMENTCANDIDATURE_DELETE','Candidature deleted','Executed when a candidature is deleted','recruitment',7516);
diff --git a/htdocs/install/mysql/tables/llx_c_action_trigger.sql b/htdocs/install/mysql/tables/llx_c_action_trigger.sql
index c29f13b9fd4..8f7450d0fe9 100644
--- a/htdocs/install/mysql/tables/llx_c_action_trigger.sql
+++ b/htdocs/install/mysql/tables/llx_c_action_trigger.sql
@@ -23,7 +23,7 @@ create table llx_c_action_trigger
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
elementtype varchar(64) NOT NULL,
- code varchar(32) NOT NULL,
+ code varchar(64) NOT NULL,
label varchar(128) NOT NULL,
description varchar(255),
rang integer DEFAULT 0
diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang
index 1466b6389a9..186272da1b6 100644
--- a/htdocs/langs/en_US/main.lang
+++ b/htdocs/langs/en_US/main.lang
@@ -1077,4 +1077,8 @@ AmountMustBePositive=Amount must be positive
ByStatus=By status
InformationMessage=Information
ASAP=As Soon As Possible
-
\ No newline at end of file
+CREATEInDolibarr=Record %s create
+MODIFYInDolibarr=Record %s modified
+DELETEInDolibarr=Record %s deleted
+VALIDATEInDolibarr=Record %s validated
+APPROVEDInDolibarr=Record %s approved
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 5a2e27e6bc6..3a64bc557ea 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -32,6 +32,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/
class MyObject extends CommonObject
{
+ /**
+ * @var string ID of module.
+ */
+ public $module = 'mymodule';
+
/**
* @var string ID to identify managed object.
*/
diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php
index a85f84a50ba..dfa79e499bc 100644
--- a/htdocs/modulebuilder/template/myobject_card.php
+++ b/htdocs/modulebuilder/template/myobject_card.php
@@ -157,7 +157,7 @@ if (empty($reshook))
if ($action == 'set_thirdparty' && $permissiontoadd)
{
- $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MYOBJECT_MODIFY');
+ $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname);
}
if ($action == 'classin' && $permissiontoadd)
{
@@ -165,7 +165,7 @@ if (empty($reshook))
}
// Actions to send emails
- $triggersendname = 'MYOBJECT_SENTBYMAIL';
+ $triggersendname = 'MYMODULE_MYOBJECT_SENTBYMAIL';
$autocopy = 'MAIN_MAIL_AUTOCOPY_MYOBJECT_TO';
$trackid = 'myobject'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php
index b6f7bdd1215..0be25758617 100644
--- a/htdocs/recruitment/class/recruitmentcandidature.class.php
+++ b/htdocs/recruitment/class/recruitmentcandidature.class.php
@@ -1,6 +1,5 @@
- * Copyright (C) ---Put here your own copyright and developer email---
+/* Copyright (C) 2020 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,6 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/
class RecruitmentCandidature extends CommonObject
{
+ /**
+ * @var string ID of module.
+ */
+ public $module = 'recruitment';
+
/**
* @var string ID to identify managed object.
*/
@@ -61,6 +65,7 @@ class RecruitmentCandidature extends CommonObject
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
+ //const STATUS_INTERVIEW_SCHEDULED = 2;
const STATUS_CONTRACT_PROPOSED = 3;
const STATUS_CONTRACT_SIGNED = 5;
const STATUS_REFUSED = 8;
diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php
index 3a0daa3eebf..d6a8c62e000 100644
--- a/htdocs/recruitment/class/recruitmentjobposition.class.php
+++ b/htdocs/recruitment/class/recruitmentjobposition.class.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2020 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -31,6 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/
class RecruitmentJobPosition extends CommonObject
{
+ /**
+ * @var string ID of module.
+ */
+ public $module = 'recruitment';
+
/**
* @var string ID to identify managed object
*/
diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php
index 730d8fb884a..49587f76b09 100644
--- a/htdocs/recruitment/recruitmentcandidature_card.php
+++ b/htdocs/recruitment/recruitmentcandidature_card.php
@@ -138,7 +138,7 @@ if (empty($reshook))
else $backtopage = dol_buildpath('/recruitment/recruitmentcandidature_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
}
}
- $triggermodname = 'RECRUITMENT_RECRUITMENTCANDIDATURE_MODIFY'; // Name of trigger action code to execute when we modify record
+ $triggermodname = 'RECRUITMENTCANDIDATURE_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
@@ -155,16 +155,12 @@ if (empty($reshook))
// Action to build doc
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
- if ($action == 'set_thirdparty' && $permissiontoadd)
- {
- $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'RECRUITMENTCANDIDATURE_MODIFY');
- }
if ($action == 'classin' && $permissiontoadd)
{
$object->setProject(GETPOST('projectid', 'int'));
}
if ($action == 'confirm_decline' && $confirm == 'yes' && $permissiontoadd) {
- $result = $object->setStatut($object::STATUS_REFUSED, null, '', 'RECRUITMENTCANDIDATURE_DECLINE');
+ $result = $object->setStatut($object::STATUS_REFUSED, null, '', $triggermodname);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -506,7 +502,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Refuse - Decline
- if ($object->status >= $object::STATUS_VALIDATED && $object->status < $object::STATUS_CANCELED)
+ if ($object->status >= $object::STATUS_VALIDATED && $object->status < $object::STATUS_REFUSED)
{
if ($permissiontoadd)
{