Merge branch 'develop' of github.com:Dolibarr/dolibarr into NEW_AgendaEvent_Remind

This commit is contained in:
atm-lena 2020-08-26 15:16:53 +02:00
commit 1267e914dc
14 changed files with 138 additions and 70 deletions

View File

@ -43,6 +43,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -122,6 +123,10 @@ $permissiontoread = $user->admin;
$permissiontoadd = $user->admin;
$permissiontodelete = $user->admin;
if ($id > 0) {
$object->fetch($id);
}
/*
* Actions
@ -191,7 +196,6 @@ $now = dol_now();
$help_url = '';
$title = $langs->trans("EMailsSetup");
llxHeader('', $title);
$linkback = '';
@ -230,7 +234,7 @@ foreach ($search as $key => $val)
{
if ($key == 'status' && $search[$key] == -1) continue;
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if (strpos($object->fields[$key]['type'], 'integer:') === 0 || $key == 'active') {
if ($search[$key] == '-1') $search[$key] = '';
$mode_search = 2;
}
@ -347,15 +351,41 @@ print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'"
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="'.($action == 'create' ? 'add' : 'list').'">';
print '<input type="hidden" name="action" value="'.($action == 'create' ? 'add' : ($action == 'edit' ? 'update' : 'list')).'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$newcardbutton = '';
if ($action != 'create') {
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', $_SERVER['PHP_SELF'].'?action=create', '', $permissiontoadd);
if ($action == 'edit') {
print '<table class="border centpercent tableforfield">';
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.(GETPOSTISSET('label') ? GETPOST('label', 'alphanohtml') : $object->label).'"></td></tr>';
print '<tr><td>'.$langs->trans("Email").'</td><td><input type="text" name="email" value="'.(GETPOSTISSET('email') ? GETPOST('email', 'alphanohtml') : $object->email).'"></td></tr>';
print '<tr><td>'.$langs->trans("Signature").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor('signature', (GETPOSTISSET('signature') ? GETPOST('signature', 'restricthtml') : $object->signature), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%');
print $doleditor->Create(1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("User").'</td><td>';
print $form->select_dolusers((GETPOSTISSET('private') ? GETPOST('private', 'int') : $object->private), 'private', 1, null, 0, ($user->admin ? '' : $user->id));
print '</td></tr>';
print '<tr><td>'.$langs->trans("Position").'</td><td><input type="text" name="position" class="maxwidth50" value="'.(GETPOSTISSET('position') ? GETPOST('position', 'int') : $object->position).'"></td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print $form->selectarray('active', $object->fields['active']['arrayofkeyval'], (GETPOSTISSET('active') ? GETPOST('active', 'int') : $object->active), 0, 0, 0, '', 1);
print '</td></tr>';
print '</table>';
print '<br>';
print '<div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
print ' &nbsp; ';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
}
} else {
/*print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -367,7 +397,7 @@ if ($action != 'create') {
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
*/
print '<table class="border centpercent tableforfield">';
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.GETPOST('label', 'alphanohtml').'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="label" value="'.GETPOST('label', 'alphanohtml').'"></td></tr>';
print '<tr><td>'.$langs->trans("Email").'</td><td><input type="text" name="email" value="'.GETPOST('email', 'alphanohtml').'"></td></tr>';
print '<tr><td>'.$langs->trans("Signature").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -531,7 +561,7 @@ while ($i < ($limit ? min($num, $limit) : $num))
if (!empty($arrayfields['t.'.$key]['checked']))
{
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
if ($key == 'status') print $object->getLibStatut(5);
if ($key == 'status' || $key == 'active') print $object->getLibStatut(5);
else print $object->showOutputField($val, $key, $object->$key, '');
print '</td>';
if (!$i) $totalarray['nbfield']++;
@ -550,14 +580,14 @@ while ($i < ($limit ? min($num, $limit) : $num))
print $hookmanager->resPrint;
// Action column
print '<td class="nowrap center">';
$url = $_SERVER["PHP_SELF"].'?action=list&id='.$obj->rowid;
$url = $_SERVER["PHP_SELF"].'?id='.$obj->rowid;
if ($limit) $url .= '&limit='.urlencode($limit);
if ($page) $url .= '&page='.urlencode($page);
if ($sortfield) $url .= '&sortfield='.urlencode($sortfield);
if ($sortorder) $url .= '&page='.urlencode($sortorder);
//print '<a class="reposition" href="'.$url.'&action=edit">'.img_edit().'</a>';
print '<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.'&action=edit&rowid='.$obj->rowid.'">'.img_edit().'</a>';
//print ' &nbsp; ';
print '<a href="'.$url.'&action=delete">'.img_delete().'</a> &nbsp; ';
print '<a class=" marginrightonly marginleftonly" href="'.$url.'&action=delete">'.img_delete().'</a> &nbsp; ';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected = 0;

View File

@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page
$langs->loadLangs(array("errors", "admin", "mails", "languages"));
$action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : 'view';
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view';
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$id = GETPOST('id', 'int');
@ -411,13 +411,15 @@ if (empty($reshook))
$form = new Form($db);
$formadmin = new FormAdmin($db);
llxHeader();
$help_url = '';
$title = $langs->trans("EMailsSetup");
llxHeader('', $title);
$titre = $langs->trans("EMailsSetup");
$linkback = '';
$titlepicto = 'title_setup';
print load_fiche_titre($titre, $linkback, $titlepicto);
print load_fiche_titre($title, $linkback, $titlepicto);
$head = email_admin_prepare_head();

View File

@ -95,13 +95,12 @@ class EmailSenderProfile extends CommonObject
'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>1),
'email' => array('type'=>'varchar(255)', 'label'=>'Email', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1),
//'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'private' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'User', 'visible'=>-1, 'enabled'=>1, 'position'=>50, 'default'=>'0', 'notnull'=>1),
'signature' => array('type'=>'text', 'label'=>'Signature', 'visible'=>3, 'enabled'=>1, 'position'=>400, 'notnull'=>-1, 'index'=>1,),
'position' => array('type'=>'integer', 'label'=>'Position', 'visible'=>1, 'enabled'=>1, 'position'=>405, 'notnull'=>-1, 'index'=>1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>500, 'notnull'=>1,),
'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>-1, 'index'=>1, 'arrayofkeyval'=>array(0=>'Disabled', 1=>'Enabled')),
'active' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'default'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0=>'Disabled', 1=>'Enabled')),
);
/**
@ -331,7 +330,7 @@ class EmailSenderProfile extends CommonObject
*/
public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
return $this->LibStatut($this->active, $mode);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@ -346,31 +345,16 @@ class EmailSenderProfile extends CommonObject
{
global $langs;
if ($mode == 0 || $mode == 1)
{
if ($status == 1) return $langs->trans('Enabled');
elseif ($status == 0) return $langs->trans('Disabled');
} elseif ($mode == 2)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
} elseif ($mode == 3)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5');
} elseif ($mode == 4)
{
if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
} elseif ($mode == 5)
{
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
} elseif ($mode == 6)
{
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
if ($status == 1) {
$label = $labelshort = $langs->trans('Enabled');
} else {
$label = $labelshort = $langs->trans('Disabled');
}
$statusType = 'status'.$status;
if ($status == self::STATUS_ENABLED) $statusType = 'status4';
return dolGetStatus($label, $labelshort, '', $statusType, $mode);
}
/**

View File

@ -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)) {
$langs->loadLangs(array("agenda", "other"));
if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key
$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)) {
$langs->loadLangs(array("agenda", "other"));
if ($langs->transnoentities($action."InDolibarr", ($object->newref ? $object->newref : $object->ref)) != $action."InDolibarr") { // specific translation key
$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) {

View File

@ -768,7 +768,7 @@ class CommandeFournisseur extends CommonOrder
global $langs, $conf, $user;
$result = '';
$label = '<u>'.$langs->trans("ShowOrder").'</u>';
$label = '<u>'.$langs->trans("PurchaseOrder").'</u>';
if (!empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
if (!empty($this->ref_supplier))

View File

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

View File

@ -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__,<br><br>\n\n__(YourCandidatureAnswer)__<br>\n<br><br>\n__(Sincerely)__<br>__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);

View File

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

View File

@ -1077,4 +1077,8 @@ AmountMustBePositive=Amount must be positive
ByStatus=By status
InformationMessage=Information
ASAP=As Soon As Possible
CREATEInDolibarr=Record %s create
MODIFYInDolibarr=Record %s modified
DELETEInDolibarr=Record %s deleted
VALIDATEInDolibarr=Record %s validated
APPROVEDInDolibarr=Record %s approved

View File

@ -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.
*/

View File

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

View File

@ -1,6 +1,5 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
*/

View File

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