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