dolibarr 25.0.0-alpha
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// For MultiCompany module.
40$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
41define("DOLENTITY", $entity);
42
43// Load Dolibarr environment
44require '../../main.inc.php';
55require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php';
56require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
57require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
58require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
59require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
60
61// Load translation files required by the page
62$langs->loadLangs(array("companies", "other", "recruitment"));
63
64// Get parameters
65$action = GETPOST('action', 'aZ09');
66$cancel = GETPOST('cancel', 'alpha');
67$SECUREKEY = GETPOST("securekey");
68$entity = GETPOSTINT('entity') ? GETPOSTINT('entity') : $conf->entity;
69$backtopage = '';
70$suffix = "";
71
72// Load variable for pagination
73$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
74$sortfield = GETPOST('sortfield', 'aZ09comma');
75$sortorder = GETPOST('sortorder', 'aZ09comma');
76$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
77if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
78 $page = 0;
79} // If $page is not defined, or '' or -1 or if we click on clear filters
80$offset = $limit * $page;
81$pageprev = $page - 1;
82$pagenext = $page + 1;
83
84if (GETPOST('btn_view')) {
85 unset($_SESSION['email_customer']);
86}
87if (isset($_SESSION['email_customer'])) {
88 $email = $_SESSION['email_customer'];
89}
90
92
93// Define $urlwithroot
94//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
95//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
96$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
97
98// Security check
99if (!isModEnabled('recruitment')) {
100 httponly_accessforbidden('Module Recruitment not enabled');
101}
102
103
104/*
105 * Actions
106 */
107
108// None
109
110
111/*
112 * View
113 */
114
115$head = '';
116if (getDolGlobalString('MAIN_RECRUITMENT_CSS_URL')) {
117 $head = '<link rel="stylesheet" type="text/css" href="' . getDolGlobalString('MAIN_RECRUITMENT_CSS_URL').'?lang='.$langs->defaultlang.'">'."\n";
118}
119
120$conf->dol_hide_topmenu = 1;
121$conf->dol_hide_leftmenu = 1;
122
123if (!getDolGlobalString('RECRUITMENT_ENABLE_PUBLIC_INTERFACE')) {
124 $langs->load("errors");
125 print '<div class="error">'.$langs->trans('ErrorPublicInterfaceNotEnabled').'</div>';
126 $db->close();
127 exit();
128}
129
130$arrayofjs = array();
131$arrayofcss = array();
132
133$replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
134llxHeader($head, $langs->trans("PositionToBeFilled"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1, 1);
135
136
137print '<span id="dolpaymentspan"></span>'."\n";
138print '<div class="center">'."\n";
139print '<form id="dolpaymentform" class="center" name="paymentform" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
140print '<input type="hidden" name="token" value="'.newToken().'">'."\n";
141print '<input type="hidden" name="action" value="dosign">'."\n";
142print '<input type="hidden" name="tag" value="'.GETPOST("tag", 'alpha').'">'."\n";
143print '<input type="hidden" name="suffix" value="'.GETPOST("suffix", 'alpha').'">'."\n";
144print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
145print '<input type="hidden" name="entity" value="'.$entity.'" />';
146print "\n";
147print '<!-- Form to view jobs -->'."\n";
148
149// 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)
150// Define logo and logosmall
151$logosmall = $mysoc->logo_small;
152$logo = $mysoc->logo;
153$paramlogo = 'ONLINE_RECRUITMENT_LOGO_'.$suffix;
154if (getDolGlobalString($paramlogo)) {
155 $logosmall = getDolGlobalString($paramlogo);
156} elseif (getDolGlobalString('ONLINE_RECRUITMENT_LOGO')) {
157 $logosmall = getDolGlobalString('ONLINE_RECRUITMENT_LOGO_');
158}
159//print '<!-- Show logo (logosmall='.$logosmall.' logo='.$logo.') -->'."\n";
160// Define urllogo
161$urllogo = '';
162$urllogofull = '';
163if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$logosmall)) {
164 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/thumbs/'.$logosmall);
165 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall);
166} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) {
167 $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&amp;entity='.$conf->entity.'&amp;file='.urlencode('logos/'.$logo);
168 $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo);
169}
170// Output html code for logo
171if ($urllogo) {
172 print '<div class="backgreypublicpayment">';
173 print '<div class="logopublicpayment">';
174 print '<img id="dolpaymentlogo" src="'.$urllogo.'">';
175 print '</div>';
176 if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) {
177 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>';
178 }
179 print '</div>';
180}
181
182if (getDolGlobalString('RECRUITMENT_IMAGE_PUBLIC_INTERFACE')) {
183 print '<div class="backimagepublicrecruitment">';
184 print '<img id="idPROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH" src="' . getDolGlobalString('RECRUITMENT_IMAGE_PUBLIC_INTERFACE').'">';
185 print '</div>';
186}
187
188
189$results = $object->fetchAll($sortorder, $sortfield, 0, 0, '(status:=:1)');
190$now = dol_now();
191$params = array();
192
193if (is_array($results)) {
194 if (empty($results)) {
195 print '<br>';
196 print $langs->trans("NoPositionOpen");
197 } else {
198 print '<br><br><br>';
199 print '<span class="opacitymedium">'.$langs->trans("WeAreRecruiting").'</span>';
200 print '<br><br><br>';
201 print '<br class="hideonsmartphone">';
202
203 foreach ($results as $job) {
204 $object = $job;
205 $arrayofpostulatebutton = array();
206
207 print '<table id="dolpaymenttable" summary="Job position offer" class="center">'."\n";
208
209 // Output introduction text
210 $text = '';
211 if (getDolGlobalString('RECRUITMENT_NEWFORM_TEXT')) {
212 $reg = array();
213 if (preg_match('/^\‍((.*)\‍)$/', getDolGlobalString('RECRUITMENT_NEWFORM_TEXT'), $reg)) {
214 $text .= $langs->trans($reg[1])."<br>\n";
215 } else {
216 $text .= getDolGlobalString('RECRUITMENT_NEWFORM_TEXT') . "<br>\n";
217 }
218 $text = '<tr><td align="center"><br>'.$text.'<br></td></tr>'."\n";
219 }
220 if (empty($text)) {
221 $text .= '<tr><td class="textpublicpayment"><br>'.$langs->trans("JobOfferToBeFilled", $mysoc->name);
222 $text .= ' &nbsp; - &nbsp; <strong>'.$mysoc->name.'</strong>';
223 $text .= ' &nbsp; - &nbsp; <span class="nowraponall"><span class="fa fa-calendar secondary"></span> '.dol_print_date($object->date_creation).'</span>';
224 $text .= '</td></tr>'."\n";
225 $text .= '<tr><td class="textpublicpayment"><h1 class="paddingleft paddingright">'.$object->label.'</h1></td></tr>'."\n";
226 }
227 print $text;
228
229 // Output payment summary form
230 print '<tr><td class="left">';
231
232 print '<div class="centpercent" id="tablepublicpayment">';
233 print '<div class="opacitymedium">'.$langs->trans("ThisIsInformationOnJobPosition").' :</div>'."\n";
234
235 $error = 0;
236 $found = true;
237
238 print '<br>';
239
240 // Label
241 print $langs->trans("Label").' : ';
242 print '<b>'.dol_escape_htmltag($object->label).'</b><br>';
243
244 // Date
245 print $langs->trans("DateExpected").' : ';
246 print '<b>';
247 if ($object->date_planned > $now) {
248 print dol_print_date($object->date_planned, 'day');
249 } else {
250 print $langs->trans("ASAP");
251 }
252 print '</b><br>';
253
254 // Remuneration
255 print $langs->trans("Remuneration").' : ';
256 print '<b>';
257 print dol_escape_htmltag($object->remuneration_suggested);
258 print '</b><br>';
259
260 // Contact
261 $tmpuser = new User($db);
262 $tmpuser->fetch($object->fk_user_recruiter);
263
264 print $langs->trans("ContactForRecruitment").' : ';
265 $emailforcontact = $object->email_recruiter;
266 if (empty($emailforcontact)) {
267 $emailforcontact = $tmpuser->email ?? '';
268 if (empty($emailforcontact)) {
269 $emailforcontact = $mysoc->email ?? '';
270 }
271 }
272 print '<b class="wordbreak">';
273 print $tmpuser->getFullName($langs);
274 print ' &nbsp; '.dol_print_email($emailforcontact, 0, 0, 1, 0, 0, 'envelope');
275 print '</b>';
276 print '</b><br>';
277
279 print info_admin($langs->trans("JobClosedTextCandidateFound"), 0, 0, '0', 'warning');
280 }
282 print info_admin($langs->trans("JobClosedTextCanceled"), 0, 0, '0', 'warning');
283 }
284
285 print '<br>';
286
287 // Description
288
289 $text = $object->description;
290 print $text;
291 print '<input type="hidden" name="ref" value="'.$object->ref.'">';
292
293 $arrayofpostulatebutton[] = array(
294 'url' => '/public/recruitment/view.php?ref='.$object->ref,
295 'label' => $langs->trans('ApplyJobCandidature'),
296 'lang' => 'recruitment',
297 'perm' => true,
298 'enabled' => true,
299 );
300
301 print '<div class="center">';
302 print dolGetButtonAction('', $langs->trans("ApplyJobCandidature"), 'default', $arrayofpostulatebutton, 'applicate_'.$object->ref, true, $params);
303 print '</div>';
304 print '</div>'."\n";
305 print "\n";
306
307
308 if ($action != 'dosubmit') {
309 if ($found && !$error) {
310 // We are in a management option and no error
311 } else {
312 dol_print_error_email('ERRORSUBMITAPPLICATION');
313 }
314 } else {
315 // Print
316 }
317
318 print '</td></tr>'."\n";
319
320 print '</table>'."\n";
321
322 print '<br><br class="hideonsmartphone"><br class="hideonsmartphone"><br class="hideonsmartphone">'."\n";
323 }
324 }
325} else {
326 dol_print_error($db, $object->error, $object->errors);
327}
328
329print '</form>'."\n";
330print '</div>'."\n";
331print '<br>';
332
333
335
336llxFooter('', 'public');
337
338$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
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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
dol_now($mode='gmt')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_print_error_email($prefixcode, $errormessage='', $errormessages=array(), $morecss='error', $email='')
Show a public email and error code to contact if technical error.
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)
Definition html.lib.php:183
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.