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