dolibarr 24.0.0-beta
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", "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$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 $errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
301 array_push($donation->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
302 }
303
304 // Fill array 'array_options' with data from add form
305 $extrafields->fetch_name_optionals_label($donation->table_element);
306 $ret = $extrafields->setOptionalsFromPost(null, $donation);
307 if ($ret < 0) {
308 $error++;
309 $errmsg .= $donation->error;
310 }
311
312 if (!$error) {
313 $result = $donation->create($user);
314 if ($result > 0) {
315 if (!empty($backtopage)) {
316 $urlback = $backtopage;
317 } else {
318 $urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
319 }
320
321 if (getDolGlobalString('DONATION_NEWFORM_PAYONLINE') && getDolGlobalString('DONATION_NEWFORM_PAYONLINE') != '-1') {
322 $urlback = getOnlinePaymentUrl(0, 'donation', (string) $donation->id, 0, '');
323
324 if (GETPOST('email')) {
325 $urlback .= '&email='.urlencode(GETPOST('email'));
326 }
327 if (getDolGlobalString('DONATION_NEWFORM_PAYONLINE') != '-1' && getDolGlobalString('DONATION_NEWFORM_PAYONLINE') != 'all') {
328 $urlback .= '&paymentmethod='.urlencode(getDolGlobalString('DONATION_NEWFORM_PAYONLINE'));
329 }
330 } else {
331 if (!empty($entity)) {
332 $urlback .= '&entity='.((int) $entity);
333 }
334 }
335 } else {
336 $error++;
337 $errmsg .= implode('<br>', $donation->errors);
338 }
339 }
340 }
341
342 if (!$error) {
343 $db->commit();
344
345 header("Location: ".$urlback);
346 exit;
347 } else {
348 $db->rollback();
349 $action = "create";
350 }
351}
352
353// Action called after a submitted was send and donation created successfully
354// If we ask to redirect to the payment page, we never go here because a redirect was done to the payment url.
355// backtopage parameter with an url was set on donation submit page, we never go here because a redirect was done to this url.
356
357if (empty($reshook) && $action == 'added') { // Test on permission not required here
358 llxHeaderVierge($langs->trans("NewDonationForm"));
359
360 // If we have not been redirected
361 print '<br><br>';
362 print '<div class="center">';
363 print $langs->trans("NewDonationbyWeb").'<br>';
364 print '</div>';
365
367 exit;
368}
369
370
371/*
372 * View
373 */
374
375$form = new Form($db);
376$formcompany = new FormCompany($db);
377$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
378
379if (isModEnabled('project') || isModEnabled('eventorganization')) {
380 $project = new Project($db);
381 $result = $project->fetch(GETPOSTINT('project_id'));
382 if ($result > 0) {
383 $projectId = $project->id;
384 $projectTitle = $project->title;
385 }
386}
387
388
389llxHeaderVierge($langs->trans("NewDonation"));
390
391print '<br>';
392print load_fiche_titre(img_picto('', '', 'class="pictofixedwidth"').' &nbsp; '.$langs->trans("NewDonation"), '', '', 0, '', 'center');
393
394
395print '<div align="center">';
396print '<div id="divsubscribe">';
397
398print '<div class="center subscriptionformhelptext opacitymedium justify">';
399print $langs->trans("NewDonationDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
400
401print '</div>';
402
403dol_htmloutput_errors($errmsg);
405
406// Print form
407print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newdonation">'."\n";
408print '<input type="hidden" name="token" value="'.newToken().'" />';
409print '<input type="hidden" name="entity" value="'.$entity.'" />';
410print '<input type="hidden" name="page_y" value="" />';
411print '<input type="hidden" name="project_id" value="'.GETPOST('project_id').'" />';
412
413if (!$action || $action == 'create') {
414 print '<input type="hidden" name="action" value="add" />';
415 print '<br>';
416
417 $messagemandatory = '<span class="">'.$langs->trans("FieldsWithAreMandatory", '*').'</span>';
418 //print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
419 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
420
421 print dol_get_fiche_head();
422
423 print '<script type="text/javascript">
424 jQuery(document).ready(function () {
425 jQuery(document).ready(function () {
426 jQuery("#selectcountry_id").change(function() {
427 document.newdonation.action.value="create";
428 document.newdonation.submit();
429 });
430 });
431 });
432 </script>';
433
434 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
435
436 // Add a specific style or table head for the project row
437 if ((isModEnabled('project') || isModEnabled('eventorganization')) && !empty($projectTitle)) {
438 print '<tr>';
439 print '<td class="project-label">' . $langs->trans("project") . '</td>';
440 print '<td class="project-value">' . dol_escape_htmltag($projectTitle) . '</td>';
441 print '</tr>';
442 }
443
444 // Anonymous
445 /*
446 print '<tr>';
447 print '<td class="titlefieldcreate"><label for="anonymous">'.$form->textwithpicto($langs->trans("donAnonymous"), $langs->trans("AnonymousDonationTooltip")).'</label></td>';
448 print '<td><input type="checkbox" name="anonymous" id="anonymous" '.(GETPOST('anonymous') ? 'checked' : '').'></td>';
449 print '</tr>'."\n";
450 print '<script type="text/javascript">
451 jQuery(document).ready(function () {
452 function toggleFields() {
453 if (jQuery("#anonymous").is(":checked")) {
454 jQuery("#tablesubscribe").find("#trcompany, #trfirstname, #trlastname, #tremail, #tradress, #trzip, #trcountry, #trstate, #trseparator").hide();
455 } else {
456 jQuery("#tablesubscribe tr").show();
457 }
458 }
459
460 // Initial toggle on page load
461 toggleFields();
462
463 // Toggle fields on checkbox change
464 jQuery("#anonymous").change(function () {
465 toggleFields();
466 });
467 });
468 </script>';
469 */
470
471 // EMail
472 print '<tr id="tremail"><td class="fieldrequired" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans("Email").'</td><td>';
473 //print img_picto('', 'email', 'class="pictofixedwidth"');
474 print '<input type="email" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('email', "aZ09arobase")).'"></td></tr>'."\n";
475
476 // Company
477 print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td>';
478 print img_picto('', 'company', 'class="pictofixedwidth paddingright"');
479 print '<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
480
481 // Firstname
482 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";
483
484 // Lastname
485 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";
486
487 // Address
488 print '<tr id="tradress"><td>'.$langs->trans("Address").'</td><td>'."\n";
489 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";
490
491 // Zip / Town
492 print '<tr id="trzip"><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
493 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
494 print ' / ';
495 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
496 print '</td></tr>';
497
498 // Country
499 print '<tr id="trcountry"><td>'.$langs->trans('Country').'</td><td>';
500 print img_picto('', 'country', 'class="pictofixedwidth paddingright"');
501 $country_id = GETPOSTINT('country_id');
502 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
503 $country_code = dol_user_country();
504 //print $country_code;
505 if ($country_code) {
506 $new_country_id = getCountry($country_code, '3', $db, $langs);
507 //print 'xxx'.$country_code.' - '.$new_country_id;
508 if ($new_country_id) {
509 $country_id = $new_country_id;
510 }
511 }
512 }
513 $country_code = getCountry($country_id, '2', $db, $langs);
514 print $form->select_country($country_id, 'country_id');
515 print '</td></tr>';
516
517 // State
518 if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
519 print '<tr id="trstate"><td>'.$langs->trans('State').'</td><td>';
520 if ($country_code) {
521 print img_picto('', 'state', 'class="pictofixedwidth paddingright"');
522 print $formcompany->select_state(GETPOSTINT("state_id"), $country_code);
523 }
524 print '</td></tr>';
525 }
526
527 // Other attributes
528 $parameters['tpl_context'] = 'public'; // define template context to public
529 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
530
531 print '<tr id="trseparator"><td colspan="2"><hr></td></tr>';
532
533 // Public
534 $publiclabel = $langs->trans("publicDonationFieldHelp", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'));
535 print '<tr><td><label for="public">'.$form->textwithpicto($langs->trans("donationPublic"), $publiclabel).'</label></td>';
536 print '<td><input type="checkbox" name="public" id="public"></td></tr>'."\n";
537
538 if (getDolGlobalString('DONATION_NEWFORM_PAYONLINE')) {
539 $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : '');
540
541 // - If a min is set, we take it into account
542 $amount = max(0, (float) $amount, (float) getDolGlobalInt("DONATION_MIN_AMOUNT"));
543
544 // Clean the amount
545 $amount = price2num($amount);
546 $showedamount = $amount > 0 ? $amount : 0;
547 print '<tr><td>'.$langs->trans("donationAmount");
548 print ' <span>*</span></td><td class="nowrap">';
549
550 print '<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.'">';
551 print ' '.$langs->trans("Currency".getDolCurrency()).'<span class="opacitymedium hideifautoturnover"> - ';
552 print $langs->trans("AnyAmountForDonation");
553 print '</span>';
554
555 print '</td></tr>';
556 }
557
558 // Comments
559 print '<tr>';
560 print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
561 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>';
562 print '</tr>'."\n";
563
564 // Display Captcha code if is enabled
565 if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_DONATION') && is_object($captchaobj)) {
566 print '<tr><td class="titlefield"><label><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td><br>';
567 if (method_exists($captchaobj, 'getCaptchaCodeForForm')) {
568 print $captchaobj->getCaptchaCodeForForm(''); // @phan-suppress-current-line PhanUndeclaredMethod
569 } else {
570 print 'Error, the captcha handler '.get_class($captchaobj).' does not have any method getCaptchaCodeForForm()';
571 }
572 print '<br></td></tr>';
573 }
574 print "</table>\n";
575
576 print dol_get_fiche_end();
577
578 // Save / Submit
579 print '<div class="center">';
580 print '<input type="submit" value="'.$langs->trans("GetDonationButtonLabel").'" id="submitsave" class="button">';
581 if (!empty($backtopage)) {
582 print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
583 }
584 print '</div>';
585
586
587 print "</form>\n";
588 print "<br>";
589 print '</div></div>';
590}
591
592//htmlPrintOnlineFooter($mysoc, $langs);
594
595$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
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=[], $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)
Add a delay to a date.
Definition date.lib.php:126
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
dol_now($mode='gmt')
Return date for now.
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-...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getDolCurrency()
Return the main currency ('EUR', 'USD', ...)
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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_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.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.