28include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
50 $this->rights_class =
'recruitment';
55 $this->module_position =
'44';
59 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
61 $this->
description =
"Manage and follow recruitment campaign for new job positions";
63 $this->descriptionlong =
"Manage and follow recruitment campaign for new job positions";
65 $this->version =
'dolibarr';
70 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
74 $this->picto =
'recruitmentjobposition';
76 $this->module_parts = array(
110 'moduleforexternal' => 0,
114 $this->dirs = array(
"/recruitment/temp");
116 $this->config_page_url = array(
"setup.php@recruitment");
119 $this->hidden =
false;
121 $this->depends = array();
122 $this->requiredby = array();
123 $this->conflictwith = array();
124 $this->langfiles = array(
"recruitment");
125 $this->phpmin = array(7, 0);
126 $this->need_dolibarr_version = array(11, -3);
127 $this->warnings_activation = array();
128 $this->warnings_activation_ext = array();
138 $this->
const[$r][0] =
"RECRUITMENT_RECRUITMENTJOBPOSITION_ADDON";
139 $this->
const[$r][1] =
"chaine";
140 $this->
const[$r][2] =
"mod_recruitmentjobposition_standard";
141 $this->
const[$r][3] =
'Name of manager to generate recruitment job position ref number';
142 $this->
const[$r][4] = 0;
145 $this->
const[$r][0] =
"RECRUITMENT_RECRUITMENTCANDIDATURE_ADDON";
146 $this->
const[$r][1] =
"chaine";
147 $this->
const[$r][2] =
"mod_recruitmentcandidature_standard";
148 $this->
const[$r][3] =
'Name of manager to generate recruitment candidature ref number';
149 $this->
const[$r][4] = 0;
158 if (!isset($conf->recruitment) || !isset($conf->recruitment->enabled)) {
159 $conf->recruitment =
new stdClass();
160 $conf->recruitment->enabled = 0;
164 $this->tabs = array();
192 $this->dictionaries = array();
196 $this->boxes = array(
207 $this->cronjobs = array(
229 $this->rights = array();
233 $this->rights[$r][0] = $this->numero + $r;
234 $this->rights[$r][1] =
'Read job positions to fill and candidatures';
235 $this->rights[$r][4] =
'recruitmentjobposition';
236 $this->rights[$r][5] =
'read';
238 $this->rights[$r][0] = $this->numero + $r;
239 $this->rights[$r][1] =
'Create/Update job positions to fill and candidatures';
240 $this->rights[$r][4] =
'recruitmentjobposition';
241 $this->rights[$r][5] =
'write';
243 $this->rights[$r][0] = $this->numero + $r;
244 $this->rights[$r][1] =
'Delete Job positions to fill and candidatures';
245 $this->rights[$r][4] =
'recruitmentjobposition';
246 $this->rights[$r][5] =
'delete';
251 $this->menu = array();
257 $this->menu[$r++] = array(
258 'fk_menu'=>
'fk_mainmenu=hrm',
260 'titre'=>
'Recruitment',
261 'prefix' =>
img_picto(
'', $this->picto,
'class="paddingright pictofixedwidth"'),
263 'leftmenu'=>
'recruitmentjobposition',
264 'url'=>
'/recruitment/index.php',
265 'langs'=>
'recruitment',
266 'position'=>1000 + $r,
267 'enabled'=>
'$conf->recruitment->enabled',
268 'perms'=>
'$user->hasRight("recruitment", "recruitmentjobposition", "read")',
272 $this->menu[$r++] = array(
273 'fk_menu'=>
'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition',
275 'titre'=>
'NewPositionToBeFilled',
277 'leftmenu'=>
'recruitment_recruitmentjobposition_new',
278 'url'=>
'/recruitment/recruitmentjobposition_card.php?action=create',
279 'langs'=>
'recruitment',
280 'position'=>1000 + $r,
281 'enabled'=>
'$conf->recruitment->enabled',
282 'perms'=>
'$user->rights->recruitment->recruitmentjobposition->write',
286 $this->menu[$r++] = array(
287 'fk_menu'=>
'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition',
289 'titre'=>
'ListOfPositionsToBeFilled',
291 'leftmenu'=>
'recruitment_recruitmentjobposition_list',
292 'url'=>
'/recruitment/recruitmentjobposition_list.php',
293 'langs'=>
'recruitment',
294 'position'=>1000 + $r,
295 'enabled'=>
'$conf->recruitment->enabled',
296 'perms'=>
'$user->hasRight("recruitment", "recruitmentjobposition", "read")',
300 $this->menu[$r++] = array(
301 'fk_menu'=>
'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition',
303 'titre'=>
'NewCandidature',
305 'leftmenu'=>
'recruitment_recruitmentcandidature_new',
306 'url'=>
'/recruitment/recruitmentcandidature_card.php?action=create',
307 'langs'=>
'recruitment',
308 'position'=>1000 + $r,
309 'enabled'=>
'$conf->recruitment->enabled',
310 'perms'=>
'$user->rights->recruitment->recruitmentjobposition->write',
314 $this->menu[$r++] = array(
315 'fk_menu'=>
'fk_mainmenu=hrm,fk_leftmenu=recruitmentjobposition',
317 'titre'=>
'ListOfCandidatures',
319 'leftmenu'=>
'recruitment_recruitmentcandidature_list',
320 'url'=>
'/recruitment/recruitmentcandidature_list.php',
321 'langs'=>
'recruitment',
322 'position'=>1000 + $r,
323 'enabled'=>
'$conf->recruitment->enabled',
324 'perms'=>
'$user->hasRight("recruitment", "recruitmentjobposition", "read")',
390 public function init($options =
'')
392 global $conf, $langs;
394 $result = $this->
_load_tables(
'/install/mysql/',
'recruitment');
409 $this->
remove($options);
414 $moduledir =
'recruitment';
415 $myTmpObjects = array();
416 $myTmpObjects[
'RecruitmentJobPosition'] = array(
'includerefgeneration'=>1,
'includedocgeneration'=>1);
418 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
419 if ($myTmpObjectKey ==
'MyObject') {
422 if ($myTmpObjectArray[
'includedocgeneration']) {
423 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/'.$moduledir.
'/template_recruitmentjobposition.odt';
424 $dirodt = DOL_DATA_ROOT.
'/doctemplates/'.$moduledir;
425 $dest = $dirodt.
'/template_recruitmentjobposition.odt';
427 if (file_exists($src) && !file_exists($dest)) {
428 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
430 $result =
dol_copy($src, $dest, 0, 0);
432 $langs->load(
"errors");
433 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
438 $sql = array_merge($sql, array(
439 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
440 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->db->escape(strtolower($myTmpObjectKey)).
"',".((
int) $conf->entity).
")",
442 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey).
"_odt' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int) $conf->entity),
443 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int) $conf->entity).
")"
448 return $this->
_init($sql, $options);
459 public function remove($options =
'')
462 return $this->
_remove($sql, $options);
_init($array_sql, $options='')
Enables a module.
_remove($array_sql, $options='')
Disable function.
_load_tables($reldir, $onlywithsuffix='')
Create tables and keys required by module:
Description and activation class for module Recruitment.
init($options='')
Function called when module is enabled.
__construct($db)
Constructor.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvirus=0, $indexdatabase=0)
Copy a file to another file.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
$conf db name
Only used if Module[ID]Name translation string is not found.