dolibarr 20.0.0
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-2019 Frédéric France <frederic.france@netlogic.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 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
43if (!defined('NOLOGIN')) {
44 define("NOLOGIN", 1); // This means this output page does not require to be logged.
45}
46if (!defined('NOCSRFCHECK')) {
47 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
48}
49if (!defined('NOBROWSERNOTIF')) {
50 define('NOBROWSERNOTIF', '1');
51}
52
53
54// For MultiCompany module.
55// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
56// Because 2 entities can have the same ref.
57$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
58if (is_numeric($entity)) {
59 define("DOLENTITY", $entity);
60}
61
62
63// Load Dolibarr environment
64require '../../main.inc.php';
65require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
66require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
67require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
68require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
69require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
70require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
71require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php';
72require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
73
74// Init vars
75$backtopage = GETPOST('backtopage', 'alpha');
76$action = GETPOST('action', 'aZ09');
77
78$errmsg = '';
79$num = 0;
80$error = 0;
81
82// Load translation files
83$langs->loadLangs(array("main", "members", "companies", "install", "other", "errors"));
84
85// Security check
86if (!isModEnabled('member')) {
87 httponly_accessforbidden('Module Membership not enabled');
88}
89
90if (!getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
91 httponly_accessforbidden("Auto subscription form for public visitors has not been enabled");
92}
93
94// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
95$hookmanager->initHooks(array('publicnewmembercard', 'globalcard'));
96
97$extrafields = new ExtraFields($db);
98
99$object = new Adherent($db);
100
101$user->loadDefaultValues();
102
103
115function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
116{
117 global $user, $conf, $langs, $mysoc;
118
119 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
120
121 print '<body id="mainbody" class="publicnewmemberform">';
122
123 // Define urllogo
124 $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
125
126 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
127 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
128 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
129 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
130 } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
131 $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
132 }
133
134 print '<header class="center">';
135
136 // Output html code for logo
137 if ($urllogo) {
138 print '<div class="backgreypublicpayment">';
139 print '<div class="logopublicpayment">';
140 print '<img id="dolpaymentlogo" src="'.$urllogo.'">';
141 print '</div>';
142 if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) {
143 print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
144 }
145 print '</div>';
146 }
147
148 if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) {
149 print '<div class="backimagepublicregistration">';
150 print '<img id="idEVENTORGANIZATION_IMAGE_PUBLIC_INTERFACE" src="' . getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION').'">';
151 print '</div>';
152 }
153
154 print '</header>';
155
156 print '<div class="divmainbodylarge">';
157}
158
165{
166 global $conf, $langs;
167
168 print '</div>';
169
170 printCommonFooter('public');
171
172 if (!empty($conf->use_javascript_ajax)) {
173 print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
174 print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.'"></script>'."\n";
175 }
176
177 print "</body>\n";
178 print "</html>\n";
179}
180
181
182
183/*
184 * Actions
185 */
186
187$parameters = array();
188// Note that $action and $object may have been modified by some hooks
189$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
190if ($reshook < 0) {
191 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
192}
193
194// Action called when page is submitted
195if (empty($reshook) && $action == 'add') {
196 $error = 0;
197 $urlback = '';
198
199 $db->begin();
200
201 // test if login already exists
202 if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {
203 if (!GETPOST('login')) {
204 $error++;
205 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"))."<br>\n";
206 }
207 $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login = '".$db->escape(GETPOST('login'))."'";
208 $result = $db->query($sql);
209 if ($result) {
210 $num = $db->num_rows($result);
211 }
212 if ($num != 0) {
213 $error++;
214 $langs->load("errors");
215 $errmsg .= $langs->trans("ErrorLoginAlreadyExists")."<br>\n";
216 }
217 if (!GETPOSTISSET("pass1") || !GETPOSTISSET("pass2") || GETPOST("pass1", 'none') == '' || GETPOST("pass2", 'none') == '' || GETPOST("pass1", 'none') != GETPOST("pass2", 'none')) {
218 $error++;
219 $langs->load("errors");
220 $errmsg .= $langs->trans("ErrorPasswordsMustMatch")."<br>\n";
221 }
222 if (!GETPOST('email')) {
223 $error++;
224 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."<br>\n";
225 }
226 }
227 if (GETPOST('typeid') <= 0) {
228 $error++;
229 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."<br>\n";
230 }
231 if (!in_array(GETPOST('morphy'), array('mor', 'phy'))) {
232 $error++;
233 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."<br>\n";
234 }
235 if (!GETPOST('lastname')) {
236 $error++;
237 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
238 }
239 if (!GETPOST('firstname')) {
240 $error++;
241 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
242 }
243 if (getDolGlobalString('ADHERENT_MAIL_REQUIRED') && empty(GETPOST('email'))) {
244 $error++;
245 $errmsg .= $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Email'))."<br>\n";
246 } elseif (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
247 $langs->load('errors');
248 $error++;
249 $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
250 }
251 $birthday = dol_mktime(GETPOSTINT("birthhour"), GETPOSTINT("birthmin"), GETPOSTINT("birthsec"), GETPOSTINT("birthmonth"), GETPOSTINT("birthday"), GETPOSTINT("birthyear"));
252 if (GETPOST("birthmonth") && empty($birthday)) {
253 $error++;
254 $langs->load("errors");
255 $errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n";
256 }
257 if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) {
258 if (GETPOST("morphy") == 'mor' && GETPOST('budget') <= 0) {
259 $error++;
260 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("TurnoverOrBudget"))."<br>\n";
261 }
262 }
263
264 // Check Captcha code if is enabled
265 if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) {
266 $sessionkey = 'dol_antispam_value';
267 $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower(GETPOST('code'))));
268 if (!$ok) {
269 $error++;
270 $errmsg .= $langs->trans("ErrorBadValueForCode")."<br>\n";
271 $action = '';
272 }
273 }
274
275 $public = GETPOSTISSET('public') ? 1 : 0;
276
277 if (!$error) {
278 // E-mail looks OK and login does not exist
279 $adh = new Adherent($db);
280 $adh->statut = -1;
281 $adh->public = $public;
282 $adh->firstname = GETPOST('firstname');
283 $adh->lastname = GETPOST('lastname');
284 $adh->gender = GETPOST('gender');
285 $adh->civility_id = GETPOST('civility_id');
286 $adh->company = GETPOST('societe');
287 $adh->societe = $adh->company;
288 $adh->address = GETPOST('address');
289 $adh->zip = GETPOST('zipcode');
290 $adh->town = GETPOST('town');
291 $adh->email = GETPOST('email');
292 if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {
293 $adh->login = GETPOST('login');
294 $adh->pass = GETPOST('pass1');
295 }
296 $adh->photo = GETPOST('photo');
297 $adh->country_id = getDolGlobalInt("MEMBER_NEWFORM_FORCECOUNTRYCODE", GETPOSTINT('country_id'));
298 $adh->state_id = GETPOSTINT('state_id');
299 $adh->typeid = getDolGlobalInt("MEMBER_NEWFORM_FORCETYPE", GETPOSTINT('typeid'));
300 $adh->note_private = GETPOST('note_private');
301 $adh->morphy = getDolGlobalString("MEMBER_NEWFORM_FORCEMORPHY", GETPOST('morphy'));
302 $adh->birth = $birthday;
303
304 $adh->ip = getUserRemoteIP();
305
306 $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
307 $now = dol_now();
308 $minmonthpost = dol_time_plus_duree($now, -1, "m");
309 // Calculate nb of post for IP
310 $nb_post_ip = 0;
311 if ($nb_post_max > 0) { // Calculate only if there is a limit to check
312 $sql = "SELECT COUNT(ref) as nb_adh";
313 $sql .= " FROM ".MAIN_DB_PREFIX."adherent";
314 $sql .= " WHERE ip = '".$db->escape($adh->ip)."'";
315 $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
316 $resql = $db->query($sql);
317 if ($resql) {
318 $num = $db->num_rows($resql);
319 $i = 0;
320 while ($i < $num) {
321 $i++;
322 $obj = $db->fetch_object($resql);
323 $nb_post_ip = $obj->nb_adh;
324 }
325 }
326 }
327
328
329 // Fill array 'array_options' with data from add form
330 $extrafields->fetch_name_optionals_label($adh->table_element);
331 $ret = $extrafields->setOptionalsFromPost(null, $adh);
332 if ($ret < 0) {
333 $error++;
334 $errmsg .= $adh->error;
335 }
336
337 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
338 $error++;
339 $errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
340 array_push($adh->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
341 }
342
343 if (!$error) {
344 $result = $adh->create($user);
345 if ($result > 0) {
346 require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
347 $object = $adh;
348
349 $adht = new AdherentType($db);
350 $adht->fetch($object->typeid);
351
352 if ($object->email) {
353 $subject = '';
354 $msg = '';
355
356 // Send subscription email
357 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
358 $formmail = new FormMail($db);
359 // Set output language
360 $outputlangs = new Translate('', $conf);
361 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
362 // Load traductions files required by page
363 $outputlangs->loadLangs(array("main", "members"));
364 // Get email content from template
365 $arraydefaultmessage = null;
366 $labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER');
367
368 if (!empty($labeltouse)) {
369 $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
370 }
371
372 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
373 $subject = $arraydefaultmessage->topic;
374 $msg = $arraydefaultmessage->content;
375 }
376
377 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
378 complete_substitutions_array($substitutionarray, $outputlangs, $object);
379 $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
380 $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
381
382 if ($subjecttosend && $texttosend) {
383 $moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
384
385 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
386 }
387 /*if ($result < 0) {
388 $error++;
389 setEventMessages($object->error, $object->errors, 'errors');
390 }*/
391 }
392
393 // Send email to the foundation to say a new member subscribed with autosubscribe form
394 if (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') && getDolGlobalString('ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT') &&
395 getDolGlobalString('ADHERENT_AUTOREGISTER_NOTIF_MAIL')) {
396 // Define link to login card
397 $appli = constant('DOL_APPLICATION_TITLE');
398 if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
399 $appli = getDolGlobalString('MAIN_APPLICATION_TITLE');
400 if (preg_match('/\d\.\d/', $appli)) {
401 if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
402 $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
403 }
404 } else {
405 $appli .= " ".DOL_VERSION;
406 }
407 } else {
408 $appli .= " ".DOL_VERSION;
409 }
410
411 $to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL);
412 $from = getDolGlobalString('ADHERENT_MAIL_FROM');
413 $mailfile = new CMailFile(
414 '['.$appli.'] ' . getDolGlobalString('ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'),
415 $to,
416 $from,
417 $adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL),
418 array(),
419 array(),
420 array(),
421 "",
422 "",
423 0,
424 -1
425 );
426
427 if (!$mailfile->sendfile()) {
428 dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR);
429 }
430 }
431
432 // Auto-create thirdparty on member creation
433 if (getDolGlobalString('ADHERENT_DEFAULT_CREATE_THIRDPARTY')) {
434 $company = new Societe($db);
435 $result = $company->create_from_member($adh);
436 if ($result < 0) {
437 $error++;
438 $errmsg .= implode('<br>', $company->errors);
439 }
440 }
441
442 if (!empty($backtopage)) {
443 $urlback = $backtopage;
444 } elseif (getDolGlobalString('MEMBER_URL_REDIRECT_SUBSCRIPTION')) {
445 $urlback = getDolGlobalString('MEMBER_URL_REDIRECT_SUBSCRIPTION');
446 // TODO Make replacement of __AMOUNT__, etc...
447 } else {
448 $urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
449 }
450
451 if (getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') && getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') != '-1') {
452 if (empty($adht->caneditamount)) { // If edition of amount not allowed
453 // TODO Check amount is same than the amount required for the type of member or if not defined as the default amount into $conf->global->MEMBER_NEWFORM_AMOUNT
454 // It is not so important because a test is done on return of payment validation.
455 }
456
457 $urlback = getOnlinePaymentUrl(0, 'member', $adh->ref, price2num(GETPOST('amount', 'alpha'), 'MT'), '', 0);
458
459 if (GETPOST('email')) {
460 $urlback .= '&email='.urlencode(GETPOST('email'));
461 }
462 if (getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') != '-1' && getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') != 'all') {
463 $urlback .= '&paymentmethod='.urlencode(getDolGlobalString('MEMBER_NEWFORM_PAYONLINE'));
464 }
465 } else {
466 if (!empty($entity)) {
467 $urlback .= '&entity='.((int) $entity);
468 }
469 }
470 } else {
471 $error++;
472 $errmsg .= implode('<br>', $adh->errors);
473 }
474 }
475 }
476
477 if (!$error) {
478 $db->commit();
479
480 header("Location: ".$urlback);
481 exit;
482 } else {
483 $db->rollback();
484 $action = "create";
485 }
486}
487
488// Action called after a submitted was send and member created successfully
489// If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to an url, we never go here because a redirect was done to this url. Same if we ask to redirect to the payment page.
490// backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
491
492if (empty($reshook) && $action == 'added') {
493 llxHeaderVierge($langs->trans("NewMemberForm"));
494
495 // If we have not been redirected
496 print '<br><br>';
497 print '<div class="center">';
498 print $langs->trans("NewMemberbyWeb");
499 print '</div>';
500
502 exit;
503}
504
505
506
507/*
508 * View
509 */
510
511$form = new Form($db);
512$formcompany = new FormCompany($db);
513$adht = new AdherentType($db);
514$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
515
516
517llxHeaderVierge($langs->trans("NewSubscription"));
518
519print '<br>';
520print load_fiche_titre(img_picto('', 'member_nocolor', 'class="pictofixedwidth"').' &nbsp; '.$langs->trans("NewSubscription"), '', '', 0, 0, 'center');
521
522
523print '<div align="center">';
524print '<div id="divsubscribe">';
525
526print '<div class="center subscriptionformhelptext opacitymedium justify">';
527if (getDolGlobalString('MEMBER_NEWFORM_TEXT')) {
528 print $langs->trans(getDolGlobalString('MEMBER_NEWFORM_TEXT'))."<br>\n";
529} else {
530 print $langs->trans("NewSubscriptionDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
531}
532print '</div>';
533
534dol_htmloutput_errors($errmsg);
536
537// Print form
538print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
539print '<input type="hidden" name="token" value="'.newToken().'" />';
540print '<input type="hidden" name="entity" value="'.$entity.'" />';
541print '<input type="hidden" name="page_y" value="" />';
542
543if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFORM_FORCETYPE') || $action == 'create') {
544 print '<input type="hidden" name="action" value="add" />';
545 print '<br>';
546
547 $messagemandatory = '<span class="">'.$langs->trans("FieldsWithAreMandatory", '*').'</span>';
548 //print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
549 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
550
551 print dol_get_fiche_head();
552
553 print '<script type="text/javascript">
554 jQuery(document).ready(function () {
555 jQuery(document).ready(function () {
556 function initmorphy()
557 {
558 console.log("Call initmorphy");
559 if (jQuery("#morphy").val() == \'phy\') {
560 jQuery("#trcompany").hide();
561 }
562 if (jQuery("#morphy").val() == \'mor\') {
563 jQuery("#trcompany").show();
564 }
565 }
566 initmorphy();
567 jQuery("#morphy").change(function() {
568 initmorphy();
569 });
570 jQuery("#selectcountry_id").change(function() {
571 document.newmember.action.value="create";
572 document.newmember.submit();
573 });
574 jQuery("#typeid").change(function() {
575 document.newmember.action.value="create";
576 document.newmember.submit();
577 });
578 });
579 });
580 </script>';
581
582
583 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
584
585 // Type
586 if (!getDolGlobalString('MEMBER_NEWFORM_FORCETYPE')) {
587 $listoftype = $adht->liste_array();
588 $tmp = array_keys($listoftype);
589 $defaulttype = '';
590 $isempty = 1;
591 if (count($listoftype) == 1) {
592 $defaulttype = $tmp[0];
593 $isempty = 0;
594 }
595 print '<tr><td class="titlefield classfortooltip" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans("Type").' <span class="star">*</span></td><td>';
596 print $form->selectarray("typeid", $adht->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty);
597 print '</td></tr>'."\n";
598 } else {
599 $adht->fetch(getDolGlobalInt('MEMBER_NEWFORM_FORCETYPE'));
600 print '<input type="hidden" id="typeid" name="typeid" value="' . getDolGlobalString('MEMBER_NEWFORM_FORCETYPE').'">';
601 }
602
603 // Moral/Physic attribute
604 $morphys = array();
605 $morphys["phy"] = $langs->trans("Physical");
606 $morphys["mor"] = $langs->trans("Moral");
607 if (!getDolGlobalString('MEMBER_NEWFORM_FORCEMORPHY')) {
608 print '<tr class="morphy"><td class="titlefield classfortooltip" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans('MemberNature').' <span class="star">*</span></td><td>'."\n";
609 print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1);
610 print '</td></tr>'."\n";
611 } else {
612 //print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY];
613 print '<input type="hidden" id="morphy" name="morphy" value="' . getDolGlobalString('MEMBER_NEWFORM_FORCEMORPHY').'">';
614 }
615
616 // Company // TODO : optional hide
617 print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td>';
618 print img_picto('', 'company', 'class="pictofixedwidth paddingright"');
619 print '<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
620
621 // Title
622 if (getDolGlobalString('MEMBER_NEWFORM_ASK_TITLE')) {
623 print '<tr><td class="titlefield">'.$langs->trans('UserTitle').'</td><td>';
624 print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'</td></tr>'."\n";
625 }
626
627 // Firstname
628 print '<tr><td class="classfortooltip" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans("Firstname").' <span class="star">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'"></td></tr>'."\n";
629
630 // Lastname
631 print '<tr><td class="classfortooltip" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans("Lastname").' <span class="star">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'"></td></tr>'."\n";
632
633 // EMail
634 print '<tr><td class="'.(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? 'classfortooltip' : '').'" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans("Email").(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? ' <span class="star">*</span>' : '').'</td><td>';
635 //print img_picto('', 'email', 'class="pictofixedwidth"');
636 print '<input type="text" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
637
638 // Login
639 if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {
640 print '<tr><td>'.$langs->trans("Login").' <span class="star">*</span></td><td><input type="text" name="login" maxlength="50" class="minwidth100"value="'.dol_escape_htmltag(GETPOST('login')).'"></td></tr>'."\n";
641 print '<tr><td>'.$langs->trans("Password").' <span class="star">*</span></td><td><input type="password" maxlength="128" name="pass1" class="minwidth100" value="'.dol_escape_htmltag(GETPOST("pass1", "none", 2)).'"></td></tr>'."\n";
642 print '<tr><td>'.$langs->trans("PasswordRetype").' <span class="star">*</span></td><td><input type="password" maxlength="128" name="pass2" class="minwidth100" value="'.dol_escape_htmltag(GETPOST("pass2", "none", 2)).'"></td></tr>'."\n";
643 }
644
645 // Gender
646 print '<tr><td>'.$langs->trans("Gender").'</td>';
647 print '<td>';
648 $arraygender = array('man' => $langs->trans("Genderman"), 'woman' => $langs->trans("Genderwoman"), 'other' => $langs->trans("Genderother"));
649 print $form->selectarray('gender', $arraygender, GETPOST('gender', 'alphanohtml'), 1, 0, 0, '', 0, 0, 0, '', '', 1);
650 print '</td></tr>';
651
652 // Address
653 print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
654 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";
655
656 // Zip / Town
657 print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
658 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
659 print ' / ';
660 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
661 print '</td></tr>';
662
663 // Country
664 print '<tr><td>'.$langs->trans('Country').'</td><td>';
665 print img_picto('', 'country', 'class="pictofixedwidth paddingright"');
666 $country_id = GETPOSTINT('country_id');
667 if (!$country_id && getDolGlobalString('MEMBER_NEWFORM_FORCECOUNTRYCODE')) {
668 $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
669 }
670 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
671 $country_code = dol_user_country();
672 //print $country_code;
673 if ($country_code) {
674 $new_country_id = getCountry($country_code, 3, $db, $langs);
675 //print 'xxx'.$country_code.' - '.$new_country_id;
676 if ($new_country_id) {
677 $country_id = $new_country_id;
678 }
679 }
680 }
681 $country_code = getCountry($country_id, 2, $db, $langs);
682 print $form->select_country($country_id, 'country_id');
683 print '</td></tr>';
684
685 // State
686 if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
687 print '<tr><td>'.$langs->trans('State').'</td><td>';
688 if ($country_code) {
689 print img_picto('', 'state', 'class="pictofixedwidth paddingright"');
690 print $formcompany->select_state(GETPOST("state_id"), $country_code);
691 }
692 print '</td></tr>';
693 }
694
695 // Birthday
696 print '<tr id="trbirth" class="trbirth"><td>'.$langs->trans("DateOfBirth").'</td><td>';
697 print $form->selectDate(!empty($birthday) ? $birthday : "", 'birth', 0, 0, 1, "newmember", 1, 0);
698 print '</td></tr>'."\n";
699
700 // Photo
701 print '<tr><td>'.$langs->trans("URLPhoto").'</td><td><input type="text" name="photo" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('photo')).'"></td></tr>'."\n";
702
703 // Public
704 if (getDolGlobalString('MEMBER_PUBLIC_ENABLED')) {
705 $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : '');
706 $publiclabel = $langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist);
707 print '<tr><td>'.$form->textwithpicto($langs->trans("MembershipPublic"), $publiclabel).'</td><td><input type="checkbox" name="public"></td></tr>'."\n";
708 }
709
710 // Other attributes
711 $parameters['tpl_context'] = 'public'; // define template context to public
712 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
713
714 // Comments
715 print '<tr>';
716 print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
717 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>';
718 print '</tr>'."\n";
719
720 // Add specific fields used by Dolibarr foundation for example
721 // TODO Move this into generic feature.
722 if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) {
723 $arraybudget = array('50' => '<= 100 000', '100' => '<= 200 000', '200' => '<= 500 000', '300' => '<= 1 500 000', '600' => '<= 3 000 000', '1000' => '<= 5 000 000', '2000' => '5 000 000+');
724 print '<tr id="trbudget" class="trcompany"><td>'.$langs->trans("TurnoverOrBudget").' <span class="star">*</span></td><td>';
725 print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1);
726 print ' € or $';
727
728 print '<script type="text/javascript">
729 jQuery(document).ready(function () {
730 initturnover();
731 jQuery("#morphy").change(function() {
732 initturnover();
733 });
734 jQuery("#budget").change(function() {
735 if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); }
736 else { jQuery("#budget").val(\'\'); }
737 });
738 /*jQuery("#typeid").change(function() {
739 if (jQuery("#typeid").val()==1) { jQuery("#morphy").val(\'mor\'); }
740 if (jQuery("#typeid").val()==2) { jQuery("#morphy").val(\'phy\'); }
741 if (jQuery("#typeid").val()==3) { jQuery("#morphy").val(\'mor\'); }
742 if (jQuery("#typeid").val()==4) { jQuery("#morphy").val(\'mor\'); }
743 initturnover();
744 });*/
745 function initturnover() {
746 console.log("Switch mor/phy");
747 if (jQuery("#morphy").val()==\'phy\') {
748 jQuery(".amount").val(20);
749 jQuery("#trbudget").hide();
750 jQuery("#trcompany").hide();
751 }
752 if (jQuery("#morphy").val()==\'mor\') {
753 jQuery(".amount").val(\'\');
754 jQuery("#trcompany").show();
755 jQuery("#trbirth").hide();
756 jQuery("#trbudget").show();
757 jQuery(".hideifautoturnover").hide();
758 if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); }
759 else { jQuery("#budget").val(\'\'); }
760 }
761 }
762 });
763 </script>';
764 print '</td></tr>'."\n";
765 }
766
767 if (getDolGlobalString('MEMBER_NEWFORM_PAYONLINE')) {
768 $typeid = getDolGlobalInt('MEMBER_NEWFORM_FORCETYPE', GETPOSTINT('typeid'));
769 $adht = new AdherentType($db);
770 $adht->fetch($typeid);
771 $caneditamount = $adht->caneditamount;
772 $amountbytype = $adht->amountByType(1); // Load the array of amount per type
773
774 // Set amount for the subscription from the the type and options:
775 // - First check the amount of the member type.
776 $amount = empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid];
777 // - If not found, take the default amount only if the user is authorized to edit it
778 if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) {
779 $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT');
780 }
781 // - If not set, we accept to have amount defined as parameter (for backward compatibility).
782 if (empty($amount)) {
783 $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : '');
784 }
785 // - If a min is set, we take it into account
786 $amount = max(0, (float) $amount, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT"));
787
788 // Clean the amount
789 $amount = price2num($amount);
790 $showedamount = $amount > 0 ? $amount : 0;
791 // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe'
792 print '<tr><td>'.$langs->trans("Subscription");
793 if (getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO')) {
794 print ' - <a href="' . getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
795 }
796 print '</td><td class="nowrap">';
797
798 if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) {
799 $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT');
800 }
801
802 if ($caneditamount) {
803 print '<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.'">';
804 print ' '.$langs->trans("Currency".$conf->currency).'<span class="opacitymedium hideifautoturnover"> - ';
805 print $amount > 0 ? $langs->trans("AnyAmountWithAdvisedAmount", price($amount, 0, $langs, 1, -1, -1, $conf->currency)) : $langs->trans("AnyAmountWithoutAdvisedAmount");
806 print '</span>';
807 } else {
808 print '<input type="hidden" name="amount" id="amount" class="flat amount" value="'.$showedamount.'">';
809 print '<input type="text" name="amount" id="amounthidden" class="flat amount width50" disabled value="'.$showedamount.'">';
810 print ' '.$langs->trans("Currency".$conf->currency);
811 }
812 print '</td></tr>';
813 }
814
815 // Display Captcha code if is enabled
816 if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) {
817 require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
818 print '<tr><td class="titlefield"><label for="email"><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td>';
819 print '<span class="span-icon-security inline-block">';
820 print '<input id="securitycode" placeholder="'.$langs->trans("SecurityCode").'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
821 print '</span>';
822 print '<span class="nowrap inline-block">';
823 print '<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
824 print '<a class="inline-block valignmiddle" href="'.$php_self.'" tabindex="4" data-role="button">'.img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"').'</a>';
825 print '</span>';
826 print '</td></tr>';
827 }
828
829 print "</table>\n";
830
831 print dol_get_fiche_end();
832
833 // Save / Submit
834 print '<div class="center">';
835 print '<input type="submit" value="'.$langs->trans("GetMembershipButtonLabel").'" id="submitsave" class="button">';
836 if (!empty($backtopage)) {
837 print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
838 }
839 print '</div>';
840
841
842 print "</form>\n";
843 print "<br>";
844 print '</div></div>';
845} else { // Show the table of membership types
846 // Get units
847 $measuringUnits = new CUnits($db);
848 $result = $measuringUnits->fetchAll('', '', 0, 0, array('t.active' => 1));
849 $units = array();
850 foreach ($measuringUnits->records as $lines) {
851 $units[$lines->short_label] = $langs->trans(ucfirst($lines->label));
852 }
853
854 $publiccounters = getDolGlobalString("MEMBER_COUNTERS_ARE_PUBLIC");
855 $hidevoteallowed = getDolGlobalString("MEMBER_HIDE_VOTE_ALLOWED");
856
857 $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut as status, d.morphy,";
858 $sql .= " COUNT(a.rowid) AS membercount";
859 $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
860 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as a";
861 $sql .= " ON d.rowid = a.fk_adherent_type AND a.statut > 0";
862 $sql .= " WHERE d.entity IN (".getEntity('member_type').")";
863 $sql .= " AND d.statut=1";
864 $sql .= " GROUP BY d.rowid, d.libelle, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut, d.morphy";
865
866 $result = $db->query($sql);
867 if ($result) {
868 $num = $db->num_rows($result);
869
870 print '<br><div class="div-table-responsive">';
871 print '<table class="tagtable liste">'."\n";
872 print '<input type="hidden" name="action" value="create">';
873
874 print '<tr class="liste_titre">';
875 print '<th>'.$langs->trans("Label").'</th>';
876 print '<th class="center">'.$langs->trans("MembershipDuration").'</th>';
877 print '<th class="center">'.$langs->trans("Amount").'</th>';
878 print '<th class="center">'.$langs->trans("MembersNature").'</th>';
879 if (empty($hidevoteallowed)) {
880 print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
881 }
882 if ($publiccounters) {
883 print '<th class="center">'.$langs->trans("Members").'</th>';
884 }
885 print '<th class="center">'.$langs->trans("NewSubscription").'</th>';
886 print "</tr>\n";
887
888 $i = 0;
889 while ($i < $num) {
890 $objp = $db->fetch_object($result); // Load the member type and information on it
891
892 $caneditamount = $objp->caneditamount;
893 $amountbytype = $adht->amountByType(1); // Load the array of amount per type
894
895 print '<tr class="oddeven">';
896 // Label
897 print '<td>'.dol_escape_htmltag($objp->label).'</td>';
898 // Duration
899 print '<td class="center">';
900 $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration);
901 print max(1, intval($objp->duration)).' '.$units[$unit];
902 print '</td>';
903 // Amount
904 print '<td class="center"><span class="amount nowrap">';
905
906 // Set amount for the subscription from the the type and options:
907 // - First check the amount of the member type.
908 $amount = empty($amountbytype[$objp->rowid]) ? 0 : $amountbytype[$objp->rowid];
909 // - If not found, take the default amount only if the user is authorized to edit it
910 if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) {
911 $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT');
912 }
913 // - If not set, we accept to have amount defined as parameter (for backward compatibility).
914 if (empty($amount)) {
915 $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : '');
916 }
917 // - If a min is set, we take it into account
918 $amount = max(0, (float) $amount, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT"));
919
920 $displayedamount = $amount;
921
922 if ($objp->subscription) {
923 if ($displayedamount > 0 || !$caneditamount) {
924 print price($displayedamount, 1, $langs, 1, 0, -1, $conf->currency);
925 }
926 if ($caneditamount && $displayedamount > 0) {
927 print $form->textwithpicto('', $langs->transnoentities("CanEditAmountShortForValues"), 1, 'help', '', 0, 3);
928 } elseif ($caneditamount) {
929 print $langs->transnoentities("CanEditAmountShort");
930 }
931 } else {
932 print "–"; // No subscription required
933 }
934 print '</span></td>';
935 print '<td class="center">';
936 if ($objp->morphy == 'phy') {
937 print $langs->trans("Physical");
938 } elseif ($objp->morphy == 'mor') {
939 print $langs->trans("Moral");
940 } else {
941 print $langs->trans("MorAndPhy");
942 }
943 print '</td>';
944 if (empty($hidevoteallowed)) {
945 print '<td class="center">'.yn($objp->vote).'</td>';
946 }
947 $membercount = $objp->membercount > 0 ? $objp->membercount : "–";
948 if ($publiccounters) {
949 print '<td class="center">'.$membercount.'</td>';
950 }
951 print '<td class="center"><button class="button button-save reposition" name="typeid" type="submit" name="submit" value="'.$objp->rowid.'">'.$langs->trans("GetMembershipButtonLabel").'</button></td>';
952 print "</tr>";
953 $i++;
954 }
955
956 // If no record found
957 if ($num == 0) {
958 $colspan = 8;
959 print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
960 }
961
962 print "</table>";
963 print '</div>';
964
965 print '</form>';
966 } else {
967 dol_print_error($db);
968 }
969}
970
971
973
974$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
if(!defined( 'NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined( 'NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined( 'NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined( 'NOIPCHECK')) llxHeaderVierge()
Header function.
Class to manage members of a foundation.
Class to manage members type.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class of dictionary type of thirdparty (used by imports)
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 permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new Form...
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
llxFooterVierge()
Show footer for new societe.
Definition new.php:160
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:124
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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)
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-...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
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_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
dol_htmloutput_events($disabledoutputofmessages=0)
Print formatted messages to output (Used to show messages on html output).
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getUserRemoteIP()
Return the IP of remote user.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
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.