29include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
51 $this->rights_class =
'recruitment';
56 $this->module_position =
'44';
60 $this->
name = preg_replace(
'/^mod/i',
'', get_class($this));
62 $this->
description =
"Manage and follow recruitment campaign for new job positions";
64 $this->descriptionlong =
"Manage and follow recruitment campaign for new job positions";
66 $this->version =
'dolibarr';
71 $this->const_name =
'MAIN_MODULE_'.strtoupper($this->
name);
75 $this->picto =
'recruitmentjobposition';
77 $this->module_parts = array(
111 'moduleforexternal' => 0,
115 $this->dirs = array(
"/recruitment/temp");
117 $this->config_page_url = array(
"setup.php@recruitment");
120 $this->hidden =
false;
122 $this->depends = array();
123 $this->requiredby = array();
124 $this->conflictwith = array();
125 $this->langfiles = array(
"recruitment");
126 $this->phpmin = array(7, 0);
127 $this->need_dolibarr_version = array(11, -3);
128 $this->warnings_activation = array();
129 $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)) {
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' =>
'isModEnabled("recruitment")',
282 'perms' =>
'$user->hasRight("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' =>
'isModEnabled("recruitment")',
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' =>
'isModEnabled("recruitment")',
310 'perms' =>
'$user->hasRight("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' =>
'isModEnabled("recruitment")',
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 ($myTmpObjectArray[
'includedocgeneration']) {
420 $src = DOL_DOCUMENT_ROOT.
'/install/doctemplates/'.$moduledir.
'/template_recruitmentjobposition.odt';
421 $dirodt = DOL_DATA_ROOT.
'/doctemplates/'.$moduledir;
422 $dest = $dirodt.
'/template_recruitmentjobposition.odt';
424 if (file_exists($src) && !file_exists($dest)) {
425 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
427 $result =
dol_copy($src, $dest,
'0', 0);
429 $langs->load(
"errors");
430 $this->error = $langs->trans(
'ErrorFailToCopyFile', $src, $dest);
435 $sql = array_merge($sql, array(
436 "DELETE FROM ".MAIN_DB_PREFIX.
"document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey).
"' AND type = '".$this->db->escape(strtolower($myTmpObjectKey)).
"' AND entity = ".((
int)
$conf->entity),
437 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey).
"','".$this->db->escape(strtolower($myTmpObjectKey)).
"',".((
int)
$conf->entity).
")",
439 "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),
440 "INSERT INTO ".MAIN_DB_PREFIX.
"document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey).
"_odt', '".$this->db->escape(strtolower($myTmpObjectKey)).
"', ".((
int)
$conf->entity).
")"
445 return $this->
_init($sql, $options);
456 public function remove($options =
'')
459 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=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
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.