27 if (!$res && !empty($_SERVER[
"CONTEXT_DOCUMENT_ROOT"])) {
28 $res = @include $_SERVER[
"CONTEXT_DOCUMENT_ROOT"].
"/main.inc.php";
31 $tmp = empty($_SERVER[
'SCRIPT_FILENAME']) ?
'' : $_SERVER[
'SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
32 while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
35 if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1)).
"/main.inc.php")) {
36 $res = @include substr($tmp, 0, ($i + 1)).
"/main.inc.php";
38 if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php")) {
39 $res = @include dirname(substr($tmp, 0, ($i + 1))).
"/main.inc.php";
42 if (!$res && file_exists(
"../../main.inc.php")) {
43 $res = @include
"../../main.inc.php";
45 if (!$res && file_exists(
"../../../main.inc.php")) {
46 $res = @include
"../../../main.inc.php";
49 die(
"Include of main fails");
55 require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
56 require_once DOL_DOCUMENT_ROOT.
'/recruitment/lib/recruitment.lib.php';
57 require_once DOL_DOCUMENT_ROOT.
"/recruitment/class/recruitmentjobposition.class.php";
60 $langs->loadLangs(array(
"admin",
"recruitment"));
68 $action =
GETPOST(
'action',
'aZ09');
69 $backtopage =
GETPOST(
'backtopage',
'alpha');
70 $modulepart =
GETPOST(
'modulepart',
'aZ09');
72 $value =
GETPOST(
'value',
'alpha');
73 $label =
GETPOST(
'label',
'alpha');
74 $scandir =
GETPOST(
'scan_dir',
'alpha');
75 $type =
'recruitmentcandidature';
77 $arrayofparameters = array(
90 if ((
float) DOL_VERSION >= 6) {
91 include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
94 if ($action ==
'updateMask') {
95 $maskconst =
GETPOST(
'maskconstcand',
'aZ09');
96 $maskvalue =
GETPOST(
'maskcand',
'alpha');
98 if ($maskconst && preg_match(
'/_MASK$/', $maskconst)) {
99 $res =
dolibarr_set_const($db, $maskconst, $maskvalue,
'chaine', 0,
'', $conf->entity);
111 } elseif ($action ==
'specimen') {
112 $modele =
GETPOST(
'module',
'alpha');
113 $tmpobjectkey =
GETPOST(
'object');
115 $tmpobject =
new $tmpobjectkey($db);
116 $tmpobject->initAsSpecimen();
119 $file =
''; $classname =
''; $filefound = 0;
120 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
121 foreach ($dirmodels as $reldir) {
122 $file =
dol_buildpath($reldir.
"core/modules/mymodule/doc/pdf_".$modele.
"_".strtolower($tmpobjectkey).
".modules.php", 0);
123 if (file_exists($file)) {
125 $classname =
"pdf_".$modele;
133 $module =
new $classname($db);
135 if ($module->write_file($tmpobject, $langs) > 0) {
136 header(
"Location: ".DOL_URL_ROOT.
"/document.php?modulepart=".strtolower($tmpobjectkey).
"&file=SPECIMEN.pdf");
144 dol_syslog($langs->trans(
"ErrorModuleNotFound"), LOG_ERR);
146 } elseif ($action ==
'set') {
149 } elseif ($action ==
'del') {
150 $tmpobjectkey =
GETPOST(
'object');
154 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
155 if ($conf->global->$constforval ==
"$value") {
159 } elseif ($action ==
'setmod') {
161 $tmpobjectkey =
GETPOST(
'object');
162 if (!empty($tmpobjectkey)) {
163 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
"_ADDON";
167 } elseif ($action ==
'setdoc') {
169 $tmpobjectkey =
GETPOST(
'object');
170 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
174 $conf->global->$constforval = $value;
182 } elseif ($action ==
'unsetdoc') {
183 $tmpobjectkey =
GETPOST(
'object');
184 if (!empty($tmpobjectkey)) {
185 $constforval =
'RECRUITMENT_'.strtoupper($tmpobjectkey).
'_ADDON_PDF';
198 $dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
200 $page_name =
"RecruitmentSetup";
201 llxHeader(
'', $langs->trans($page_name));
204 $linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
206 print
load_fiche_titre($langs->trans($page_name), $linkback,
'title_setup');
216 if ($action ==
'edit') {
217 print
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
218 print
'<input type="hidden" name="token" value="'.newToken().
'">';
219 print
'<input type="hidden" name="action" value="update">';
221 print
'<table class="noborder centpercent">';
222 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
224 foreach ($arrayofparameters as $key => $val) {
225 print
'<tr class="oddeven"><td>';
226 $tooltiphelp = (($langs->trans($key.
'Tooltip') != $key.
'Tooltip') ? $langs->trans($key.
'Tooltip') :
'');
227 print
$form->textwithpicto($langs->trans($key), $tooltiphelp);
228 print
'</td><td><input name="'.$key.
'" class="flat '.(empty($val[
'css']) ?
'minwidth200' : $val[
'css']).
'" value="'.
getDolGlobalString($key).
'"></td></tr>';
232 print
'<br><div class="center">';
233 print
'<input class="button button-save" type="submit" value="'.$langs->trans(
"Save").
'">';
239 if (!empty($arrayofparameters)) {
240 print
'<table class="noborder centpercent">';
241 print
'<tr class="liste_titre"><td class="titlefield">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"Value").
'</td></tr>';
243 foreach ($arrayofparameters as $key => $val) {
246 print
'<tr class="oddeven"><td>';
247 $tooltiphelp = (($langs->trans($key.
'Tooltip') != $key.
'Tooltip') ? $langs->trans($key.
'Tooltip') :
'');
248 print
$form->textwithpicto($langs->trans($key), $tooltiphelp);
249 print
'</td><td>'.getDolGlobalString($key).
'</td></tr>';
254 print
'<div class="tabsAction">';
255 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>';
261 $moduledir =
'recruitment';
262 $myTmpObjects = array();
263 $myTmpObjects[
'RecruitmentCandidature'] = array(
'includerefgeneration'=>1,
'includedocgeneration'=>0);
266 foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
267 if ($myTmpObjectArray[
'includerefgeneration']) {
273 print
load_fiche_titre($langs->trans(
"NumberingModules", $myTmpObjectKey),
'',
'');
275 print
'<table class="noborder centpercent">';
276 print
'<tr class="liste_titre">';
277 print
'<td>'.$langs->trans(
"Name").
'</td>';
278 print
'<td>'.$langs->trans(
"Description").
'</td>';
279 print
'<td class="nowrap">'.$langs->trans(
"Example").
'</td>';
280 print
'<td class="center" width="60">'.$langs->trans(
"Status").
'</td>';
281 print
'<td class="center" width="16">'.$langs->trans(
"ShortInfo").
'</td>';
286 foreach ($dirmodels as $reldir) {
290 $handle = opendir($dir);
291 if (is_resource($handle)) {
292 while (($file = readdir($handle)) !==
false) {
293 if (strpos($file,
'mod_'.strtolower($myTmpObjectKey).
'_') === 0 && substr($file,
dol_strlen($file) - 3, 3) ==
'php') {
294 $file = substr($file, 0,
dol_strlen($file) - 4);
296 require_once $dir.
'/'.$file.
'.php';
298 $module =
new $file($db);
301 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
304 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
308 if ($module->isEnabled()) {
309 dol_include_once(
'/'.$moduledir.
'/class/'.strtolower($myTmpObjectKey).
'.class.php');
311 print
'<tr class="oddeven"><td>'.$module->name.
"</td><td>\n";
312 print $module->info();
316 print
'<td class="nowrap">';
317 $tmp = $module->getExample();
318 if (preg_match(
'/^Error/', $tmp)) {
319 $langs->load(
"errors");
320 print
'<div class="error">'.$langs->trans($tmp).
'</div>';
321 } elseif ($tmp ==
'NotConfigured') {
322 print $langs->trans($tmp);
328 print
'<td class="center">';
329 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON';
331 print
img_picto($langs->trans(
"Activated"),
'switch_on');
333 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setmod&token='.
newToken().
'&object='.strtolower($myTmpObjectKey).
'&value='.urlencode($file).
'">';
334 print
img_picto($langs->trans(
"Disabled"),
'switch_off');
339 $mytmpinstance =
new $myTmpObjectKey($db);
340 $mytmpinstance->initAsSpecimen();
344 $htmltooltip .=
''.$langs->trans(
"Version").
': <b>'.$module->getVersion().
'</b><br>';
346 $nextval = $module->getNextValue($mytmpinstance);
347 if (
"$nextval" != $langs->trans(
"NotAvailable")) {
348 $htmltooltip .=
''.$langs->trans(
"NextValue").
': ';
350 if (preg_match(
'/^Error/', $nextval) || $nextval ==
'NotConfigured') {
351 $nextval = $langs->trans($nextval);
353 $htmltooltip .= $nextval.
'<br>';
355 $htmltooltip .= $langs->trans($module->error).
'<br>';
359 print
'<td class="center">';
360 print
$form->textwithpicto(
'', $htmltooltip, 1, 0);
371 print
"</table><br>\n";
374 if ($myTmpObjectArray[
'includedocgeneration']) {
379 $type = strtolower($myTmpObjectKey);
381 print
load_fiche_titre($langs->trans(
"DocumentModules", $myTmpObjectKey),
'',
'');
386 $sql .=
" FROM ".MAIN_DB_PREFIX.
"document_model";
387 $sql .=
" WHERE type = '".$db->escape($type).
"'";
388 $sql .=
" AND entity = ".$conf->entity;
389 $resql = $db->query($sql);
392 $num_rows = $db->num_rows(
$resql);
393 while ($i < $num_rows) {
394 $array = $db->fetch_array(
$resql);
395 array_push($def, $array[0]);
403 print
"<table class=\"noborder\" width=\"100%\">\n";
404 print
"<tr class=\"liste_titre\">\n";
405 print
'<td>'.$langs->trans(
"Name").
'</td>';
406 print
'<td>'.$langs->trans(
"Description").
'</td>';
407 print
'<td class="center" width="60">'.$langs->trans(
"Status").
"</td>\n";
408 print
'<td class="center" width="60">'.$langs->trans(
"Default").
"</td>\n";
409 print
'<td class="center" width="38">'.$langs->trans(
"ShortInfo").
'</td>';
410 print
'<td class="center" width="38">'.$langs->trans(
"Preview").
'</td>';
415 foreach ($dirmodels as $reldir) {
416 foreach (array(
'',
'/doc') as $valdir) {
417 $realpath = $reldir.
"core/modules/".$moduledir.$valdir;
421 $handle = opendir($dir);
422 if (is_resource($handle)) {
423 while (($file = readdir($handle)) !==
false) {
429 foreach ($filelist as $file) {
430 if (preg_match(
'/\.modules\.php$/i', $file) && preg_match(
'/^(pdf_|doc_)/', $file)) {
431 if (file_exists($dir.
'/'.$file)) {
432 $name = substr($file, 4,
dol_strlen($file) - 16);
433 $classname = substr($file, 0,
dol_strlen($file) - 12);
435 require_once $dir.
'/'.$file;
436 $module =
new $classname($db);
438 $modulequalified = 1;
439 if ($module->version ==
'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
440 $modulequalified = 0;
442 if ($module->version ==
'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
443 $modulequalified = 0;
446 if ($modulequalified) {
447 print
'<tr class="oddeven"><td width="100">';
448 print (empty($module->name) ? $name : $module->name);
450 if (method_exists($module,
'info')) {
451 print $module->info($langs);
453 print $module->description;
458 if (in_array($name, $def)) {
459 print
'<td class="center">'.
"\n";
460 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=del&token='.
newToken().
'&value='.urlencode($name).
'">';
461 print
img_picto($langs->trans(
"Enabled"),
'switch_on');
465 print
'<td class="center">'.
"\n";
466 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=set&token='.
newToken().
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'">'.
img_picto($langs->trans(
"Disabled"),
'switch_off').
'</a>';
471 print
'<td class="center">';
472 $constforvar =
'RECRUITMENT_'.strtoupper($myTmpObjectKey).
'_ADDON';
476 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=unsetdoc&token='.
newToken().
'&object='.urlencode(strtolower($myTmpObjectKey)).
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'&type='.urlencode($type).
'" alt="'.$langs->trans(
"Disable").
'">'.
img_picto($langs->trans(
"Enabled"),
'on').
'</a>';
478 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=setdoc&token='.
newToken().
'&object='.urlencode(strtolower($myTmpObjectKey)).
'&value='.urlencode($name).
'&scan_dir='.urlencode($module->scandir).
'&label='.urlencode($module->name).
'" alt="'.$langs->trans(
"Default").
'">'.
img_picto($langs->trans(
"Disabled"),
'off').
'</a>';
483 $htmltooltip =
''.$langs->trans(
"Name").
': '.$module->name;
484 $htmltooltip .=
'<br>'.$langs->trans(
"Type").
': '.($module->type ? $module->type : $langs->trans(
"Unknown"));
485 if ($module->type ==
'pdf') {
486 $htmltooltip .=
'<br>'.$langs->trans(
"Width").
'/'.$langs->trans(
"Height").
': '.$module->page_largeur.
'/'.$module->page_hauteur;
488 $htmltooltip .=
'<br>'.$langs->trans(
"Path").
': '.preg_replace(
'/^\//',
'', $realpath).
'/'.$file;
490 $htmltooltip .=
'<br><br><u>'.$langs->trans(
"FeaturesSupported").
':</u>';
491 $htmltooltip .=
'<br>'.$langs->trans(
"Logo").
': '.
yn($module->option_logo, 1, 1);
492 $htmltooltip .=
'<br>'.$langs->trans(
"MultiLanguage").
': '.
yn($module->option_multilang, 1, 1);
494 print
'<td class="center">';
495 print
$form->textwithpicto(
'', $htmltooltip, 1, 0);
499 print
'<td class="center">';
500 if ($module->type ==
'pdf') {
501 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?action=specimen&module='.$name.
'&object='.$myTmpObjectKey.
'">'.
img_object($langs->trans(
"Preview"),
'generic').
'</a>';
503 print
img_object($langs->trans(
"PreviewNotAvailable"),
'generic');
521 if (empty($setupnotempty)) {
522 print
'<br>'.$langs->trans(
"NothingToSetup");
addDocumentModel($name, $type, $label='', $description='')
Add document model used by doc generator.
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
delDocumentModel($name, $type)
Delete document model used by doc generator.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
recruitmentAdminPrepareHead()
Prepare admin pages header.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.