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