diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php
index a5e557ddfeb..2c1e0948e01 100644
--- a/htdocs/admin/emailcollector_card.php
+++ b/htdocs/admin/emailcollector_card.php
@@ -561,6 +561,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
'recordevent'=>'RecordEvent');
if ($conf->projet->enabled) $arrayoftypes['project'] = 'CreateLeadAndThirdParty';
if ($conf->ticket->enabled) $arrayoftypes['ticket'] = 'CreateTicketAndThirdParty';
+ if ($conf->recruitment->enabled) $arrayoftypes['candidature'] = 'CreateCandidature';
// support hook for add action
$parameters = array('arrayoftypes' => $arrayoftypes);
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 96c99ebba36..dc14e132e41 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -418,7 +418,11 @@ class FormMail extends Form
}
foreach ($this->param as $key=>$value)
{
- $out .= ''."\n";
+ if (is_array($value)) {
+ $out .= "\n";
+ } else {
+ $out .= ''."\n";
+ }
}
$modelmail_array = array();
@@ -1243,12 +1247,8 @@ class FormMail extends Form
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendShipping");
} elseif ($type_template == 'fichinter_send') {
$defaultmessage = $outputlangs->transnoentities("PredefinedMailContentSendFichInter");
- } elseif ($type_template == 'thirdparty') {
- $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentThirdparty");
- } elseif ($type_template == 'user') {
- $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentUser");
} elseif (!empty($type_template)) {
- $defaultmessage = $outputlangs->transnoentities("PredefinedMailContent".ucfirst($type_template));
+ $defaultmessage = $outputlangs->transnoentities("PredefinedMailContentGeneric");
}
$ret->label = 'default';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 1e4e973109b..3f6ed2b1d23 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -3009,7 +3009,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
}
} else {
$pictowithouttext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
- if (empty($srconly) && in_array($pictowithouttext, array(
+ if (empty($srconly) && in_array($pictowithouttext, array(
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'accountancy', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'bookmark', 'bom', 'building',
'cash-register', 'category', 'check', 'clock', 'close_title', 'company', 'contact', 'contract', 'cubes',
@@ -3025,7 +3025,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'object_margin', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment',
'object_lot', 'object_mrp', 'object_payment', 'object_product', 'object_propal',
'object_other', 'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask',
- 'object_recruitmentjobposition',
+ 'object_recruitmentjobposition', 'object_recruitmentcandidature',
'object_shipment', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock',
'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member',
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website',
@@ -3070,7 +3070,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square',
'playdisabled'=>'play', 'poll'=>'check-double', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature',
- 'recruitmentjobposition'=>'door-open', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
+ 'recruitmentjobposition'=>'door-open', 'recruitmentcandidature'=>'door-open',
+ 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
'resource'=>'laptop-house',
'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
@@ -3132,7 +3133,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4',
'holiday'=>'infobox-holiday', 'invoice'=>'infobox-commande',
'payment'=>'infobox-bank_account', 'poll'=>'infobox-adherent', 'project'=>'infobox-project', 'projecttask'=>'infobox-project', 'propal'=>'infobox-propal',
- 'recruitmentjobposition'=>'infobox-adherent', 'resource'=>'infobox-action',
+ 'recruitmentjobposition'=>'infobox-adherent', 'recruitmentcandidature'=>'infobox-adherent',
+ 'resource'=>'infobox-action',
'supplier_invoice'=>'infobox-order_supplier', 'supplier_invoicea'=>'infobox-order_supplier', 'supplier_invoiced'=>'infobox-order_supplier',
'supplier_order'=>'infobox-order_supplier', 'supplier_proposal'=>'infobox-supplier_proposal',
'ticket'=>'infobox-contrat', 'title_accountancy'=>'infobox-bank_account', 'title_hrm'=>'infobox-holiday', 'trip'=>'infobox-expensereport', 'title_agenda'=>'infobox-action',
diff --git a/htdocs/core/modules/modEmailCollector.class.php b/htdocs/core/modules/modEmailCollector.class.php
index 59320a959f9..44309e20d81 100644
--- a/htdocs/core/modules/modEmailCollector.class.php
+++ b/htdocs/core/modules/modEmailCollector.class.php
@@ -375,6 +375,34 @@ class modEmailCollector extends DolibarrModules
}
} else dol_print_error($this->db);
+ $tmpsql = "SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".$conf->entity;
+ $tmpresql = $this->db->query($tmpsql);
+ if ($tmpresql) {
+ if ($this->db->num_rows($tmpresql) == 0) {
+ $descriptionC1 = "This collector will scan your mailbox to find emails send for a recruitment (Module Recruitment must be enabled). You can complete this collector if you want to automaticallycreate a candidature for a job request.";
+ $descriptionC1 .= "Note: With this initial example, the title of the candidature is generated including the email.";
+
+ $sqlforexampleC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)";
+ $sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Candidatures', 'Example to collect leads', '".$this->db->escape($descriptionC1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)";
+
+ $sqlforexampleFilterC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
+ $sqlforexampleFilterC1 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".$conf->entity."), 'isnotanswer', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
+ $sqlforexampleFilterC2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)";
+ $sqlforexampleFilterC2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
+ $sqlforexampleFilterC3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)";
+ $sqlforexampleFilterC3 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".$conf->entity."), 'to', 'jobs@example.com', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
+
+ $sqlforexampleC4 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, actionparam, date_creation, fk_user_creat, status)";
+ $sqlforexampleC4 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Candidatures' and entity = ".$conf->entity."), 'candidature', 'tmp_from=EXTRACT:HEADER:^From:(.*);fk_recruitmentjobposition=EXTRACT:HEADER:^To:[^\n]*\+([^\n]*);description=EXTRACT:BODY:(.*);title=SET:Candidature from __tmp_from__ received by email', '".$this->db->idate(dol_now())."', ".$user->id.", 1)";
+
+ $sql[] = $sqlforexampleC1;
+ $sql[] = $sqlforexampleFilterC1;
+ $sql[] = $sqlforexampleFilterC2;
+ $sql[] = $sqlforexampleFilterC3;
+ $sql[] = $sqlforexampleC4;
+ }
+ } else dol_print_error($this->db);
+
return $this->_init($sql, $options);
}
diff --git a/htdocs/core/modules/modRecruitment.class.php b/htdocs/core/modules/modRecruitment.class.php
index 0cbe9da017b..d40d7a84a1c 100644
--- a/htdocs/core/modules/modRecruitment.class.php
+++ b/htdocs/core/modules/modRecruitment.class.php
@@ -243,17 +243,17 @@ class modRecruitment extends DolibarrModules
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
- $this->rights[$r][1] = 'Read job positions to fill'; // Permission label
+ $this->rights[$r][1] = 'Read job positions to fill and candidatures'; // Permission label
$this->rights[$r][4] = 'recruitmentjobposition'; // In php code, permission will be checked by test if ($user->rights->recruitment->level1->level2)
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->recruitment->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
- $this->rights[$r][1] = 'Create/Update job positions to fill'; // Permission label
+ $this->rights[$r][1] = 'Create/Update job positions to fill and candidatures'; // Permission label
$this->rights[$r][4] = 'recruitmentjobposition'; // In php code, permission will be checked by test if ($user->rights->recruitment->level1->level2)
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->recruitment->level1->level2)
$r++;
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
- $this->rights[$r][1] = 'Delete Job positions to fill'; // Permission label
+ $this->rights[$r][1] = 'Delete Job positions to fill and candidatures'; // Permission label
$this->rights[$r][4] = 'recruitmentjobposition'; // In php code, permission will be checked by test if ($user->rights->recruitment->level1->level2)
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->recruitment->level1->level2)
$r++;
@@ -283,19 +283,19 @@ class modRecruitment extends DolibarrModules
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
- 'titre'=>'PositionsToBeFilled',
+ 'titre'=>'NewPositionToBeFilled',
'mainmenu'=>'hrm',
- 'leftmenu'=>'recruitment_recruitmentjobposition',
- 'url'=>'/recruitment/recruitmentjobposition_list.php',
+ 'leftmenu'=>'recruitment_recruitmentjobposition_new',
+ 'url'=>'/recruitment/recruitmentjobposition_card.php?action=create',
'langs'=>'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000+$r,
'enabled'=>'$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
- 'perms'=>'$user->rights->recruitment->recruitmentjobposition->read', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules
+ 'perms'=>'$user->rights->recruitment->recruitmentjobposition->write', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);
$this->menu[$r++]=array(
- 'fk_menu'=>'fk_mainmenu=hrm,fk_leftmenu=recruitment_recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ 'fk_menu'=>'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'ListOfPositionsToBeFilled',
'mainmenu'=>'hrm',
@@ -309,12 +309,12 @@ class modRecruitment extends DolibarrModules
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);
$this->menu[$r++]=array(
- 'fk_menu'=>'fk_mainmenu=hrm,fk_leftmenu=recruitment_recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ 'fk_menu'=>'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
- 'titre'=>'NewPositionToBeFilled',
+ 'titre'=>'NewCandidature',
'mainmenu'=>'hrm',
- 'leftmenu'=>'recruitment_recruitmentjobposition_new',
- 'url'=>'/recruitment/recruitmentjobposition_card.php?action=create',
+ 'leftmenu'=>'recruitment_recruitmentcandidature_new',
+ 'url'=>'/recruitment/recruitmentcandidature_card.php?action=create',
'langs'=>'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000+$r,
'enabled'=>'$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
@@ -322,7 +322,20 @@ class modRecruitment extends DolibarrModules
'target'=>'',
'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
);
-
+ $this->menu[$r++]=array(
+ 'fk_menu'=>'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+ 'type'=>'left', // This is a Left menu entry
+ 'titre'=>'ListOfCandidatures',
+ 'mainmenu'=>'hrm',
+ 'leftmenu'=>'recruitment_recruitmentcandidature_list',
+ 'url'=>'/recruitment/recruitmentcandidature_list.php',
+ 'langs'=>'recruitment', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+ 'position'=>1000+$r,
+ 'enabled'=>'$conf->recruitment->enabled', // Define condition to show or hide menu entry. Use '$conf->recruitment->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+ 'perms'=>'$user->rights->recruitment->recruitmentjobposition->read', // Use 'perms'=>'$user->rights->recruitment->level1->level2' if you want your menu with a permission rules
+ 'target'=>'',
+ 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
+ );
/* END MODULEBUILDER LEFTMENU RECRUITMENTJOBPOSITION */
// Exports profiles provided by this module
diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php
index ba759eded31..93dee2ebda9 100644
--- a/htdocs/core/tpl/card_presend.tpl.php
+++ b/htdocs/core/tpl/card_presend.tpl.php
@@ -279,10 +279,10 @@ if ($action == 'presend')
}
}
- // Tableau des substitutions
+ // Array of substitutions
$formmail->substit = $substitutionarray;
- // Tableau des parametres complementaires
+ // Array of other parameters
$formmail->param['action'] = 'send';
$formmail->param['models'] = $modelmail;
$formmail->param['models_id'] = GETPOST('modelmailselected', 'int');
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index 7e5e1af1024..d89456981ea 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -1627,7 +1627,7 @@ class EmailCollector extends CommonObject
// Overwrite values with values extracted from source email
$errorforthisaction = $this->overwritePropertiesOfObject($actioncomm, $operation['actionparam'], $messagetext, $subject, $header);
-var_dump($actioncomm);
+
if ($errorforthisaction)
{
$errorforactions++;
@@ -1839,37 +1839,6 @@ var_dump($actioncomm);
}
$tickettocreate->ref = $defaultref;
}
- // Create event specific on hook
- // this code action is hook..... for support this call
- elseif (substr($operation['type'], 0, 4) == 'hook') {
- global $hookmanager;
-
- if (!is_object($hookmanager))
- $hookmanager->initHooks(array('emailcollectorcard'));
-
- $parameters = array(
- 'connection'=> $connection,
- 'imapemail'=>$imapemail,
- 'overview'=>$overview,
-
- 'from' => $from,
- 'fromtext' => $fromtext,
-
- 'actionparam'=> $operation['actionparam'],
-
- 'thirdpartyid' => $thirdpartyid,
- 'objectid'=> $objectid,
- 'objectemail'=> $objectemail,
-
- 'messagetext'=>$messagetext,
- 'subject'=>$subject,
- 'header'=>$header,
- );
- $res = $hookmanager->executeHooks('doCollectOneCollector', $parameters, $this, $operation['type']);
-
- if ($res < 0)
- $this->error = $hookmanager->resPrint;
- }
if ($errorforthisaction)
{
@@ -1891,6 +1860,143 @@ var_dump($actioncomm);
}
}
}
+ // Create candidature
+ elseif ($operation['type'] == 'candidature')
+ {
+ $candidaturetocreate = new RecruitmentCandidature($this->db);
+
+ $description = $descriptiontitle;
+ $description = dol_concatdesc($description, "-----");
+ $description = dol_concatdesc($description, $descriptionmeta);
+ $description = dol_concatdesc($description, "-----");
+ $description = dol_concatdesc($description, $messagetext);
+
+ $descriptionfull = $description;
+ $descriptionfull = dol_concatdesc($descriptionfull, "----- Header");
+ $descriptionfull = dol_concatdesc($descriptionfull, $header);
+
+ $candidaturetocreate->subject = $subject;
+ $candidaturetocreate->message = $description;
+ $candidaturetocreate->type_code = 0;
+ $candidaturetocreate->category_code = null;
+ $candidaturetocreate->severity_code = null;
+ $candidaturetocreate->origin_email = $from;
+ $candidaturetocreate->fk_user_create = $user->id;
+ $candidaturetocreate->datec = $date;
+ $candidaturetocreate->fk_project = $projectstatic->id;
+ $candidaturetocreate->notify_tiers_at_create = 0;
+ $candidaturetocreate->note_private = $descriptionfull;
+ $candidaturetocreate->entity = $conf->entity;
+ $candidaturetocreate->email_msgid = $msgid;
+ //$candidaturetocreate->fk_contact = $contactstatic->id;
+
+ // Overwrite values with values extracted from source email.
+ // This may overwrite any $projecttocreate->xxx properties.
+ $errorforthisaction = $this->overwritePropertiesOfObject($candidaturetocreate, $operation['actionparam'], $messagetext, $subject, $header);
+
+ // Set candidature ref if not yet defined
+ /*if (empty($candidaturetocreate->ref))
+ {
+ // Get next project Ref
+ $defaultref = '';
+ $modele = empty($conf->global->CANDIDATURE_ADDON) ? 'mod_candidature_simple' : $conf->global->CANDIDATURE_ADDON;
+
+ // Search template files
+ $file = ''; $classname = ''; $filefound = 0; $reldir = '';
+ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
+ foreach ($dirmodels as $reldir)
+ {
+ $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0);
+ if (file_exists($file))
+ {
+ $filefound = 1;
+ $classname = $modele;
+ break;
+ }
+ }
+
+ if ($filefound)
+ {
+ $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php');
+ $modCandidature = new $classname;
+
+ if ($savesocid > 0)
+ {
+ if ($savesocid != $candidaturetocreate->socid)
+ {
+ $errorforactions++;
+ setEventMessages('You loaded a thirdparty (id='.$savesocid.') and you force another thirdparty id (id='.$candidaturetocreate->socid.') by setting socid in operation with a different value', null, 'errors');
+ }
+ } else {
+ if ($candidaturetocreate->socid > 0)
+ {
+ $thirdpartystatic->fetch($candidaturetocreate->socid);
+ }
+ }
+
+ $defaultref = $modCandidature->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $tickettocreate);
+ }
+ $candidaturetocreate->ref = $defaultref;
+ }*/
+
+ if ($errorforthisaction)
+ {
+ $errorforactions++;
+ } else {
+ /*if (is_numeric($candidaturetocreate->ref) && $candidaturetocreate->ref <= 0)
+ {
+ $errorforactions++;
+ $this->error = 'Failed to create cancidature: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id;
+ } else {*/
+ // Create project
+ $result = $candidaturetocreate->create($user);
+ if ($result <= 0)
+ {
+ $errorforactions++;
+ $this->error = 'Failed to create ticket: '.$langs->trans($candidaturetocreate->error);
+ $this->errors = $candidaturetocreate->errors;
+ }
+ //}
+ }
+ }
+ // Create event specific on hook
+ // this code action is hook..... for support this call
+ elseif (substr($operation['type'], 0, 4) == 'hook') {
+ global $hookmanager;
+
+ if (!is_object($hookmanager)) {
+ $hookmanager->initHooks(array('emailcollectorcard'));
+ }
+
+ $parameters = array(
+ 'connection'=> $connection,
+ 'imapemail'=>$imapemail,
+ 'overview'=>$overview,
+
+ 'from' => $from,
+ 'fromtext' => $fromtext,
+
+ 'actionparam'=> $operation['actionparam'],
+
+ 'thirdpartyid' => $thirdpartyid,
+ 'objectid'=> $objectid,
+ 'objectemail'=> $objectemail,
+
+ 'messagetext'=>$messagetext,
+ 'subject'=>$subject,
+ 'header'=>$header,
+ );
+ $res = $hookmanager->executeHooks('doCollectOneCollector', $parameters, $this, $operation['type']);
+
+ if ($res < 0) {
+ $errorforthisaction++;
+ $this->error = $hookmanager->resPrint;
+ }
+ if ($errorforthisaction)
+ {
+ $errorforactions++;
+ }
+ }
if (!$errorforactions)
{
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 4066c8bf205..55c2d03f2c1 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
@@ -139,7 +139,7 @@ ALTER TABLE llx_recruitment_recruitmentjobposition_extrafields ADD INDEX idx_fk_
CREATE TABLE llx_recruitment_recruitmentcandidature(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
- fk_recruitmentjobposition INTEGER NOT NULL,
+ fk_recruitmentjobposition INTEGER NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
description text,
note_public text,
@@ -152,7 +152,9 @@ CREATE TABLE llx_recruitment_recruitmentcandidature(
model_pdf varchar(255),
status smallint NOT NULL,
firstname varchar(128),
- lastname varchar(128),
+ lastname varchar(128),
+ email varchar(255),
+ phone varchar(64),
remuneration_requested integer,
remuneration_proposed integer,
fk_recruitment_origin INTEGER NULL
diff --git a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.sql b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.sql
index 43bdb14e7bd..a635a11b8fe 100644
--- a/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.sql
+++ b/htdocs/install/mysql/tables/llx_recruitment_recruitmentcandidature.sql
@@ -17,7 +17,7 @@
CREATE TABLE llx_recruitment_recruitmentcandidature(
-- BEGIN MODULEBUILDER FIELDS
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
- fk_recruitmentjobposition INTEGER NOT NULL,
+ fk_recruitmentjobposition INTEGER NULL,
ref varchar(128) DEFAULT '(PROV)' NOT NULL,
description text,
note_public text,
@@ -31,6 +31,8 @@ CREATE TABLE llx_recruitment_recruitmentcandidature(
status smallint NOT NULL,
firstname varchar(128),
lastname varchar(128),
+ email varchar(255),
+ phone varchar(64),
remuneration_requested integer,
remuneration_proposed integer,
fk_recruitment_origin INTEGER NULL
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index a2b89101d16..fbbdf81ff93 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1950,6 +1950,7 @@ LoadThirdPartyFromName=Load third party searching on %s (load only)
LoadThirdPartyFromNameOrCreate=Load third party searching on %s (create if not found)
WithDolTrackingID=Message from a conversation initiated by a first email sent from Dolibarr
WithoutDolTrackingID=Message from a conversation initiated by a first email NOT sent from Dolibarr
+CreateCandidature=Create candidature
FormatZip=Zip
MainMenuCode=Menu entry code (mainmenu)
ECMAutoTree=Show automatic ECM tree
diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang
index aabc4f0472a..54c0572d453 100644
--- a/htdocs/langs/en_US/other.lang
+++ b/htdocs/langs/en_US/other.lang
@@ -97,11 +97,8 @@ PredefinedMailContentSendSupplierOrder=__(Hello)__\n\nPlease find our order __RE
PredefinedMailContentSendSupplierInvoice=__(Hello)__\n\nPlease find invoice __REF__ attached\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendShipping=__(Hello)__\n\nPlease find shipping __REF__ attached\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentSendFichInter=__(Hello)__\n\nPlease find intervention __REF__ attached\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
-PredefinedMailContentThirdparty=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
-PredefinedMailContentContact=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
-PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n
-PredefinedMailContentTicket_send=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
+PredefinedMailContentGeneric=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available.
ChooseYourDemoProfil=Choose the demo profile that best suits your needs...
ChooseYourDemoProfilMore=...or build your own profile
(manual module selection)
diff --git a/htdocs/langs/en_US/recruitment.lang b/htdocs/langs/en_US/recruitment.lang
index b4a7abbe825..aa4f12c1263 100644
--- a/htdocs/langs/en_US/recruitment.lang
+++ b/htdocs/langs/en_US/recruitment.lang
@@ -29,8 +29,8 @@ RecruitmentSetup = Recruitment setup
Settings = Settings
RecruitmentSetupPage = Enter here the setup of main options for the recruitment module
RecruitmentArea=Recruitement area
-PublicInterfaceRecruitmentDesc=Public interface is public URLs to show and answer to open jobs. There is one different link for each open job.
-EnablePublicRecruitmentPages=Enable public recruitment pages
+PublicInterfaceRecruitmentDesc=Public pages of jobs are public URLs to show and answer to open jobs. There is one different link for each open job, found on each job record.
+EnablePublicRecruitmentPages=Enable public pages of open jobs
#
# About page
@@ -54,4 +54,11 @@ JobOfferToBeFilled=Job offer to be filled
ThisIsInformationOnJobPosition=Information of the job position to be filled
ContactForRecruitment=Contact for recruitment
EmailRecruiter=Email recruiter
-ToUseAGenericEmail=To use a generic email. If not defined, the email of the responsible of recruitment will be used
\ No newline at end of file
+ToUseAGenericEmail=To use a generic email. If not defined, the email of the responsible of recruitment will be used
+NewCandidature=New candidature
+ListOfCandidatures=List of candidatures
+RequestedRemuneration=Requested remuneration
+ProposedRemuneration=Proposed remuneration
+ContractProposed=Contract proposed
+ContractSigned=Contract signed
+RecruitmentCandidature=Candidature
\ No newline at end of file
diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php
index 4a18ddf85fb..9968e62d063 100644
--- a/htdocs/recruitment/class/recruitmentcandidature.class.php
+++ b/htdocs/recruitment/class/recruitmentcandidature.class.php
@@ -56,11 +56,14 @@ class RecruitmentCandidature extends CommonObject
/**
* @var string String with name of icon for recruitmentcandidature. Must be the part after the 'object_' into object_recruitmentcandidature.png
*/
- public $picto = 'recruitmentcandidature@recruitment';
+ public $picto = 'recruitmentcandidature';
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
+ const STATUS_CONTRACT_PROPOSED = 3;
+ const STATUS_CONTRACT_SIGNED = 5;
+ const STATUS_REFUSED = 8;
const STATUS_CANCELED = 9;
@@ -96,22 +99,24 @@ class RecruitmentCandidature extends CommonObject
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
- 'fk_recruitmentjobposition' => array('type'=>'integer:RecruitmentJobPosition:recruitment/class/recruitment_recruitmentjobposition.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>15, 'notnull'=>1, 'visible'=>1, 'index'=>1),
- 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3,),
+ 'fk_recruitmentjobposition' => array('type'=>'integer:RecruitmentJobPosition:recruitment/class/recruitmentjobposition.class.php', 'label'=>'Job', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>1, 'index'=>1),
+ 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
+ 'lastname' => array('type'=>'varchar(128)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1,),
+ 'firstname' => array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>21, 'notnull'=>0, 'visible'=>1,),
+ 'email' => array('type'=>'varchar(255)', 'label'=>'EMail', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1,),
+ 'phone' => array('type'=>'varchar(64)', 'label'=>'Phone', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1,),
+ //'fk_recruitment_origin' => array('type'=>'integer:CRecruitmentOrigin:recruitment/class/crecruitmentorigin.class.php', 'label'=>'Origin', 'enabled'=>'1', 'position'=>45, 'visible'=>1, 'index'=>1),
+ 'remuneration_requested' => array('type'=>'integer', 'label'=>'RequestedRemuneration', 'enabled'=>'1', 'position'=>80, 'notnull'=>0, 'visible'=>-1,),
+ 'remuneration_proposed' => array('type'=>'integer', 'label'=>'ProposedRemuneration', 'enabled'=>'1', 'position'=>81, 'notnull'=>0, 'visible'=>-1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
- 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Canceled'),),
- 'firstname' => array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>20, 'notnull'=>0, 'visible'=>1,),
- 'lastname' => array('type'=>'varchar(128)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>21, 'notnull'=>0, 'visible'=>1,),
- 'remuneration_requested' => array('type'=>'integer', 'label'=>'RequestedRemuneration', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1,),
- 'remuneration_proposed' => array('type'=>'integer', 'label'=>'ProposedRemuneration', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1,),
- 'fk_recruitment_origin' => array('type'=>'integer:CRecruitmentOrigin:recruitment/class/recruitment_crecruitmentorigin.class.php', 'label'=>'Origin', 'enabled'=>'1', 'position'=>45, 'visible'=>1, 'index'=>1),
+ 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'default'=>0, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '3'=>'ContractProposed', '5'=>'ContractSigned', '8'=>'Refused', '9'=>'Canceled')),
);
public $rowid;
public $ref;
@@ -126,8 +131,10 @@ class RecruitmentCandidature extends CommonObject
public $import_key;
public $model_pdf;
public $status;
- public $firstname;
public $lastname;
+ public $firstname;
+ public $email;
+ public $phone;
public $remuneration_requested;
public $remuneration_proposed;
public $fk_recruitment_origin;
@@ -793,10 +800,16 @@ class RecruitmentCandidature extends CommonObject
global $langs;
//$langs->load("recruitment@recruitment");
$this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft');
- $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled');
+ $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Validated').' ('.$langs->trans("InterviewToDo").')';
+ $this->labelStatus[self::STATUS_CONTRACT_PROPOSED] = $langs->trans('ContractProposed');
+ $this->labelStatus[self::STATUS_CONTRACT_SIGNED] = $langs->trans('ContractSigned');
+ $this->labelStatus[self::STATUS_REFUSED] = $langs->trans('Refused');
+ $this->labelStatus[self::STATUS_REFUSED] = $langs->trans('Refused');
$this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled');
$this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft');
- $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled');
+ $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Validated');
+ $this->labelStatusShort[self::STATUS_CONTRACT_PROPOSED] = $langs->trans('ContractProposed');
+ $this->labelStatusShort[self::STATUS_CONTRACT_SIGNED] = $langs->trans('ContractSigned');
$this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Disabled');
}
@@ -967,7 +980,7 @@ class RecruitmentCandidature extends CommonObject
global $conf, $langs;
$result = 0;
- $includedocgeneration = 1;
+ $includedocgeneration = 0;
$langs->load("recruitment@recruitment");
diff --git a/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php
new file mode 100644
index 00000000000..44eb0bafe7c
--- /dev/null
+++ b/htdocs/recruitment/lib/recruitment_recruitmentcandidature.lib.php
@@ -0,0 +1,85 @@
+.
+ */
+
+/**
+ * \file lib/recruitment_recruitmentcandidature.lib.php
+ * \ingroup recruitment
+ * \brief Library files with common functions for RecruitmentCandidature
+ */
+
+/**
+ * Prepare array of tabs for RecruitmentCandidature
+ *
+ * @param RecruitmentJobPosition $object RecruitmentCandidature
+ * @return array Array of tabs
+ */
+function recruitmentCandidaturePrepareHead($object)
+{
+ global $db, $langs, $conf;
+
+ $langs->load("recruitment");
+
+ $h = 0;
+ $head = array();
+
+ $head[$h][0] = dol_buildpath("/recruitment/recruitmentcandidature_card.php", 1).'?id='.$object->id;
+ $head[$h][1] = $langs->trans("RecruitmentCandidature");
+ $head[$h][2] = 'card';
+ $h++;
+
+ if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
+ {
+ $nbNote = 0;
+ if (!empty($object->note_private)) $nbNote++;
+ if (!empty($object->note_public)) $nbNote++;
+ $head[$h][0] = dol_buildpath('/recruitment/recruitmentcandidature_note.php', 1).'?id='.$object->id;
+ $head[$h][1] = $langs->trans('Notes');
+ if ($nbNote > 0) $head[$h][1] .= ''.$nbNote.'';
+ $head[$h][2] = 'note';
+ $h++;
+ }
+
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+ require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
+ $upload_dir = $conf->recruitment->dir_output."/recruitmentcandidature/".dol_sanitizeFileName($object->ref);
+ $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
+ $nbLinks = Link::count($db, $object->element, $object->id);
+ $head[$h][0] = dol_buildpath("/recruitment/recruitmentcandidature_document.php", 1).'?id='.$object->id;
+ $head[$h][1] = $langs->trans('Documents');
+ if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ''.($nbFiles + $nbLinks).'';
+ $head[$h][2] = 'document';
+ $h++;
+
+ $head[$h][0] = dol_buildpath("/recruitment/recruitmentcandidature_agenda.php", 1).'?id='.$object->id;
+ $head[$h][1] = $langs->trans("Events");
+ $head[$h][2] = 'agenda';
+ $h++;
+
+ // Show more tabs from modules
+ // Entries must be declared in modules descriptor with line
+ //$this->tabs = array(
+ // 'entity:+tabname:Title:@recruitment:/recruitment/mypage.php?id=__ID__'
+ //); // to add new tab
+ //$this->tabs = array(
+ // 'entity:-tabname:Title:@recruitment:/recruitment/mypage.php?id=__ID__'
+ //); // to remove a tab
+ complete_head_from_modules($conf, $langs, $object, $head, $h, 'recruitmentcandidature');
+
+ complete_head_from_modules($conf, $langs, $object, $head, $h, 'recruitmentcandidature', 'remove');
+
+ return $head;
+}
diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php
new file mode 100644
index 00000000000..c2d3866feaf
--- /dev/null
+++ b/htdocs/recruitment/recruitmentcandidature_card.php
@@ -0,0 +1,612 @@
+
+ * Copyright (C) ---Put here your own copyright and developer email---
+ *
+ * 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
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see