dolibarr 25.0.0-alpha
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-2026 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"));
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$captchaobj = null;
109if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_DONATION')) {
110 require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
111 $captcha = getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_HANDLER', 'standard');
112 // List of directories where we can find captcha handlers
113 $dirModCaptcha = array_merge(
114 array(
115 'main' => '/core/modules/security/captcha/'
116 ),
117 is_array($conf->modules_parts['captcha']) ? $conf->modules_parts['captcha'] : array()
118 );
119 $fullpathclassfile = '';
120 foreach ($dirModCaptcha as $dir) {
121 $fullpathclassfile = dol_buildpath($dir."modCaptcha".ucfirst($captcha).'.class.php', 0, 2);
122 if ($fullpathclassfile) {
123 break;
124 }
125 }
126 if ($fullpathclassfile) {
127 include_once $fullpathclassfile;
128 // Charging the numbering class
129 $classname = "modCaptcha".ucfirst($captcha);
130 if (class_exists($classname)) {
131 $captchaobj = new $classname($db, $conf, $langs, $user);
132 '@phan-var-force ModeleCaptcha $captchaobj';
134 } else {
135 print 'Error, the captcha handler class '.$classname.' was not found after the include';
136 }
137 } else {
138 print 'Error, the captcha handler '.$captcha.' has no class file found modCaptcha'.ucfirst($captcha);
139 }
140}
141
156function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [], $ws = '') // @phan-suppress-current-line PhanRedefineFunction
157{
158 global $conf, $langs, $mysoc;
159
160 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
161
162 print '<body id="mainbody" class="publicnewmemberform">';
163
164 include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
165 htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('DONATION_PUBLIC_INTERFACE'), 'DONATION_IMAGE_PUBLIC_REGISTRATION');
166
167 print '<div class="divmainbodylarge">';
168}
169
177function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction
178{
179 global $conf, $langs;
180
181 print '</div>';
182
183 printCommonFooter('public');
184
185 if (!empty($conf->use_javascript_ajax)) {
186 print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
187 print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.'"></script>'."\n";
188 }
189
190 print "</body>\n";
191 print "</html>\n";
192}
193
194
195
196/*
197 * Actions
198 */
199
200$parameters = array();
201// Note that $action and $object may have been modified by some hooks
202$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
203if ($reshook < 0) {
204 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
205}
206
207// Action called when page is submitted
208if (empty($reshook) && $action == 'add') { // Test on permission not required here. This is an anonymous form. Check is done on constant to enable and mitigation.
209 $error = 0;
210 $urlback = '';
211
212 $db->begin();
213
214 if (GETPOST("email", "aZ09arobase") && !isValidEmail(GETPOST("email", "aZ09arobase"))) {
215 $langs->load('errors');
216 $error++;
217 $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email", "aZ09arobase"))."<br>\n";
218 }
219 if (!GETPOST('amount') || GETPOST('amount') < getDolGlobalInt('DONATION_MIN_AMOUNT')) {
220 $error++;
221 $errmsg .= $langs->trans("ErrorFieldMinimumAmount", getDolGlobalInt('DONATION_MIN_AMOUNT'))."<br>\n";
222 }
223
224 // Check Captcha code if is enabled
225 $ok = false;
226 if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_DONATION') && is_object($captchaobj)) {
227 if (method_exists($captchaobj, 'validateCodeAfterLoginSubmit')) {
228 $ok = $captchaobj->validateCodeAfterLoginSubmit(); // @phan-suppress-current-line PhanUndeclaredMethod
229 } else {
230 print 'Error, the captcha handler '.get_class($captchaobj).' does not have any method validateCodeAfterLoginSubmit()';
231 }
232 if (!$ok) {
233 $error++;
234 $langs->load("errors");
235 $errmsg .= $langs->trans("ErrorBadValueForCode")."<br>\n";
236 $action = '';
237 }
238 }
239
240 $public = GETPOSTISSET('public') ? 1 : 0;
241 if ((isModEnabled('project') || isModEnabled('eventorganization')) && GETPOSTINT('project_id')) {
242 // Check if project is valid
243 $project = new Project($db);
244 $result = $project->fetch(GETPOSTINT('project_id'));
245 if ($result > 0) {
246 $projectId = $project->id;
247 }
248 }
249
250 if (!$error) {
251 $donation = new Don($db);
252
253 $donation->amount = (float) GETPOST('amount');
254 $donation->status = Don::STATUS_DRAFT;
255 $donation->public = $public;
256 $donation->date = dol_now();
257 $donation->firstname = GETPOST('firstname');
258 $donation->lastname = GETPOST('lastname');
259 $donation->company = GETPOST('societe');
260 $donation->societe = $donation->company;
261 $donation->address = GETPOST('address');
262 $donation->zip = GETPOST('zipcode');
263 $donation->town = GETPOST('town');
264 $donation->email = GETPOST('email', 'aZ09arobase');
265 $donation->country_id = GETPOSTINT('country_id');
266 // Assign project ID to the donation if a valid project is selected
267 if (!empty($projectId)) {
268 $donation->fk_project = $projectId;
269 }
270
271 $donation->state_id = GETPOSTINT('state_id');
272 $donation->note_private = GETPOST('note_private');
273
274 $donation->ip = getUserRemoteIP();
275
276 $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
277 $now = dol_now();
278 $minmonthpost = dol_time_plus_duree($now, -1, "m");
279 // Calculate nb of post for IP
280 $nb_post_ip = 0;
281 if ($nb_post_max > 0) { // Calculate only if there is a limit to check
282 $sql = "SELECT COUNT(rowid) as nb_don";
283 $sql .= " FROM ".MAIN_DB_PREFIX."don";
284 $sql .= " WHERE ip = '".$db->escape($donation->ip)."'";
285 $sql .= " AND datedon > '".$db->idate($minmonthpost)."'";
286 $resql = $db->query($sql);
287 if ($resql) {
288 $num = $db->num_rows($resql);
289 $i = 0;
290 while ($i < $num) {
291 $i++;
292 $obj = $db->fetch_object($resql);
293 $nb_post_ip = $obj->nb_don;
294 }
295 }
296 }
297
298 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
299 $error++;
300 $langs->load('errors');
301 $errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
302 array_push($donation->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
303 }
304
305 // Fill array 'array_options' with data from add form
306 $extrafields->fetch_name_optionals_label($donation->table_element);
307 $ret = $extrafields->setOptionalsFromPost(null, $donation);
308 if ($ret < 0) {
309 $error++;
310 $errmsg .= $donation->error;
311 }
312
313 if (!$error) {
314 $result = $donation->create($user);
315 if ($result > 0) {
316 if (!empty($backtopage)) {
317 $urlback = $backtopage;
318 } else {
319 $urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
320 }
321
322 if (getDolGlobalString('DONATION_NEWFORM_PAYONLINE') && getDolGlobalString('DONATION_NEWFORM_PAYONLINE') != '-1') {
323 $urlback = getOnlinePaymentUrl(0, 'donation', (string) $donation->id, 0, '');
324
325 if (GETPOST('email')) {
326 $urlback .= '&email='.urlencode(GETPOST('email'));
327 }
328 if (getDolGlobalString('DONATION_NEWFORM_PAYONLINE') != '-1' && getDolGlobalString('DONATION_NEWFORM_PAYONLINE') != 'all') {
329 $urlback .= '&paymentmethod='.urlencode(getDolGlobalString('DONATION_NEWFORM_PAYONLINE'));
330 }
331 } else {
332 if (!empty($entity)) {
333 $urlback .= '&entity='.((int) $entity);
334 }
335 }
336 } else {
337 $error++;
338 $errmsg .= implode('<br>', $donation->errors);
339 }
340 }
341 }
342
343 if (!$error) {
344 $db->commit();
345
346 header("Location: ".$urlback);
347 exit;
348 } else {
349 $db->rollback();
350 $action = "create";
351 }
352}
353
354// Action called after a submitted was send and donation created successfully
355// If we ask to redirect to the payment page, we never go here because a redirect was done to the payment url.
356// backtopage parameter with an url was set on donation submit page, we never go here because a redirect was done to this url.
357
358if (empty($reshook) && $action == 'added') { // Test on permission not required here
359 llxHeaderVierge($langs->trans("NewDonationForm"));
360
361 // If we have not been redirected
362 print '<br><br>';
363 print '<div class="center">';
364 print $langs->trans("NewDonationbyWeb").'<br>';
365 print '</div>';
366
368 exit;
369}
370
371
372/*
373 * View
374 */
375
376$form = new Form($db);
377$formcompany = new FormCompany($db);
378$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
379
380if (isModEnabled('project') || isModEnabled('eventorganization')) {
381 $project = new Project($db);
382 $result = $project->fetch(GETPOSTINT('project_id'));
383 if ($result > 0) {
384 $projectId = $project->id;
385 $projectTitle = $project->title;
386 }
387}
388
389
390llxHeaderVierge($langs->trans("NewDonation"));
391
392print '<br>';
393print load_fiche_titre(img_picto('', '', 'class="pictofixedwidth"').' &nbsp; '.$langs->trans("NewDonation"), '', '', 0, '', 'center');
394
395
396print '<div align="center">';
397print '<div id="divsubscribe">';
398
399print '<div class="center subscriptionformhelptext opacitymedium justify">';
400print $langs->trans("NewDonationDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
401
402print '</div>';
403
404dol_htmloutput_errors($errmsg);
406
407// Print form
408print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newdonation">'."\n";
409print '<input type="hidden" name="token" value="'.newToken().'" />';
410print '<input type="hidden" name="entity" value="'.$entity.'" />';
411print '<input type="hidden" name="page_y" value="" />';
412print '<input type="hidden" name="project_id" value="'.GETPOST('project_id').'" />';
413
414if (!$action || $action == 'create') {
415 print '<input type="hidden" name="action" value="add" />';
416 print '<br>';
417
418 $messagemandatory = '<span class="">'.$langs->trans("FieldsWithAreMandatory", '*').'</span>';
419 //print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
420 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
421
422 print dol_get_fiche_head();
423
424 print '<script type="text/javascript">
425 jQuery(document).ready(function () {
426 jQuery(document).ready(function () {
427 jQuery("#selectcountry_id").change(function() {
428 document.newdonation.action.value="create";
429 document.newdonation.submit();
430 });
431 });
432 });
433 </script>';
434
435 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
436
437 // Add a specific style or table head for the project row
438 if ((isModEnabled('project') || isModEnabled('eventorganization')) && !empty($projectTitle)) {
439 print '<tr>';
440 print '<td class="project-label">' . $langs->trans("project") . '</td>';
441 print '<td class="project-value">' . dol_escape_htmltag($projectTitle) . '</td>';
442 print '</tr>';
443 }
444
445 // Anonymous
446 /*
447 print '<tr>';
448 print '<td class="titlefieldcreate"><label for="anonymous">'.$form->textwithpicto($langs->trans("donAnonymous"), $langs->trans("AnonymousDonationTooltip")).'</label></td>';
449 print '<td><input type="checkbox" name="anonymous" id="anonymous" '.(GETPOST('anonymous') ? 'checked' : '').'></td>';
450 print '</tr>'."\n";
451 print '<script type="text/javascript">
452 jQuery(document).ready(function () {
453 function toggleFields() {
454 if (jQuery("#anonymous").is(":checked")) {
455 jQuery("#tablesubscribe").find("#trcompany, #trfirstname, #trlastname, #tremail, #tradress, #trzip, #trcountry, #trstate, #trseparator").hide();
456 } else {
457 jQuery("#tablesubscribe tr").show();
458 }
459 }
460
461 // Initial toggle on page load
462 toggleFields();
463
464 // Toggle fields on checkbox change
465 jQuery("#anonymous").change(function () {
466 toggleFields();
467 });
468 });
469 </script>';
470 */
471
472 // EMail
473 print '<tr id="tremail"><td class="fieldrequired" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans("Email").'</td><td>';
474 //print img_picto('', 'email', 'class="pictofixedwidth"');
475 print '<input type="email" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('email', "aZ09arobase")).'"></td></tr>'."\n";
476
477 // Company
478 print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td>';
479 print img_picto('', 'company', 'class="pictofixedwidth paddingright"');
480 print '<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
481
482 // Firstname
483 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";
484
485 // Lastname
486 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";
487
488 // Address
489 print '<tr id="tradress"><td>'.$langs->trans("Address").'</td><td>'."\n";
490 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";
491
492 // Zip / Town
493 print '<tr id="trzip"><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
494 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
495 print ' / ';
496 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
497 print '</td></tr>';
498
499 // Country
500 print '<tr id="trcountry"><td>'.$langs->trans('Country').'</td><td>';
501 print img_picto('', 'country', 'class="pictofixedwidth paddingright"');
502 $country_id = GETPOSTINT('country_id');
503 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
504 $country_code = dol_user_country();
505 //print $country_code;
506 if ($country_code) {
507 $new_country_id = getCountry($country_code, '3', $db, $langs);
508 //print 'xxx'.$country_code.' - '.$new_country_id;
509 if ($new_country_id) {
510 $country_id = $new_country_id;
511 }
512 }
513 }
514 $country_code = getCountry($country_id, '2', $db, $langs);
515 print $form->select_country($country_id, 'country_id');
516 print '</td></tr>';
517
518 // State
519 if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
520 print '<tr id="trstate"><td>'.$langs->trans('State').'</td><td>';
521 if ($country_code) {
522 print img_picto('', 'state', 'class="pictofixedwidth paddingright"');
523 print $formcompany->select_state(GETPOSTINT("state_id"), $country_code);
524 }
525 print '</td></tr>';
526 }
527
528 // Other attributes
529 $parameters['tpl_context'] = 'public'; // define template context to public
530 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
531
532 print '<tr id="trseparator"><td colspan="2"><hr></td></tr>';
533
534 // Public
535 $publiclabel = $langs->trans("publicDonationFieldHelp", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'));
536 print '<tr><td><label for="public">'.$form->textwithpicto($langs->trans("donationPublic"), $publiclabel).'</label></td>';
537 print '<td><input type="checkbox" name="public" id="public"></td></tr>'."\n";
538
539 if (getDolGlobalString('DONATION_NEWFORM_PAYONLINE')) {
540 $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : '');
541
542 // - If a min is set, we take it into account
543 $amount = max(0, (float) $amount, (float) getDolGlobalInt("DONATION_MIN_AMOUNT"));
544
545 // Clean the amount
546 $amount = price2num($amount);
547 $showedamount = $amount > 0 ? $amount : 0;
548 print '<tr><td>'.$langs->trans("donationAmount");
549 print ' <span>*</span></td><td class="nowrap">';
550
551 print '<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.'">';
552 print ' '.$langs->trans("Currency".getDolCurrency()).'<span class="opacitymedium hideifautoturnover"> - ';
553 print $langs->trans("AnyAmountForDonation");
554 print '</span>';
555
556 print '</td></tr>';
557 }
558
559 // Comments
560 print '<tr>';
561 print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
562 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>';
563 print '</tr>'."\n";
564
565 // Display Captcha code if is enabled
566 if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_DONATION') && is_object($captchaobj)) {
567 print '<tr><td class="titlefield"><label><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td><br>';
568 if (method_exists($captchaobj, 'getCaptchaCodeForForm')) {
569 print $captchaobj->getCaptchaCodeForForm(''); // @phan-suppress-current-line PhanUndeclaredMethod
570 } else {
571 print 'Error, the captcha handler '.get_class($captchaobj).' does not have any method getCaptchaCodeForForm()';
572 }
573 print '<br></td></tr>';
574 }
575 print "</table>\n";
576
577 print dol_get_fiche_end();
578
579 // Save / Submit
580 print '<div class="center">';
581 print '<input type="submit" value="'.$langs->trans("GetDonationButtonLabel").'" id="submitsave" class="button">';
582 if (!empty($backtopage)) {
583 print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
584 }
585 print '</div>';
586
587
588 print "</form>\n";
589 print "<br>";
590 print '</div></div>';
591}
592
593//htmlPrintOnlineFooter($mysoc, $langs);
595
596$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage donations.
Definition don.class.php:42
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=[], $ws='')
Show header for new prospect.
Definition new.php:123
llxFooterVierge()
Show footer for new societe.
Definition new.php:144
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.
global $mysoc
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0, $tz='')
Add a delay to a date.
Definition date.lib.php:127
dol_now($mode='gmt')
Return date for now.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
dol_user_country()
Return country code for current user.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.
Definition html.lib.php:542
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition html.lib.php:740
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
dol_htmloutput_events($disabledoutputofmessages=0)
Print formatted messages to output (Used to show messages on html output).
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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)
Definition html.lib.php:183
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.