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));
43define(
"DOLENTITY", $entity);
46require
'../../main.inc.php';
58require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentjobposition.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/recruitment/class/recruitmentcandidature.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/lib/security.lib.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
63require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
64require_once DOL_DOCUMENT_ROOT .
'/core/lib/public.lib.php';
65require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
69$langs->loadLangs(array(
"companies",
"other",
"recruitment",
"mails"));
72$action =
GETPOST(
'action',
'aZ09');
73$cancel =
GETPOST(
'cancel',
'alpha');
74$email =
GETPOST(
'email',
'alpha');
75$firstname =
GETPOST(
'firstname',
'alpha');
76$lastname =
GETPOST(
'lastname',
'alpha');
77$birthday =
GETPOST(
'birthday',
'alpha');
78$phone =
GETPOST(
'phone',
'alpha');
79$message =
GETPOST(
'message',
'alpha');
80$SECUREKEY =
GETPOST(
"securekey");
81$requestedremuneration =
GETPOST(
'requestedremuneration',
'alpha');
82$suffix =
GETPOST(
"suffix",
'alpha');
87 unset($_SESSION[
'email_customer']);
89if (isset($_SESSION[
'email_customer'])) {
90 $email = $_SESSION[
'email_customer'];
96 print $langs->trans(
'ErrorBadParameters').
" - ref missing";
104$urlwithroot = DOL_MAIN_URL_ROOT;
105$backtopage = $urlwithroot.
'/public/recruitment/index.php';
114 $langs->load(
"errors");
115 print
'<div class="error">'.$langs->trans(
'ErrorPublicInterfaceNotEnabled').
'</div>';
121if (!is_object($user)) {
122 $user =
new User($db);
127 $langs->load(
"errors");
130$user->loadDefaultValues();
137 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
140 $dirModCaptcha = array_merge(
142 'main' =>
'/core/modules/security/captcha/'
144 is_array(
$conf->modules_parts[
'captcha']) ?
$conf->modules_parts[
'captcha'] : array()
146 $fullpathclassfile =
'';
147 foreach ($dirModCaptcha as $dir) {
148 $fullpathclassfile =
dol_buildpath($dir.
"modCaptcha".ucfirst($captcha).
'.class.php', 0, 2);
149 if ($fullpathclassfile) {
153 if ($fullpathclassfile) {
154 include_once $fullpathclassfile;
156 $classname =
"modCaptcha".ucfirst($captcha);
157 if (class_exists($classname)) {
158 $captchaobj =
new $classname($db,
$conf, $langs, $user);
159 '@phan-var-force ModeleCaptcha $captchaobj';
162 print
'Error, the captcha handler class '.$classname.
' was not found after the include';
165 print
'Error, the captcha handler '.$captcha.
' has no class file found modCaptcha'.ucfirst($captcha);
174 if (!empty($backtopage)) {
175 header(
"Location: ".$backtopage);
180if ($action ==
"dosubmit") {
185 array_push(
$object->errors, $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Ref")));
194 if (!strlen($email)) {
196 array_push(
$object->errors, $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Email")));
201 array_push(
$object->errors, $langs->trans(
"ErrorEmailInvalid"));
205 if (!strlen($lastname)) {
207 array_push(
$object->errors, $langs->trans(
"ErrorFieldRequired", $langs->transnoentities(
"Lastname")));
213 if (
getDolGlobalString(
'MAIN_SECURITY_ENABLECAPTCHA_RECRUITMENT') && is_object($captchaobj)) {
214 if (method_exists($captchaobj,
'validateCodeAfterLoginSubmit')) {
215 $ok = $captchaobj->validateCodeAfterLoginSubmit();
217 print
'Error, the captcha handler '.get_class($captchaobj).
' does not have any method validateCodeAfterLoginSubmit()';
221 $langs->load(
'errors');
222 array_push(
$object->errors, $langs->trans(
"ErrorBadValueForCode"));
227 $sql =
"SELECT rrc.rowid FROM ".MAIN_DB_PREFIX.
"recruitment_recruitmentcandidature as rrc";
228 $sql .=
" WHERE rrc.email = '". $db->escape($email).
"'";
230 $resql = $db->query($sql);
232 $num = $db->num_rows($resql);
235 setEventMessages($langs->trans(
"ErrorRecruitmmentCandidatureAlreadyExists", $email),
null,
'errors');
238 dol_print_error($db);
248 $candidature->firstname =
GETPOST(
'firstname',
'alpha');
249 $candidature->lastname =
GETPOST(
'lastname',
'alpha');
250 $candidature->email =
GETPOST(
'email',
'alpha');
251 $candidature->phone =
GETPOST(
'phone',
'alpha');
252 $candidature->date_birth =
GETPOST(
'birthday',
'alpha');
253 $candidature->requestedremuneration =
GETPOST(
'requestedremuneration',
'alpha');
254 $candidature->description =
GETPOST(
'message',
'alpha');
255 $candidature->fk_recruitmentjobposition =
$object->id;
260 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
264 $errmsg .= implode(
'<br>', $candidature->errors);
268 $extrafields->fetch_name_optionals_label($candidature->table_element);
269 $ret = $extrafields->setOptionalsFromPost(
null, $candidature);
272 $errmsg .= $candidature->error;
276 $result = $candidature->create($user);
279 $errmsg .= implode(
'<br>', $candidature->errors);
283 $result = $candidature->validate($user);
286 $errmsg .= implode(
'<br>', $candidature->errors);
293 setEventMessages($langs->trans(
"RecruitmentCandidatureSaved"),
null);
294 header(
"Location: " . $backtopage);
303$triggersendname =
'CANDIDATURE_SENTBYMAIL';
305$autocopy =
'MAIN_MAIL_AUTOCOPY_CANDIDATURE_TO';
306$trackid =
'recruitmentcandidature'.$object->id;
307include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
314$form =
new Form($db);
319 $head =
'<link rel="stylesheet" type="text/css" href="' .
getDolGlobalString(
'MAIN_RECRUITMENT_CSS_URL').
'?lang='.$langs->defaultlang.
'">'.
"\n";
322$conf->dol_hide_topmenu = 1;
323$conf->dol_hide_leftmenu = 1;
326 $langs->load(
"errors");
327 print
'<div class="error">'.$langs->trans(
'ErrorPublicInterfaceNotEnabled').
'</div>';
333$arrayofcss = array();
335$replacemainarea = (empty(
$conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
336llxHeader($head, $langs->trans(
"PositionToBeFilled"),
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea, 1, 1);
339print
'<span id="dolpaymentspan"></span>'.
"\n";
340print
'<div class="center">'.
"\n";
341print
'<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER[
"PHP_SELF"].
'" method="POST">'.
"\n";
342print
'<input type="hidden" name="token" value="'.newToken().
'">'.
"\n";
343print
'<input type="hidden" name="action" value="dosubmit">'.
"\n";
344print
'<input type="hidden" name="tag" value="'.GETPOST(
"tag",
'alpha').
'">'.
"\n";
345print
'<input type="hidden" name="suffix" value="'.$suffix.
'">'.
"\n";
346print
'<input type="hidden" name="securekey" value="'.$SECUREKEY.
'">'.
"\n";
347print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
349print
'<!-- Form to view job -->'.
"\n";
353$logosmall =
$mysoc->logo_small;
355$paramlogo =
'ONLINE_RECRUITMENT_LOGO_'.$suffix;
365if (!empty($logosmall) && is_readable(
$conf->mycompany->dir_output.
'/logos/thumbs/'.$logosmall)) {
366 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.
$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
367 $urllogofull =
$dolibarr_main_url_root.
'/viewimage.php?modulepart=mycompany&entity='.
$conf->entity.
'&file='.urlencode(
'logos/thumbs/'.$logosmall);
368} elseif (!empty($logo) && is_readable(
$conf->mycompany->dir_output.
'/logos/'.$logo)) {
369 $urllogo = DOL_URL_ROOT.
'/viewimage.php?modulepart=mycompany&entity='.
$conf->entity.
'&file='.urlencode(
'logos/'.$logo);
374 print
'<div class="backgreypublicpayment">';
375 print
'<div class="logopublicpayment">';
376 if (!empty(
$mysoc->url)) {
377 print
'<a href="'.$mysoc->url.
'" target="_blank" rel="noopener">';
379 print
'<img id="dolpaymentlogo" src="'.$urllogofull.
'">';
380 if (!empty(
$mysoc->url)) {
385 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>';
391 print
'<div class="backimagepublicrecruitment">';
392 print
'<img id="idRECRUITMENT_IMAGE_PUBLIC_INTERFACE" src="' .
getDolGlobalString(
'RECRUITMENT_IMAGE_PUBLIC_INTERFACE').
'">';
397print
'<table id="dolpaymenttable" summary="Job position offer" class="center">'.
"\n";
403 if (preg_match(
'/^\((.*)\)$/',
$conf->global->RECRUITMENT_NEWFORM_TEXT, $reg)) {
404 $text .= $langs->trans($reg[1]).
"<br>\n";
408 $text =
'<tr><td align="center"><br>'.$text.
'<br></td></tr>'.
"\n";
411 $text .=
'<tr><td class="textpublicpayment" colspan=2><br>'.$langs->trans(
"JobOfferToBeFilled",
$mysoc->name);
412 $text .=
' - <strong>'.$mysoc->name.
'</strong>';
413 $text .=
' - <span class="nowraponall"><span class="fa fa-calendar secondary"></span> '.dol_print_date(
$object->date_creation).
'</span>';
414 $text .=
'</td></tr>'.
"\n";
415 $text .=
'<tr><td class="textpublicpayment" colspan=2><h1 class="paddingleft paddingright">'.$object->label.
'</h1><br></td></tr>'.
"\n";
420print
'<tr><td class="left" colspan=2>';
422print
'<div with="100%" id="tablepublicpayment">';
423print
'<div class="opacitymedium">'.$langs->trans(
"ThisIsInformationOnJobPosition").
' :</div>'.
"\n";
431print $langs->trans(
"Label").
' : ';
432print
'<b>'.dol_escape_htmltag(
$object->label).
'</b><br>';
435print $langs->trans(
"DateExpected").
' : ';
437if (
$object->date_planned > $now) {
440 print $langs->trans(
"ASAP");
445print $langs->trans(
"Remuneration").
' : ';
451$tmpuser =
new User($db);
452$tmpuser->fetch(
$object->fk_user_recruiter);
454print $langs->trans(
"ContactForRecruitment").
' : ';
455$emailforcontact =
$object->email_recruiter;
456if (empty($emailforcontact)) {
457 $emailforcontact = $tmpuser->email ??
'';
458 if (empty($emailforcontact)) {
459 $emailforcontact =
$mysoc->email ??
'';
462print
'<b class="wordbreak">';
463print $tmpuser->getFullName($langs);
464print
' '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0,
'envelope');
469 print
info_admin($langs->trans(
"JobClosedTextCandidateFound"), 0, 0,
'0',
'warning');
472 print
info_admin($langs->trans(
"JobClosedTextCanceled"), 0, 0,
'0',
'warning');
481print
'<input type="hidden" name="ref" value="'.$object->ref.
'">';
487if ($action !=
'dosubmit') {
488 if ($found && !$error) {
490 print
'</td></tr>'.
"\n";
491 print
'<tr><td class="titlefieldcreate fieldrequired left">'.$langs->trans(
"Lastname").
'</td><td class="left">';
492 print
'<input type="text" class="flat minwidth400 --success" name="lastname" maxlength="128" value="'.$lastname.
'">';
493 print
'</td></tr>'.
"\n";
495 print
'<tr><td class="titlefieldcreate left">'.$langs->trans(
"Firstname").
'</td><td class="left">';
496 print
'<input type="text" class="flat minwidth400 --success" name="firstname" maxlength="128" value="'.$firstname.
'">';
497 print
'</td></tr>'.
"\n";
499 print
'<tr><td class="titlefieldcreate fieldrequired left">'.$langs->trans(
"Email").
'</td><td class="left">';
500 print img_picto(
"",
"email",
'class="pictofixedwidth"').
'<input type="text" class="flat minwidth100 --success" name="email" value="'.$email.
'">';
501 print
'</td></tr>'.
"\n";
503 print
'<tr><td class="titlefieldcreate left">'.$langs->trans(
"Phone").
'</td><td class="left">';
504 print $form->showPhoneInput($phone,
'phone', 0,
'phone',
'flat minwidth100 --success');
505 print
'</td></tr>'.
"\n";
507 print
'<tr><td class="titlefieldcreate left minwidth300">'.$langs->trans(
"DateOfBirth").
'</td><td class="left">';
508 print $form->selectDate($birthday,
'birthday', 0, 0, 1,
"", 1, 0);
509 print
'</td></tr>'.
"\n";
511 print
'<tr><td class="titlefieldcreate left">'.$langs->trans(
"RequestedRemuneration").
'</td><td class="left">';
512 print
'<input type="text" class="flat minwidth100 --success" name="requestedremuneration" value="'.$requestedremuneration.
'">';
513 print
'</td></tr>'.
"\n";
517 $parameters = array();
518 $parameters[
'tpl_context'] =
'public';
519 $parameters[
'tdclass'] =
'left';
520 $extrafields->fetch_name_optionals_label(
"recruitment_recruitmentcandidature");
521 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
523 print
'<tr><td class="titlefieldcreate left">'.$langs->trans(
"Message").
'</td><td class="left">';
524 print
'<textarea class="flat quatrevingtpercent" rows="'.ROWS_5.
'" name="message">'.$message.
'</textarea>';
525 print
'</td></tr>'.
"\n";
528 if (
getDolGlobalString(
'MAIN_SECURITY_ENABLECAPTCHA_RECRUITMENT') && is_object($captchaobj)) {
529 print
'<tr><td class="titlefield"><label><span class="fieldrequired">'.$langs->trans($captchaobj->getFieldInputTitle()).
'</span></label></td><td><br>';
530 if (method_exists($captchaobj,
'getCaptchaCodeForForm')) {
531 print $captchaobj->getCaptchaCodeForForm(
'');
533 print
'Error, the captcha handler '.get_class($captchaobj).
' does not have any method getCaptchaCodeForForm()';
535 print
'<br></td></tr>';
537 print
'<tr><td colspan=2>';
538 print $form->buttonsSaveCancel(
'Submit',
'Cancel');
539 print
'</td></tr>'.
"\n";
547print
'</td></tr>'.
"\n";
549print
'</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.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
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.
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.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_print_error_email($prefixcode, $errormessage='', $errormessages=array(), $morecss='error', $email='')
Show a public email and error code to contact if technical error.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
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.