26if (!defined(
'NOLOGIN')) {
29if (!defined(
'NOCSRFCHECK')) {
30 define(
"NOCSRFCHECK", 1);
32if (!defined(
'NOIPCHECK')) {
33 define(
'NOIPCHECK',
'1');
35if (!defined(
'NOBROWSERNOTIF')) {
36 define(
'NOBROWSERNOTIF',
'1');
42$entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
43if (is_numeric($entity)) {
44 define(
"DOLENTITY", $entity);
48require
'../../main.inc.php';
60require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
63require_once DOL_DOCUMENT_ROOT.
'/core/lib/security.lib.php';
64require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
65require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
66require_once DOL_DOCUMENT_ROOT .
'/core/lib/public.lib.php';
67require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
71$langs->loadLangs(array(
"companies",
"other",
"recruitment",
"mails"));
74$action =
GETPOST(
'action',
'aZ09');
75$cancel =
GETPOST(
'cancel',
'alpha');
76$email =
GETPOST(
'email',
'alpha');
77$firstname =
GETPOST(
'firstname',
'alpha');
78$lastname =
GETPOST(
'lastname',
'alpha');
79$birthday =
GETPOST(
'birthday',
'alpha');
80$phone =
GETPOST(
'phone',
'alpha');
81$message =
GETPOST(
'message',
'alpha');
82$SECUREKEY =
GETPOST(
"securekey");
83$requestedremuneration =
GETPOST(
'requestedremuneration',
'alpha');
84$suffix =
GETPOST(
"suffix",
'alpha');
89 unset($_SESSION[
'email_customer']);
91if (isset($_SESSION[
'email_customer'])) {
92 $email = $_SESSION[
'email_customer'];
98 print $langs->trans(
'ErrorBadParameters').
" - ref missing";
106$urlwithroot = DOL_MAIN_URL_ROOT;
107$backtopage = $urlwithroot.
'/public/recruitment/index.php';
116 $langs->load(
"errors");
117 print
'<div class="error">'.$langs->trans(
'ErrorPublicInterfaceNotEnabled').
'</div>';
123if (!is_object($user)) {
124 $user =
new User($db);
129 $langs->load(
"errors");
132$user->loadDefaultValues();
139 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
142 $dirModCaptcha = array_merge(
144 'main' =>
'/core/modules/security/captcha/'
146 is_array($conf->modules_parts[
'captcha']) ? $conf->modules_parts[
'captcha'] : array()
148 $fullpathclassfile =
'';
149 foreach ($dirModCaptcha as $dir) {
150 $fullpathclassfile =
dol_buildpath($dir.
"modCaptcha".ucfirst($captcha).
'.class.php', 0, 2);
151 if ($fullpathclassfile) {
155 if ($fullpathclassfile) {
156 include_once $fullpathclassfile;
158 $classname =
"modCaptcha".ucfirst($captcha);
159 if (class_exists($classname)) {
160 $captchaobj =
new $classname($db, $conf, $langs, $user);
161 '@phan-var-force ModeleCaptcha $captchaobj';
164 print
'Error, the captcha handler class '.$classname.
' was not found after the include';
167 print
'Error, the captcha handler '.$captcha.
' has no class file found modCaptcha'.ucfirst($captcha);
176 if (!empty($backtopage)) {
177 header(
"Location: ".$backtopage);
182if ($action ==
"dosubmit") {
187 array_push(
$object->errors, $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")));
196 if (!strlen($email)) {
198 array_push(
$object->errors, $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Email")));
203 array_push(
$object->errors, $langs->trans(
"ErrorEmailInvalid"));
207 if (!strlen($lastname)) {
209 array_push(
$object->errors, $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")));
215 if (
getDolGlobalString(
'MAIN_SECURITY_ENABLECAPTCHA_RECRUITMENT') && is_object($captchaobj)) {
216 if (method_exists($captchaobj,
'validateCodeAfterLoginSubmit')) {
217 $ok = $captchaobj->validateCodeAfterLoginSubmit();
219 print
'Error, the captcha handler '.get_class($captchaobj).
' does not have any method validateCodeAfterLoginSubmit()';
223 $langs->load(
'errors');
224 array_push(
$object->errors, $langs->trans(
"ErrorBadValueForCode"));
229 $sql =
"SELECT rrc.rowid FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rrc";
230 $sql .=
" WHERE rrc.email = '". $db->escape($email).
"'";
232 $resql = $db->query($sql);
234 $num = $db->num_rows($resql);
237 setEventMessages($langs->trans(
"ErrorRecruitmmentCandidatureAlreadyExists", $email),
null,
'errors');
250 $candidature->firstname =
GETPOST(
'firstname',
'alpha');
251 $candidature->lastname =
GETPOST(
'lastname',
'alpha');
252 $candidature->email =
GETPOST(
'email',
'alpha');
253 $candidature->phone =
GETPOST(
'phone',
'alpha');
254 $candidature->date_birth =
GETPOST(
'birthday',
'alpha');
255 $candidature->requestedremuneration =
GETPOST(
'requestedremuneration',
'alpha');
256 $candidature->description =
GETPOST(
'message',
'alpha');
257 $candidature->fk_recruitmentjobposition =
$object->id;
262 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
266 $errmsg .= implode(
'<br>', $candidature->errors);
270 $extrafields->fetch_name_optionals_label($candidature->table_element);
271 $ret = $extrafields->setOptionalsFromPost(
null, $candidature);
274 $errmsg .= $candidature->error;
278 $result = $candidature->create($user);
281 $errmsg .= implode(
'<br>', $candidature->errors);
285 $candidature->validate($user);
288 $errmsg .= implode(
'<br>', $candidature->errors);
296 header(
"Location: " . $backtopage);
305$triggersendname =
'CANDIDATURE_SENTBYMAIL';
307$autocopy =
'MAIN_MAIL_AUTOCOPY_CANDIDATURE_TO';
308$trackid =
'recruitmentcandidature'.$object->id;
309include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
316$form =
new Form($db);
321 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'MAIN_RECRUITMENT_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
324$conf->dol_hide_topmenu = 1;
325$conf->dol_hide_leftmenu = 1;
328 $langs->load(
"errors");
329 print
'<div class="error">'.$langs->trans(
'ErrorPublicInterfaceNotEnabled').
'</div>';
335$arrayofcss = array();
337$replacemainarea = (empty($conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
338llxHeader($head, $langs->trans(
"PositionToBeFilled"),
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea, 1, 1);
341print
'<span id="dolpaymentspan"></span>'.
"\n";
342print
'<div class="center">'.
"\n";
343print
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
344print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
345print
'<input type="hidden" name="action" value="dosubmit">'.
"\n";
346print
'<input type="hidden" name="tag" value="'.GETPOST(
"tag",
'alpha').
'">'.
"\n";
347print
'<input type="hidden" name="suffix" value="'.$suffix.
'">'.
"\n";
348print
'<input type="hidden" name="securekey" value="'.$SECUREKEY.
'">'.
"\n";
349print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
351print
'<!-- Form to view job -->'.
"\n";
355$logosmall =
$mysoc->logo_small;
357$paramlogo =
'ONLINE_RECRUITMENT_LOGO_'.$suffix;
367if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$logosmall)) {
368 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
369 $urllogofull =
$dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
370} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$logo)) {
371 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
372 $urllogofull =
$dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
376 print
'<div class="backgreypublicpayment">';
377 print
'<div class="logopublicpayment">';
378 if (!empty(
$mysoc->url)) {
379 print
'<a href="'.$mysoc->url.
'" target="_blank" rel="noopener">';
381 print
'<img id="dolpaymentlogo" src="'.$urllogofull.
'">';
382 if (!empty(
$mysoc->url)) {
387 print
'<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans(
"PoweredBy").
'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.
'/theme/dolibarr_logo.svg" width="80px"></a></div>';
393 print
'<div class="backimagepublicrecruitment">';
394 print
'<img id="idRECRUITMENT_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'RECRUITMENT_IMAGE_PUBLIC_INTERFACE').
'">';
399print
'<table id="dolpaymenttable" summary="Job position offer" class="center">'.
"\n";
405 if (preg_match(
'/^\((.*)\)$/', $conf->global->RECRUITMENT_NEWFORM_TEXT, $reg)) {
406 $text .= $langs->trans($reg[1]).
"<br>\n";
410 $text =
'<tr><td align="center"><br>'.$text.
'<br></td></tr>'.
"\n";
413 $text .=
'<tr><td class="textpublicpayment" colspan=2><br>'.$langs->trans(
"JobOfferToBeFilled",
$mysoc->name);
414 $text .=
' - <strong>'.$mysoc->name.
'</strong>';
415 $text .=
' - <span class="nowraponall"><span class="fa fa-calendar secondary"></span> '.dol_print_date(
$object->date_creation).
'</span>';
416 $text .=
'</td></tr>'.
"\n";
417 $text .=
'<tr><td class="textpublicpayment" colspan=2><h1 class="paddingleft paddingright">'.$object->label.
'</h1><br></td></tr>'.
"\n";
422print
'<tr><td class="left" colspan=2>';
424print
'<div with="100%" id="tablepublicpayment">';
425print
'<div class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnJobPosition").
' :</div>'.
"\n";
433print $langs->trans(
"Label").
' : ';
434print
'<b>'.dol_escape_htmltag(
$object->label).
'</b><br>';
437print $langs->trans(
"DateExpected").
' : ';
439if (
$object->date_planned > $now) {
442 print $langs->trans(
"ASAP");
447print $langs->trans(
"Remuneration").
' : ';
453$tmpuser =
new User($db);
454$tmpuser->fetch(
$object->fk_user_recruiter);
456print $langs->trans(
"ContactForRecruitment").
' : ';
457$emailforcontact =
$object->email_recruiter;
458if (empty($emailforcontact)) {
459 $emailforcontact = $tmpuser->email ??
'';
460 if (empty($emailforcontact)) {
461 $emailforcontact =
$mysoc->email ??
'';
464print
'<b class="wordbreak">';
465print $tmpuser->getFullName($langs);
466print
' '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0,
'envelope');
471 print
info_admin($langs->trans(
"JobClosedTextCandidateFound"), 0, 0,
'0',
'warning');
474 print
info_admin($langs->trans(
"JobClosedTextCanceled"), 0, 0,
'0',
'warning');
483print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
489if ($action !=
'dosubmit') {
490 if ($found && !$error) {
492 print
'</td></tr>'.
"\n";
493 print
'<tr><td class="titlefieldcreate fieldrequired left">'.$langs->trans(
"Lastname").
'</td><td class="left">';
494 print
'<input type="text" class="flat minwidth400 --success" name="lastname" maxlength="128" value="'.$lastname.
'">';
495 print
'</td></tr>'.
"\n";
497 print
'<tr><td class="titlefieldcreate left">'.$langs->trans(
"Firstname").
'</td><td class="left">';
498 print
'<input type="text" class="flat minwidth400 --success" name="firstname" maxlength="128" value="'.$firstname.
'">';
499 print
'</td></tr>'.
"\n";
501 print
'<tr><td class="titlefieldcreate fieldrequired left">'.$langs->trans(
"Email").
'</td><td class="left">';
502 print
img_picto(
"",
"email",
'class="pictofixedwidth"').
'<input type="text" class="flat minwidth100 --success" name="email" value="'.$email.
'">';
503 print
'</td></tr>'.
"\n";
505 print
'<tr><td class="titlefieldcreate left">'.$langs->trans(
"Phone").
'</td><td class="left">';
506 print
img_picto(
"",
"phone",
'class="pictofixedwidth"').
'<input type="text" class="flat minwidth100 --success" name="phone" value="'.$phone.
'">';
507 print
'</td></tr>'.
"\n";
509 print
'<tr><td class="titlefieldcreate left minwidth300">'.$langs->trans(
"DateOfBirth").
'</td><td class="left">';
510 print $form->selectDate($birthday,
'birthday', 0, 0, 1,
"", 1, 0);
511 print
'</td></tr>'.
"\n";
513 print
'<tr><td class="titlefieldcreate left">'.$langs->trans(
"RequestedRemuneration").
'</td><td class="left">';
514 print
'<input type="text" class="flat minwidth100 --success" name="requestedremuneration" value="'.$requestedremuneration.
'">';
515 print
'</td></tr>'.
"\n";
519 $parameters[
'tpl_context'] =
'public';
520 $parameters[
'tdclass'] =
'left';
521 $extrafields->fetch_name_optionals_label(
"recruitment_recruitmentcandidature");
522 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
524 print
'<tr><td class="titlefieldcreate left">'.$langs->trans(
"Message").
'</td><td class="left">';
525 print
'<textarea class="flat quatrevingtpercent" rows="'.ROWS_5.
'" name="message">'.$message.
'</textarea>';
526 print
'</td></tr>'.
"\n";
529 if (
getDolGlobalString(
'MAIN_SECURITY_ENABLECAPTCHA_RECRUITMENT') && is_object($captchaobj)) {
530 print
'<tr><td class="titlefield"><label><span class="fieldrequired">'.$langs->trans($captchaobj->getFieldInputTitle()).
'</span></label></td><td><br>';
531 if (method_exists($captchaobj,
'getCaptchaCodeForForm')) {
532 print $captchaobj->getCaptchaCodeForForm(
'');
534 print
'Error, the captcha handler '.get_class($captchaobj).
' does not have any method getCaptchaCodeForForm()';
536 print
'<br></td></tr>';
538 print
'<tr><td colspan=2>';
539 print $form->buttonsSaveCancel(
'Submit',
'Cancel');
540 print
'</td></tr>'.
"\n";
548print
'</td></tr>'.
"\n";
550print
'</table>'.
"\n";
if(! $sortfield) if(! $sortorder) $object
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class for RecruitmentCandidature.
Class for RecruitmentJobPosition.
const STATUS_VALIDATED
Validated.
const STATUS_RECRUITED
Recruited.
const STATUS_CANCELED
Canceled.
const STATUS_DRAFT
Draft status.
Class to manage Dolibarr users.
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML public pages.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error_email($prefixcode, $errormessage='', $errormessages=array(), $morecss='error', $email='')
Show a public email and error code to contact if technical error.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
checkNbPostsForASpeceificIp($object, $nb_post_max)
Check if the object exceeded the number of posts for a specific ip in the same week.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.