dolibarr 22.0.5
new.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
7 * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
9 * Copyright (C) 2021 Waël Almoman <info@almoman.com>
10 * Copyright (C) 2022 Udo Tamm <dev@dolibit.de>
11 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 */
26
37if (!defined('NOLOGIN')) {
38 define("NOLOGIN", 1); // This means this output page does not require to be logged.
39}
40if (!defined('NOCSRFCHECK')) {
41 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
42}
43if (!defined('NOBROWSERNOTIF')) {
44 define('NOBROWSERNOTIF', '1');
45}
46
47
48// For MultiCompany module.
49// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
50// Because 2 entities can have the same ref.
51$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
52// if (is_numeric($entity)) { // $entity is casted to int
53define("DOLENTITY", $entity);
54// }
55
56
57// Load Dolibarr environment
58require '../../main.inc.php';
59require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
60require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
61require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
62require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
63require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
64require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
65require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
66if (isModEnabled('project') || isModEnabled('eventorganization')) {
67 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
68}
69
70// Init vars
71$backtopage = GETPOST('backtopage', 'alpha');
72$action = GETPOST('action', 'aZ09');
73
74$errmsg = '';
75$num = 0;
76$error = 0;
77
87// Load translation files
88$langs->loadLangs(array("main", "donations", "companies", "install", "other", "errors"));
89
90// Security check
91if (!isModEnabled('don')) {
92 httponly_accessforbidden('Module don not enabled');
93}
94
95if (!getDolGlobalString('DONATION_ENABLE_PUBLIC')) {
96 httponly_accessforbidden("Donation form for public visitors has not been enabled");
97}
98
99// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
100//$hookmanager->initHooks(array( 'globalcard'));
101
102$extrafields = new ExtraFields($db);
103
104$object = new Don($db);
105
106$user->loadDefaultValues();
107
108
122function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction
123{
124 global $conf, $langs, $mysoc;
125
126 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
127
128 print '<body id="mainbody" class="publicnewmemberform">';
129
130 include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
131 htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('DONATION_PUBLIC_INTERFACE'), 'DONATION_IMAGE_PUBLIC_REGISTRATION');
132
133 print '<div class="divmainbodylarge">';
134}
135
143function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction
144{
145 global $conf, $langs;
146
147 print '</div>';
148
149 printCommonFooter('public');
150
151 if (!empty($conf->use_javascript_ajax)) {
152 print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
153 print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.'"></script>'."\n";
154 }
155
156 print "</body>\n";
157 print "</html>\n";
158}
159
160
161
162/*
163 * Actions
164 */
165
166$parameters = array();
167// Note that $action and $object may have been modified by some hooks
168$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
169if ($reshook < 0) {
170 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
171}
172
173// Action called when page is submitted
174if (empty($reshook) && $action == 'add') { // Test on permission not required here. This is an anonymous form. Check is done on constant to enable and mitigation.
175 $error = 0;
176 $urlback = '';
177
178 $db->begin();
179
180 if (GETPOST("email", "aZ09arobase") && !isValidEmail(GETPOST("email", "aZ09arobase"))) {
181 $langs->load('errors');
182 $error++;
183 $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email", "aZ09arobase"))."<br>\n";
184 }
185 if (!GETPOST('amount') || GETPOST('amount') < getDolGlobalInt('DONATION_MIN_AMOUNT')) {
186 $error++;
187 $errmsg .= $langs->trans("ErrorFieldMinimumAmount", getDolGlobalInt('DONATION_MIN_AMOUNT'))."<br>\n";
188 }
189
190 // Check Captcha code if is enabled
191 if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_DONATION')) {
192 $sessionkey = 'dol_antispam_value';
193 $ok = (array_key_exists($sessionkey, $_SESSION) && (strtolower($_SESSION[$sessionkey]) == strtolower(GETPOST('code'))));
194 if (!$ok) {
195 $error++;
196 $errmsg .= $langs->trans("ErrorBadValueForCode")."<br>\n";
197 $action = '';
198 }
199 }
200
201 $public = GETPOSTISSET('public') ? 1 : 0;
202 if ((isModEnabled('project') || isModEnabled('eventorganization')) && GETPOSTINT('project_id')) {
203 // Check if project is valid
204 $project = new Project($db);
205 $result = $project->fetch(GETPOSTINT('project_id'));
206 if ($result > 0) {
207 $projectId = $project->id;
208 }
209 }
210
211 if (!$error) {
212 $donation = new Don($db);
213
214 $donation->amount = (float) GETPOST('amount');
215 $donation->status = Don::STATUS_DRAFT;
216 $donation->public = $public;
217 $donation->date = dol_now();
218 $donation->firstname = GETPOST('firstname');
219 $donation->lastname = GETPOST('lastname');
220 $donation->company = GETPOST('societe');
221 $donation->societe = $donation->company;
222 $donation->address = GETPOST('address');
223 $donation->zip = GETPOST('zipcode');
224 $donation->town = GETPOST('town');
225 $donation->email = GETPOST('email', 'aZ09arobase');
226 $donation->country_id = GETPOSTINT('country_id');
227 // Assign project ID to the donation if a valid project is selected
228 if (!empty($projectId)) {
229 $donation->fk_project = $projectId;
230 }
231
232 $donation->state_id = GETPOSTINT('state_id');
233 $donation->note_private = GETPOST('note_private');
234
235 $donation->ip = getUserRemoteIP();
236
237 $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
238 $now = dol_now();
239 $minmonthpost = dol_time_plus_duree($now, -1, "m");
240 // Calculate nb of post for IP
241 $nb_post_ip = 0;
242 if ($nb_post_max > 0) { // Calculate only if there is a limit to check
243 $sql = "SELECT COUNT(rowid) as nb_don";
244 $sql .= " FROM ".MAIN_DB_PREFIX."don";
245 $sql .= " WHERE ip = '".$db->escape($donation->ip)."'";
246 $sql .= " AND datedon > '".$db->idate($minmonthpost)."'";
247 $resql = $db->query($sql);
248 if ($resql) {
249 $num = $db->num_rows($resql);
250 $i = 0;
251 while ($i < $num) {
252 $i++;
253 $obj = $db->fetch_object($resql);
254 $nb_post_ip = $obj->nb_don;
255 }
256 }
257 }
258
259 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
260 $error++;
261 $errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
262 array_push($donation->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
263 }
264
265 // Fill array 'array_options' with data from add form
266 $extrafields->fetch_name_optionals_label($donation->table_element);
267 $ret = $extrafields->setOptionalsFromPost(null, $donation);
268 if ($ret < 0) {
269 $error++;
270 $errmsg .= $donation->error;
271 }
272
273 if (!$error) {
274 $result = $donation->create($user);
275 if ($result > 0) {
276 if (!empty($backtopage)) {
277 $urlback = $backtopage;
278 } else {
279 $urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
280 }
281
282 if (getDolGlobalString('DONATION_NEWFORM_PAYONLINE') && getDolGlobalString('DONATION_NEWFORM_PAYONLINE') != '-1') {
283 $urlback = getOnlinePaymentUrl(0, 'donation', (string) $donation->id, 0, '');
284
285 if (GETPOST('email')) {
286 $urlback .= '&email='.urlencode(GETPOST('email'));
287 }
288 if (getDolGlobalString('DONATION_NEWFORM_PAYONLINE') != '-1' && getDolGlobalString('DONATION_NEWFORM_PAYONLINE') != 'all') {
289 $urlback .= '&paymentmethod='.urlencode(getDolGlobalString('DONATION_NEWFORM_PAYONLINE'));
290 }
291 } else {
292 if (!empty($entity)) {
293 $urlback .= '&entity='.((int) $entity);
294 }
295 }
296 } else {
297 $error++;
298 $errmsg .= implode('<br>', $donation->errors);
299 }
300 }
301 }
302
303 if (!$error) {
304 $db->commit();
305
306 header("Location: ".$urlback);
307 exit;
308 } else {
309 $db->rollback();
310 $action = "create";
311 }
312}
313
314// Action called after a submitted was send and donation created successfully
315// If we ask to redirect to the payment page, we never go here because a redirect was done to the payment url.
316// backtopage parameter with an url was set on donation submit page, we never go here because a redirect was done to this url.
317
318if (empty($reshook) && $action == 'added') { // Test on permission not required here
319 llxHeaderVierge($langs->trans("NewDonationForm"));
320
321 // If we have not been redirected
322 print '<br><br>';
323 print '<div class="center">';
324 print $langs->trans("NewDonationbyWeb").'<br>';
325 print '</div>';
326
328 exit;
329}
330
331
332/*
333 * View
334 */
335
336$form = new Form($db);
337$formcompany = new FormCompany($db);
338$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
339
340if (isModEnabled('project') || isModEnabled('eventorganization')) {
341 $project = new Project($db);
342 $result = $project->fetch(GETPOSTINT('project_id'));
343 if ($result > 0) {
344 $projectId = $project->id;
345 $projectTitle = $project->title;
346 }
347}
348
349
350llxHeaderVierge($langs->trans("NewDonation"));
351
352print '<br>';
353print load_fiche_titre(img_picto('', '', 'class="pictofixedwidth"').' &nbsp; '.$langs->trans("NewDonation"), '', '', 0, '', 'center');
354
355
356print '<div align="center">';
357print '<div id="divsubscribe">';
358
359print '<div class="center subscriptionformhelptext opacitymedium justify">';
360print $langs->trans("NewDonationDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
361
362print '</div>';
363
364dol_htmloutput_errors($errmsg);
366
367// Print form
368print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newdonation">'."\n";
369print '<input type="hidden" name="token" value="'.newToken().'" />';
370print '<input type="hidden" name="entity" value="'.$entity.'" />';
371print '<input type="hidden" name="page_y" value="" />';
372print '<input type="hidden" name="project_id" value="'.GETPOST('project_id').'" />';
373
374if (!$action || $action == 'create') {
375 print '<input type="hidden" name="action" value="add" />';
376 print '<br>';
377
378 $messagemandatory = '<span class="">'.$langs->trans("FieldsWithAreMandatory", '*').'</span>';
379 //print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
380 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
381
382 print dol_get_fiche_head();
383
384 print '<script type="text/javascript">
385 jQuery(document).ready(function () {
386 jQuery(document).ready(function () {
387 jQuery("#selectcountry_id").change(function() {
388 document.newdonation.action.value="create";
389 document.newdonation.submit();
390 });
391 });
392 });
393 </script>';
394
395 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
396
397 // Add a specific style or table head for the project row
398 if ((isModEnabled('project') || isModEnabled('eventorganization')) && !empty($projectTitle)) {
399 print '<tr>';
400 print '<td class="project-label">' . $langs->trans("project") . '</td>';
401 print '<td class="project-value">' . dol_escape_htmltag($projectTitle) . '</td>';
402 print '</tr>';
403 }
404
405 // Anonymous
406 /*
407 print '<tr>';
408 print '<td class="titlefieldcreate"><label for="anonymous">'.$form->textwithpicto($langs->trans("donAnonymous"), $langs->trans("AnonymousDonationTooltip")).'</label></td>';
409 print '<td><input type="checkbox" name="anonymous" id="anonymous" '.(GETPOST('anonymous') ? 'checked' : '').'></td>';
410 print '</tr>'."\n";
411 print '<script type="text/javascript">
412 jQuery(document).ready(function () {
413 function toggleFields() {
414 if (jQuery("#anonymous").is(":checked")) {
415 jQuery("#tablesubscribe").find("#trcompany, #trfirstname, #trlastname, #tremail, #tradress, #trzip, #trcountry, #trstate, #trseparator").hide();
416 } else {
417 jQuery("#tablesubscribe tr").show();
418 }
419 }
420
421 // Initial toggle on page load
422 toggleFields();
423
424 // Toggle fields on checkbox change
425 jQuery("#anonymous").change(function () {
426 toggleFields();
427 });
428 });
429 </script>';
430 */
431
432 // EMail
433 print '<tr id="tremail"><td class="fieldrequired" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans("Email").'</td><td>';
434 //print img_picto('', 'email', 'class="pictofixedwidth"');
435 print '<input type="email" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('email', "aZ09arobase")).'"></td></tr>'."\n";
436
437 // Company
438 print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td>';
439 print img_picto('', 'company', 'class="pictofixedwidth paddingright"');
440 print '<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
441
442 // Firstname
443 print '<tr id="trfirstname"><td class="classfortooltip" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans("Firstname").'</td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'"></td></tr>'."\n";
444
445 // Lastname
446 print '<tr id="trlastname"><td class="classfortooltip" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans("Lastname").'</td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'"></td></tr>'."\n";
447
448 // Address
449 print '<tr id="tradress"><td>'.$langs->trans("Address").'</td><td>'."\n";
450 print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
451
452 // Zip / Town
453 print '<tr id="trzip"><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
454 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
455 print ' / ';
456 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
457 print '</td></tr>';
458
459 // Country
460 print '<tr id="trcountry"><td>'.$langs->trans('Country').'</td><td>';
461 print img_picto('', 'country', 'class="pictofixedwidth paddingright"');
462 $country_id = GETPOSTINT('country_id');
463 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
464 $country_code = dol_user_country();
465 //print $country_code;
466 if ($country_code) {
467 $new_country_id = getCountry($country_code, '3', $db, $langs);
468 //print 'xxx'.$country_code.' - '.$new_country_id;
469 if ($new_country_id) {
470 $country_id = $new_country_id;
471 }
472 }
473 }
474 $country_code = getCountry($country_id, '2', $db, $langs);
475 print $form->select_country($country_id, 'country_id');
476 print '</td></tr>';
477
478 // State
479 if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
480 print '<tr id="trstate"><td>'.$langs->trans('State').'</td><td>';
481 if ($country_code) {
482 print img_picto('', 'state', 'class="pictofixedwidth paddingright"');
483 print $formcompany->select_state(GETPOSTINT("state_id"), $country_code);
484 }
485 print '</td></tr>';
486 }
487
488 // Other attributes
489 $parameters['tpl_context'] = 'public'; // define template context to public
490 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
491
492 print '<tr id="trseparator"><td colspan="2"><hr></td></tr>';
493
494 // Public
495 $publiclabel = $langs->trans("publicDonationFieldHelp", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'));
496 print '<tr><td><label for="public">'.$form->textwithpicto($langs->trans("donationPublic"), $publiclabel).'</label></td>';
497 print '<td><input type="checkbox" name="public" id="public"></td></tr>'."\n";
498
499 if (getDolGlobalString('DONATION_NEWFORM_PAYONLINE')) {
500 $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : '');
501
502 // - If a min is set, we take it into account
503 $amount = max(0, (float) $amount, (float) getDolGlobalInt("DONATION_MIN_AMOUNT"));
504
505 // Clean the amount
506 $amount = price2num($amount);
507 $showedamount = $amount > 0 ? $amount : 0;
508 print '<tr><td>'.$langs->trans("donationAmount");
509 print ' <span>*</span></td><td class="nowrap">';
510
511 print '<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.'">';
512 print ' '.$langs->trans("Currency".$conf->currency).'<span class="opacitymedium hideifautoturnover"> - ';
513 print $langs->trans("AnyAmountForDonation");
514 print '</span>';
515
516 print '</td></tr>';
517 }
518
519 // Comments
520 print '<tr>';
521 print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
522 print '<td class="tdtop"><textarea name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note_private', 'restricthtml'), 0, 1).'</textarea></td>';
523 print '</tr>'."\n";
524
525 // Display Captcha code if is enabled
526 if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_DONATION')) {
527 require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
528 print '<tr><td class="titlefield"><label><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td>';
529 print '<span class="span-icon-security inline-block">';
530 print '<input id="securitycode" placeholder="'.$langs->trans("SecurityCode").'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
531 print '</span>';
532 print '<span class="nowrap inline-block">';
533 print '<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
534 print '<a class="inline-block valignmiddle" href="" tabindex="4" data-role="button">'.img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"').'</a>';
535 print '</span>';
536 print '</td></tr>';
537 }
538
539 print "</table>\n";
540
541 print dol_get_fiche_end();
542
543 // Save / Submit
544 print '<div class="center">';
545 print '<input type="submit" value="'.$langs->trans("GetDonationButtonLabel").'" id="submitsave" class="button">';
546 if (!empty($backtopage)) {
547 print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
548 }
549 print '</div>';
550
551
552 print "</form>\n";
553 print "<br>";
554 print '</div></div>';
555}
556
557//htmlPrintOnlineFooter($mysoc, $langs);
559
560$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
Class to manage donations.
Definition don.class.php:41
Class to manage standard extra fields.
Class to build HTML component for third parties management Only common components are here.
Class to manage generation of HTML components Only common components must be here.
Class to manage projects.
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Show header for new prospect.
Definition new.php:122
llxFooterVierge()
Show footer for new societe.
Definition new.php:143
htmlPrintOnlineHeader($mysoc, $langs, $showlogo=1, $alttext='', $subimageconst='', $altlogo1='', $altlogo2='')
Show the header of a company in HTML public pages.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition date.lib.php:125
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_user_country()
Return country code for current user.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_htmloutput_events($disabledoutputofmessages=0)
Print formatted messages to output (Used to show messages on html output).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
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...
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
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.