dolibarr 24.0.0-beta
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 * Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26if (!defined('NOLOGIN')) {
27 define("NOLOGIN", 1); // This means this output page does not require to be logged.
28}
29if (!defined('NOCSRFCHECK')) {
30 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
31}
32if (!defined('NOIPCHECK')) {
33 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
34}
35if (!defined('NOBROWSERNOTIF')) {
36 define('NOBROWSERNOTIF', '1');
37}
38
39// Load Dolibarr environment
40require '../../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php';
52require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
53require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
54require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
55require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
56
57// Load translation files required by the page
58$langs->loadLangs(array("companies", "other", "recruitment"));
59
60// Get parameters
61$action = GETPOST('action', 'aZ09');
62$cancel = GETPOST('cancel', 'alpha');
63$SECUREKEY = GETPOST("securekey");
64$entity = GETPOSTINT('entity') ? GETPOSTINT('entity') : $conf->entity;
65$backtopage = '';
66$suffix = "";
67
68// Load variable for pagination
69$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
70$sortfield = GETPOST('sortfield', 'aZ09comma');
71$sortorder = GETPOST('sortorder', 'aZ09comma');
72$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
73if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
74 $page = 0;
75} // If $page is not defined, or '' or -1 or if we click on clear filters
76$offset = $limit * $page;
77$pageprev = $page - 1;
78$pagenext = $page + 1;
79
80if (GETPOST('btn_view')) {
81 unset($_SESSION['email_customer']);
82}
83if (isset($_SESSION['email_customer'])) {
84 $email = $_SESSION['email_customer'];
85}
86
88
89// Define $urlwithroot
90//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
91//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
92$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
93
94// Security check
95if (!isModEnabled('recruitment')) {
96 httponly_accessforbidden('Module Recruitment not enabled');
97}
98
99
100/*
101 * Actions
102 */
103
104// None
105
106
107/*
108 * View
109 */
110
111$head = '';
112if (getDolGlobalString('MAIN_RECRUITMENT_CSS_URL')) {
113 $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('MAIN_RECRUITMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
114}
115
116$conf->dol_hide_topmenu = 1;
117$conf->dol_hide_leftmenu = 1;
118
119if (!getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE')) {
120 $langs->load("errors");
121 print '<div class="error">'.$langs->trans('ErrorPublicInterfaceNotEnabled').'</div>';
122 $db->close();
123 exit();
124}
125
126$arrayofjs = array();
127$arrayofcss = array();
128
129$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
130llxHeader($head, $langs->trans("PositionToBeFilled"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1, 1);
131
132
133print '<span id="dolpaymentspan"></span>'."\n";
134print '<div class="center">'."\n";
135print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
136print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
137print '<input type="hidden" name="action" value="dosign">'."\n";
138print '<input type="hidden" name="tag" value="'.GETPOST("tag", 'alpha').'">'."\n";
139print '<input type="hidden" name="suffix" value="'.GETPOST("suffix", 'alpha').'">'."\n";
140print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
141print '<input type="hidden" name="entity" value="'.$entity.'" />';
142print "\n";
143print '<!-- Form to view jobs -->'."\n";
144
145// Show logo (search order: logo defined by ONLINE_SIGN_LOGO_suffix, then ONLINE_SIGN_LOGO_, then small company logo, large company logo, theme logo, common logo)
146// Define logo and logosmall
147$logosmall = $mysoc->logo_small;
148$logo = $mysoc->logo;
149$paramlogo = 'ONLINE_RECRUITMENT_LOGO_'.$suffix;
150if (getDolGlobalString($paramlogo)) {
151 $logosmall = getDolGlobalString($paramlogo);
152} elseif (getDolGlobalString('ONLINE_RECRUITMENT_LOGO')) {
153 $logosmall = getDolGlobalString('ONLINE_RECRUITMENT_LOGO_');
154}
155//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
156// Define urllogo
157$urllogo = '';
158$urllogofull = '';
159if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
160 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
161 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
162} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
163 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
164 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
165}
166// Output html code for logo
167if ($urllogo) {
168 print '<div class="backgreypublicpayment">';
169 print '<div class="logopublicpayment">';
170 print '<img id="dolpaymentlogo" src="'.$urllogo.'">';
171 print '</div>';
172 if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) {
173 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>';
174 }
175 print '</div>';
176}
177
178if (getDolGlobalString('RECRUITMENT_IMAGE_PUBLIC_INTERFACE')) {
179 print '<div class="backimagepublicrecruitment">';
180 print '<img id="idPROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH" src="' . getDolGlobalString('RECRUITMENT_IMAGE_PUBLIC_INTERFACE').'">';
181 print '</div>';
182}
183
184
185$results = $object->fetchAll($sortorder, $sortfield, 0, 0, '(status:=:1)');
186$now = dol_now();
187$params = array();
188
189if (is_array($results)) {
190 if (empty($results)) {
191 print '<br>';
192 print $langs->trans("NoPositionOpen");
193 } else {
194 print '<br><br><br>';
195 print '<span class="opacitymedium">'.$langs->trans("WeAreRecruiting").'</span>';
196 print '<br><br><br>';
197 print '<br class="hideonsmartphone">';
198
199 foreach ($results as $job) {
200 $object = $job;
201 $arrayofpostulatebutton = array();
202
203 print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n";
204
205 // Output introduction text
206 $text = '';
207 if (getDolGlobalString('RECRUITMENT_NEWFORM_TEXT')) {
208 $reg = array();
209 if (preg_match('/^\‍((.*)\‍)$/', getDolGlobalString('RECRUITMENT_NEWFORM_TEXT'), $reg)) {
210 $text .= $langs->trans($reg[1])."<br>\n";
211 } else {
212 $text .= getDolGlobalString('RECRUITMENT_NEWFORM_TEXT') . "<br>\n";
213 }
214 $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
215 }
216 if (empty($text)) {
217 $text .= '<tr><td class="textpublicpayment"><br>'.$langs->trans("JobOfferToBeFilled", $mysoc->name);
218 $text .= ' &nbsp; - &nbsp; <strong>'.$mysoc->name.'</strong>';
219 $text .= ' &nbsp; - &nbsp; <span class="nowraponall"><span class="fa fa-calendar secondary"></span> '.dol_print_date($object->date_creation).'</span>';
220 $text .= '</td></tr>'."\n";
221 $text .= '<tr><td class="textpublicpayment"><h1 class="paddingleft paddingright">'.$object->label.'</h1></td></tr>'."\n";
222 }
223 print $text;
224
225 // Output payment summary form
226 print '<tr><td class="left">';
227
228 print '<div class="centpercent" id="tablepublicpayment">';
229 print '<div class="opacitymedium">'.$langs->trans("ThisIsInformationOnJobPosition").' :</div>'."\n";
230
231 $error = 0;
232 $found = true;
233
234 print '<br>';
235
236 // Label
237 print $langs->trans("Label").' : ';
238 print '<b>'.dol_escape_htmltag($object->label).'</b><br>';
239
240 // Date
241 print $langs->trans("DateExpected").' : ';
242 print '<b>';
243 if ($object->date_planned > $now) {
244 print dol_print_date($object->date_planned, 'day');
245 } else {
246 print $langs->trans("ASAP");
247 }
248 print '</b><br>';
249
250 // Remuneration
251 print $langs->trans("Remuneration").' : ';
252 print '<b>';
253 print dol_escape_htmltag($object->remuneration_suggested);
254 print '</b><br>';
255
256 // Contact
257 $tmpuser = new User($db);
258 $tmpuser->fetch($object->fk_user_recruiter);
259
260 print $langs->trans("ContactForRecruitment").' : ';
261 $emailforcontact = $object->email_recruiter;
262 if (empty($emailforcontact)) {
263 $emailforcontact = $tmpuser->email ?? '';
264 if (empty($emailforcontact)) {
265 $emailforcontact = $mysoc->email ?? '';
266 }
267 }
268 print '<b class="wordbreak">';
269 print $tmpuser->getFullName($langs);
270 print ' &nbsp; '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 'envelope');
271 print '</b>';
272 print '</b><br>';
273
275 print info_admin($langs->trans("JobClosedTextCandidateFound"), 0, 0, '0', 'warning');
276 }
278 print info_admin($langs->trans("JobClosedTextCanceled"), 0, 0, '0', 'warning');
279 }
280
281 print '<br>';
282
283 // Description
284
285 $text = $object->description;
286 print $text;
287 print '<input type="hidden" name="ref" value="'.$object->ref.'">';
288
289 $arrayofpostulatebutton[] = array(
290 'url' => '/public/recruitment/view.php?ref='.$object->ref,
291 'label' => $langs->trans('ApplyJobCandidature'),
292 'lang' => 'recruitment',
293 'perm' => true,
294 'enabled' => true,
295 );
296
297 print '<div class="center">';
298 print dolGetButtonAction('', $langs->trans("ApplyJobCandidature"), 'default', $arrayofpostulatebutton, 'applicate_'.$object->ref, true, $params);
299 print '</div>';
300 print '</div>'."\n";
301 print "\n";
302
303
304 if ($action != 'dosubmit') {
305 if ($found && !$error) {
306 // We are in a management option and no error
307 } else {
308 dol_print_error_email('ERRORSUBMITAPPLICATION');
309 }
310 } else {
311 // Print
312 }
313
314 print '</td></tr>'."\n";
315
316 print '</table>'."\n";
317
318 print '<br><br class="hideonsmartphone"><br class="hideonsmartphone"><br class="hideonsmartphone">'."\n";
319 }
320 }
321} else {
322 dol_print_error($db, $object->error, $object->errors);
323}
324
325print '</form>'."\n";
326print '</div>'."\n";
327print '<br>';
328
329
331
332llxFooter('', 'public');
333
334$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
global $dolibarr_main_url_root
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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.
Definition wrapper.php:73
Class for RecruitmentJobPosition.
Class to manage Dolibarr users.
htmlPrintOnlineFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
Show footer of company in HTML public pages.
global $mysoc
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_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).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.