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