dolibarr 22.0.5
new.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2001-2002 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
6 * Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
7 * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
8 * Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
9 * Copyright (C) 2021 Waël Almoman <info@almoman.com>
10 * Copyright (C) 2022 Udo Tamm <dev@dolibit.de>
11 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 */
26
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));
58// if (is_numeric($entity)) { // $entity is casted to int
59define("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
91// Load translation files
92$langs->loadLangs(array("main", "members", "companies", "install", "other", "errors"));
93
94if (isModEnabled('multicompany')) {
95 force_switch_entity($entity);
96}
97
98// Security check
99if (!isModEnabled('member')) {
100 httponly_accessforbidden('Module Membership not enabled');
101}
102
103if (!getDolGlobalString('MEMBER_ENABLE_PUBLIC')) {
104 httponly_accessforbidden("Auto subscription form for public visitors has not been enabled");
105}
106
107// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
108$hookmanager->initHooks(array('publicnewmembercard', 'globalcard'));
109
110$extrafields = new ExtraFields($db);
111
112$object = new Adherent($db);
113
114$user->loadDefaultValues();
115
123function force_switch_entity($newEntity)
124{
125 global $db, $conf;
126
127 if ($newEntity != $conf->entity) {
128 $conf->entity = $newEntity;
129 $conf->setValues($db);
130 }
131}
132
146function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction
147{
148 global $conf, $langs, $mysoc;
149
150 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
151
152 print '<body id="mainbody" class="publicnewmemberform">';
153
154 include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
155 htmlPrintOnlineHeader($mysoc, $langs, 1, getDolGlobalString('MEMBER_PUBLIC_INTERFACE'), 'MEMBER_IMAGE_PUBLIC_REGISTRATION');
156
157 print '<div class="divmainbodylarge">';
158}
159
167function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction
168{
169 global $conf, $langs;
170
171 print '</div>';
172
173 printCommonFooter('public');
174
175 if (!empty($conf->use_javascript_ajax)) {
176 print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
177 print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang.'"></script>'."\n";
178 }
179
180 print "</body>\n";
181 print "</html>\n";
182}
183
184
185
186/*
187 * Actions
188 */
189
190$parameters = array();
191// Note that $action and $object may have been modified by some hooks
192$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
193if ($reshook < 0) {
194 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
195}
196
197// Action called when page is submitted
198if (empty($reshook) && $action == 'add') { // Test on permission not required here. This is an anonymous form. Check is done on constant to enable and mitigation.
199 $error = 0;
200 $urlback = '';
201
202 $db->begin();
203
204 // test if login already exists
205 if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {
206 if (!GETPOST('login')) {
207 $error++;
208 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"))."<br>\n";
209 }
210 $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login = '".$db->escape(GETPOST('login'))."'";
211 $result = $db->query($sql);
212 if ($result) {
213 $num = $db->num_rows($result);
214 }
215 if ($num != 0) {
216 $error++;
217 $langs->load("errors");
218 $errmsg .= $langs->trans("ErrorLoginAlreadyExists")."<br>\n";
219 }
220 if (!GETPOSTISSET("pass1") || !GETPOSTISSET("pass2") || GETPOST("pass1", 'none') == '' || GETPOST("pass2", 'none') == '' || GETPOST("pass1", 'none') != GETPOST("pass2", 'none')) {
221 $error++;
222 $langs->load("errors");
223 $errmsg .= $langs->trans("ErrorPasswordsMustMatch")."<br>\n";
224 }
225 if (!GETPOST('email')) {
226 $error++;
227 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."<br>\n";
228 }
229 }
230 if (GETPOST('typeid') <= 0) {
231 $error++;
232 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."<br>\n";
233 }
234 if (!in_array(GETPOST('morphy'), array('mor', 'phy'))) {
235 $error++;
236 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."<br>\n";
237 }
238 if (!GETPOST('lastname')) {
239 $error++;
240 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
241 }
242 if (!GETPOST('firstname')) {
243 $error++;
244 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
245 }
246 if (getDolGlobalString('ADHERENT_MAIL_REQUIRED') && empty(GETPOST('email'))) {
247 $error++;
248 $errmsg .= $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Email'))."<br>\n";
249 } elseif (GETPOST("email", "aZ09arobase") && !isValidEmail(GETPOST("email", "aZ09arobase"))) {
250 $langs->load('errors');
251 $error++;
252 $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email", "aZ09arobase"))."<br>\n";
253 }
254 $birthday = dol_mktime(GETPOSTINT("birthhour"), GETPOSTINT("birthmin"), GETPOSTINT("birthsec"), GETPOSTINT("birthmonth"), GETPOSTINT("birthday"), GETPOSTINT("birthyear"));
255 if (GETPOST("birthmonth") && empty($birthday)) {
256 $error++;
257 $langs->load("errors");
258 $errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n";
259 }
260 if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) {
261 if (GETPOST("morphy") == 'mor' && GETPOST('budget') <= 0) {
262 $error++;
263 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("TurnoverOrBudget"))."<br>\n";
264 }
265 }
266
267 // Check Captcha code if is enabled
268 if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_MEMBER')) {
269 $sessionkey = 'dol_antispam_value';
270 $ok = (array_key_exists($sessionkey, $_SESSION) && (strtolower($_SESSION[$sessionkey]) == strtolower(GETPOST('code'))));
271 if (!$ok) {
272 $error++;
273 $errmsg .= $langs->trans("ErrorBadValueForCode")."<br>\n";
274 $action = '';
275 }
276 }
277
278 $public = GETPOSTISSET('public') ? 1 : 0;
279
280 if (!$error) {
281 // E-mail looks OK and login does not exist
282 $adh = new Adherent($db);
283 $adh->statut = -1;
284 $adh->status = -1;
285 $adh->public = $public;
286 $adh->firstname = GETPOST('firstname');
287 $adh->lastname = GETPOST('lastname');
288 $adh->gender = GETPOST('gender');
289 $adh->civility_id = GETPOST('civility_id');
290 $adh->company = GETPOST('societe');
291 $adh->societe = $adh->company;
292 $adh->address = GETPOST('address');
293 $adh->zip = GETPOST('zipcode');
294 $adh->town = GETPOST('town');
295 $adh->email = GETPOST('email', 'aZ09arobase');
296 if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {
297 $adh->login = GETPOST('login');
298 $adh->pass = GETPOST('pass1', 'password');
299 }
300 $adh->photo = GETPOST('photo');
301 $adh->country_id = getDolGlobalInt("MEMBER_NEWFORM_FORCECOUNTRYCODE", GETPOSTINT('country_id'));
302 $adh->state_id = GETPOSTINT('state_id');
303 $adh->typeid = getDolGlobalInt("MEMBER_NEWFORM_FORCETYPE", GETPOSTINT('typeid'));
304 $adh->note_private = GETPOST('note_private');
305 $adh->morphy = getDolGlobalString("MEMBER_NEWFORM_FORCEMORPHY", GETPOST('morphy'));
306 $adh->birth = $birthday;
307
308 $adh->ip = getUserRemoteIP();
309
310 $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
311 $now = dol_now();
312 $minmonthpost = dol_time_plus_duree($now, -1, "m");
313 // Calculate nb of post for IP
314 $nb_post_ip = 0;
315 if ($nb_post_max > 0) { // Calculate only if there is a limit to check
316 $sql = "SELECT COUNT(ref) as nb_adh";
317 $sql .= " FROM ".MAIN_DB_PREFIX."adherent";
318 $sql .= " WHERE ip = '".$db->escape($adh->ip)."'";
319 $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
320 $resql = $db->query($sql);
321 if ($resql) {
322 $num = $db->num_rows($resql);
323 $i = 0;
324 while ($i < $num) {
325 $i++;
326 $obj = $db->fetch_object($resql);
327 $nb_post_ip = $obj->nb_adh;
328 }
329 }
330 }
331
332
333 // Fill array 'array_options' with data from add form
334 $extrafields->fetch_name_optionals_label($adh->table_element);
335 $ret = $extrafields->setOptionalsFromPost(null, $adh);
336 if ($ret < 0) {
337 $error++;
338 $errmsg .= $adh->error;
339 }
340
341 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
342 $error++;
343 $errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
344 array_push($adh->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
345 }
346
347 if (!$error) {
348 $result = $adh->create($user);
349 if ($result > 0) {
350 require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
351 $object = $adh;
352
353 $adht = new AdherentType($db);
354 $adht->fetch($object->typeid);
355
356 if ($object->email) {
357 $subject = '';
358 $msg = '';
359
360 // Send subscription email
361 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
362 $formmail = new FormMail($db);
363 // Set output language
364 $outputlangs = new Translate('', $conf);
365 $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
366 // Load traductions files required by page
367 $outputlangs->loadLangs(array("main", "members"));
368 // Get email content from template
369 $arraydefaultmessage = null;
370 $labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER');
371
372 if (!empty($labeltouse)) {
373 $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
374 }
375
376 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
377 $subject = $arraydefaultmessage->topic;
378 $msg = $arraydefaultmessage->content;
379 }
380
381 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
382 complete_substitutions_array($substitutionarray, $outputlangs, $object);
383 $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
384 $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
385
386 if ($subjecttosend && $texttosend) {
387 $moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
388
389 $result = $object->sendEmail($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
390 }
391 /*if ($result < 0) {
392 $error++;
393 setEventMessages($object->error, $object->errors, 'errors');
394 }*/
395 }
396
397 // Send email to the foundation to say a new member subscribed with autosubscribe form
398 if (getDolGlobalString('MAIN_INFO_SOCIETE_MAIL') && getDolGlobalString('ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT') &&
399 getDolGlobalString('ADHERENT_AUTOREGISTER_NOTIF_MAIL')) {
400 // Define link to login card
401 $appli = constant('DOL_APPLICATION_TITLE');
402 if (getDolGlobalString('MAIN_APPLICATION_TITLE')) {
403 $appli = getDolGlobalString('MAIN_APPLICATION_TITLE');
404 if (preg_match('/\d\.\d/', $appli)) {
405 if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
406 $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
407 }
408 } else {
409 $appli .= " ".DOL_VERSION;
410 }
411 } else {
412 $appli .= " ".DOL_VERSION;
413 }
414
415 $to = $adh->makeSubstitution(getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'));
416 $from = getDolGlobalString('ADHERENT_MAIL_FROM', $conf->email_from);
417 $mailfile = new CMailFile(
418 '['.$appli.'] ' . getDolGlobalString('ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'),
419 $to,
420 $from,
421 $adh->makeSubstitution(getDolGlobalString('ADHERENT_AUTOREGISTER_NOTIF_MAIL')),
422 array(),
423 array(),
424 array(),
425 "",
426 "",
427 0,
428 -1
429 );
430
431 if (!$mailfile->sendfile()) {
432 dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR);
433 }
434 }
435
436 // Auto-create thirdparty on member creation
437 if (getDolGlobalString('ADHERENT_DEFAULT_CREATE_THIRDPARTY')) {
438 $company = new Societe($db);
439 $result = $company->create_from_member($adh);
440 if ($result < 0) {
441 $error++;
442 $errmsg .= implode('<br>', $company->errors);
443 }
444 }
445
446 if (!empty($backtopage)) {
447 $urlback = $backtopage;
448 } elseif (getDolGlobalString('MEMBER_URL_REDIRECT_SUBSCRIPTION')) {
449 $urlback = getDolGlobalString('MEMBER_URL_REDIRECT_SUBSCRIPTION');
450 // TODO Make replacement of __AMOUNT__, etc...
451 } else {
452 $urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
453 }
454
455 if (getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') && getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') != '-1') {
456 if (empty($adht->caneditamount)) { // If edition of amount not allowed
457 // 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
458 // It is not so important because a test is done on return of payment validation.
459 }
460
461 $urlback = getOnlinePaymentUrl(0, 'member', $adh->ref, (float) price2num(GETPOST('amount', 'alpha'), 'MT'), '', 0);
462
463 if (GETPOST('email')) {
464 $urlback .= '&email='.urlencode(GETPOST('email'));
465 }
466 if (getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') != '-1' && getDolGlobalString('MEMBER_NEWFORM_PAYONLINE') != 'all') {
467 $urlback .= '&paymentmethod='.urlencode(getDolGlobalString('MEMBER_NEWFORM_PAYONLINE'));
468 }
469 } else {
470 if (!empty($entity)) {
471 $urlback .= '&entity='.((int) $entity);
472 }
473 }
474 } else {
475 $error++;
476 $errmsg .= implode('<br>', $adh->errors);
477 }
478 }
479 }
480
481 if (!$error) {
482 $db->commit();
483
484 header("Location: ".$urlback);
485 exit;
486 } else {
487 $db->rollback();
488 $action = "create";
489 }
490}
491
492// Action called after a submitted was send and member created successfully
493// 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.
494// backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
495
496if (empty($reshook) && $action == 'added') { // Test on permission not required here
497 llxHeaderVierge($langs->trans("NewMemberForm"));
498
499 // If we have not been redirected
500 print '<br><br>';
501 print '<div class="center">';
502 print $langs->trans("NewMemberbyWeb");
503 print '</div>';
504
506 exit;
507}
508
509
510
511/*
512 * View
513 */
514
515$form = new Form($db);
516$formcompany = new FormCompany($db);
517$adht = new AdherentType($db);
518$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
519
520
521llxHeaderVierge($langs->trans("NewSubscription"));
522
523print '<br>';
524print load_fiche_titre(img_picto('', 'member_nocolor', 'class="pictofixedwidth"').' &nbsp; '.$langs->trans("NewSubscription"), '', '', 0, '', 'center');
525
526
527print '<div align="center">';
528print '<div id="divsubscribe">';
529
530print '<div class="center subscriptionformhelptext opacitymedium justify">';
531if (getDolGlobalString('MEMBER_NEWFORM_TEXT')) {
532 print $langs->trans(getDolGlobalString('MEMBER_NEWFORM_TEXT'))."<br>\n";
533} else {
534 print $langs->trans("NewSubscriptionDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."<br>\n";
535}
536print '</div>';
537
538dol_htmloutput_errors($errmsg);
540
541// Print form
542print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
543print '<input type="hidden" name="token" value="'.newToken().'" />';
544print '<input type="hidden" name="entity" value="'.$entity.'" />';
545print '<input type="hidden" name="page_y" value="" />';
546
547if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFORM_FORCETYPE') || $action == 'create') {
548 print '<input type="hidden" name="action" value="add" />';
549 print '<br>';
550
551 $messagemandatory = '<span class="">'.$langs->trans("FieldsWithAreMandatory", '*').'</span>';
552 //print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
553 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
554
555 print dol_get_fiche_head();
556
557 print '<script type="text/javascript">
558 jQuery(document).ready(function () {
559 jQuery(document).ready(function () {
560 function initmorphy()
561 {
562 console.log("Call initmorphy");
563 if (jQuery("#morphy").val() == \'phy\') {
564 jQuery("#trcompany").hide();
565 }
566 if (jQuery("#morphy").val() == \'mor\') {
567 jQuery("#trcompany").show();
568 }
569 }
570 initmorphy();
571 jQuery("#morphy").change(function() {
572 initmorphy();
573 });
574 jQuery("#selectcountry_id").change(function() {
575 document.newmember.action.value="create";
576 document.newmember.submit();
577 });
578 jQuery("#typeid").change(function() {
579 document.newmember.action.value="create";
580 document.newmember.submit();
581 });
582 });
583 });
584 </script>';
585
586
587 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
588
589 // Type
590 if (!getDolGlobalString('MEMBER_NEWFORM_FORCETYPE')) {
591 $listoftype = $adht->liste_array();
592 $tmp = array_keys($listoftype);
593 $defaulttype = '';
594 $isempty = 1;
595 if (count($listoftype) == 1) {
596 $defaulttype = $tmp[0];
597 $isempty = 0;
598 }
599 print '<tr><td class="titlefield classfortooltip" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans("Type").' <span class="star">*</span></td><td>';
600 print $form->selectarray("typeid", $adht->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty);
601 print '</td></tr>'."\n";
602 } else {
603 $adht->fetch(getDolGlobalInt('MEMBER_NEWFORM_FORCETYPE'));
604 print '<input type="hidden" id="typeid" name="typeid" value="' . getDolGlobalString('MEMBER_NEWFORM_FORCETYPE').'">';
605 }
606
607 // Moral/Physic attribute
608 $morphys = array();
609 $morphys["phy"] = $langs->trans("Physical");
610 $morphys["mor"] = $langs->trans("Moral");
611 if (!getDolGlobalString('MEMBER_NEWFORM_FORCEMORPHY')) {
612 print '<tr class="morphy"><td class="titlefield classfortooltip" title="'.dol_escape_htmltag($messagemandatory).'">'.$langs->trans('MemberNature').' <span class="star">*</span></td><td>'."\n";
613 print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1);
614 print '</td></tr>'."\n";
615 } else {
616 //print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY];
617 print '<input type="hidden" id="morphy" name="morphy" value="' . getDolGlobalString('MEMBER_NEWFORM_FORCEMORPHY').'">';
618 }
619
620 // Company // TODO : optional hide
621 print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td>';
622 print img_picto('', 'company', 'class="pictofixedwidth paddingright"');
623 print '<input type="text" name="societe" class="minwidth150 widthcentpercentminusx" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
624
625 // Title
626 if (getDolGlobalString('MEMBER_NEWFORM_ASK_TITLE')) {
627 print '<tr><td class="titlefield">'.$langs->trans('UserTitle').'</td><td>';
628 print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'</td></tr>'."\n";
629 }
630
631 // Firstname
632 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";
633
634 // Lastname
635 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";
636
637 // EMail
638 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>';
639 //print img_picto('', 'email', 'class="pictofixedwidth"');
640 print '<input type="email" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('email', "aZ09arobase")).'"></td></tr>'."\n";
641
642 // Login
643 if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) {
644 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";
645 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";
646 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";
647 }
648
649 // Gender
650 print '<tr><td>'.$langs->trans("Gender").'</td>';
651 print '<td>';
652 $arraygender = array('man' => $langs->trans("Genderman"), 'woman' => $langs->trans("Genderwoman"), 'other' => $langs->trans("Genderother"));
653 print $form->selectarray('gender', $arraygender, GETPOST('gender', 'alphanohtml'), 1, 0, 0, '', 0, 0, 0, '', '', 1);
654 print '</td></tr>';
655
656 // Address
657 print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
658 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";
659
660 // Zip / Town
661 print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
662 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
663 print ' / ';
664 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
665 print '</td></tr>';
666
667 // Country
668 print '<tr><td>'.$langs->trans('Country').'</td><td>';
669 print img_picto('', 'country', 'class="pictofixedwidth paddingright"');
670 $country_id = GETPOSTINT('country_id');
671 if (!$country_id && getDolGlobalString('MEMBER_NEWFORM_FORCECOUNTRYCODE')) {
672 $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, '2', $db, $langs);
673 }
674 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
675 $country_code = dol_user_country();
676 //print $country_code;
677 if ($country_code) {
678 $new_country_id = getCountry($country_code, '3', $db, $langs);
679 //print 'xxx'.$country_code.' - '.$new_country_id;
680 if ($new_country_id) {
681 $country_id = $new_country_id;
682 }
683 }
684 }
685 $country_code = getCountry($country_id, '2', $db, $langs);
686 print $form->select_country($country_id, 'country_id');
687 print '</td></tr>';
688
689 // State
690 if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
691 print '<tr><td>'.$langs->trans('State').'</td><td>';
692 if ($country_code) {
693 print img_picto('', 'state', 'class="pictofixedwidth paddingright"');
694 print $formcompany->select_state(GETPOSTINT("state_id"), $country_code);
695 }
696 print '</td></tr>';
697 }
698
699 // Birthday
700 print '<tr id="trbirth" class="trbirth"><td>'.$langs->trans("DateOfBirth").'</td><td>';
701 print $form->selectDate(!empty($birthday) ? $birthday : "", 'birth', 0, 0, 1, "newmember", 1, 0);
702 print '</td></tr>'."\n";
703
704 // Photo
705 print '<tr><td>'.$langs->trans("URLPhoto").'</td><td><input type="text" name="photo" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('photo')).'"></td></tr>'."\n";
706
707 // Public
708 if (getDolGlobalString('MEMBER_PUBLIC_ENABLED')) {
709 $linkofpubliclist = DOL_MAIN_URL_ROOT.'/public/members/public_list.php'.((isModEnabled('multicompany')) ? '?entity='.$conf->entity : '');
710 $publiclabel = $langs->trans("Public", getDolGlobalString('MAIN_INFO_SOCIETE_NOM'), $linkofpubliclist);
711 print '<tr><td>'.$form->textwithpicto($langs->trans("MembershipPublic"), $publiclabel).'</td><td><input type="checkbox" name="public"></td></tr>'."\n";
712 }
713
714 // Other attributes
715 $parameters['tpl_context'] = 'public'; // define template context to public
716 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
717
718 // Comments
719 print '<tr>';
720 print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
721 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>';
722 print '</tr>'."\n";
723
724 // Add specific fields used by Dolibarr foundation for example
725 // TODO Move this into generic feature.
726 if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) {
727 $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+');
728 print '<tr id="trbudget" class="trcompany"><td>'.$langs->trans("TurnoverOrBudget").' <span class="star">*</span></td><td>';
729 print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1);
730 print ' € or $';
731
732 print '<script type="text/javascript">
733 jQuery(document).ready(function () {
734 initturnover();
735 jQuery("#morphy").change(function() {
736 initturnover();
737 });
738 jQuery("#budget").change(function() {
739 if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); }
740 else { jQuery("#budget").val(\'\'); }
741 });
742 /*jQuery("#typeid").change(function() {
743 if (jQuery("#typeid").val()==1) { jQuery("#morphy").val(\'mor\'); }
744 if (jQuery("#typeid").val()==2) { jQuery("#morphy").val(\'phy\'); }
745 if (jQuery("#typeid").val()==3) { jQuery("#morphy").val(\'mor\'); }
746 if (jQuery("#typeid").val()==4) { jQuery("#morphy").val(\'mor\'); }
747 initturnover();
748 });*/
749 function initturnover() {
750 console.log("Switch mor/phy");
751 if (jQuery("#morphy").val()==\'phy\') {
752 jQuery(".amount").val(20);
753 jQuery("#trbudget").hide();
754 jQuery("#trcompany").hide();
755 }
756 if (jQuery("#morphy").val()==\'mor\') {
757 jQuery(".amount").val(\'\');
758 jQuery("#trcompany").show();
759 jQuery("#trbirth").hide();
760 jQuery("#trbudget").show();
761 jQuery(".hideifautoturnover").hide();
762 if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); }
763 else { jQuery("#budget").val(\'\'); }
764 }
765 }
766 });
767 </script>';
768 print '</td></tr>'."\n";
769 }
770
771 if (getDolGlobalString('MEMBER_NEWFORM_PAYONLINE')) {
772 $typeid = getDolGlobalInt('MEMBER_NEWFORM_FORCETYPE', GETPOSTINT('typeid'));
773 $adht = new AdherentType($db);
774 $adht->fetch($typeid);
775 $caneditamount = $adht->caneditamount;
776 $amountbytype = $adht->amountByType(1); // Load the array of amount per type
777
778 // Set amount for the subscription from the the type and options:
779 // - First check the amount of the member type.
780 $amount = empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid];
781 // - If not found, take the default amount only if the user is authorized to edit it
782 if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) {
783 $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT');
784 }
785 // - If not set, we accept to have amount defined as parameter (for backward compatibility).
786 if (empty($amount)) {
787 $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : '');
788 }
789 // - If a min is set, we take it into account
790 $amount = max(0, (float) $amount, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT"));
791
792 // Clean the amount
793 $amount = price2num($amount);
794 $showedamount = $amount > 0 ? $amount : 0;
795 // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe'
796 print '<tr><td>'.$langs->trans("Subscription");
797 if (getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO')) {
798 print ' - <a href="' . getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO').'" rel="external" target="_blank" rel="noopener noreferrer">'.$langs->trans("SeeHere").'</a>';
799 }
800 print '</td><td class="nowrap">';
801
802 if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) {
803 $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT');
804 }
805
806 if ($caneditamount) {
807 print '<input type="text" name="amount" id="amount" class="flat amount width50" value="'.$showedamount.'">';
808 print ' '.$langs->trans("Currency".$conf->currency).'<span class="opacitymedium hideifautoturnover"> - ';
809 print $amount > 0 ? $langs->trans("AnyAmountWithAdvisedAmount", price($amount, 0, $langs, 1, -1, -1, $conf->currency)) : $langs->trans("AnyAmountWithoutAdvisedAmount");
810 print '</span>';
811 } else {
812 print '<input type="hidden" name="amount" id="amount" class="flat amount" value="'.$showedamount.'">';
813 print '<input type="text" name="amount" id="amounthidden" class="flat amount width50" disabled value="'.$showedamount.'">';
814 print ' '.$langs->trans("Currency".$conf->currency);
815 }
816 print '</td></tr>';
817 }
818
819 // Display Captcha code if is enabled
820 if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA_MEMBER')) {
821 require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
822 print '<tr><td class="titlefield"><label><span class="fieldrequired">'.$langs->trans("SecurityCode").'</span></label></td><td>';
823 print '<span class="span-icon-security inline-block">';
824 print '<input id="securitycode" placeholder="'.$langs->trans("SecurityCode").'" class="flat input-icon-security width150" type="text" maxlength="5" name="code" tabindex="3" />';
825 print '</span>';
826 print '<span class="nowrap inline-block">';
827 print '<img class="inline-block valignmiddle" src="'.DOL_URL_ROOT.'/core/antispamimage.php" border="0" width="80" height="32" id="img_securitycode" />';
828 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>';
829 print '</span>';
830 print '</td></tr>';
831 }
832
833 print "</table>\n";
834
835 print dol_get_fiche_end();
836
837 // Save / Submit
838 print '<div class="center">';
839 print '<input type="submit" value="'.$langs->trans("GetMembershipButtonLabel").'" id="submitsave" class="button">';
840 if (!empty($backtopage)) {
841 print ' &nbsp; &nbsp; <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button button-cancel">';
842 }
843 print '</div>';
844
845
846 print "</form>\n";
847 print "<br>";
848 print '</div></div>';
849} else { // Show the table of membership types
850 // Get units
851 $measuringUnits = new CUnits($db);
852 $result = $measuringUnits->fetchAll('', '', 0, 0, array('t.active' => 1));
853 $units = array();
854 foreach ($measuringUnits->records as $lines) {
855 $units[$lines->short_label] = $langs->trans(ucfirst($lines->label));
856 }
857
858 $publiccounters = getDolGlobalString("MEMBER_COUNTERS_ARE_PUBLIC");
859 $hidevoteallowed = getDolGlobalString("MEMBER_HIDE_VOTE_ALLOWED");
860
861 $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,";
862 $sql .= " COUNT(a.rowid) AS membercount";
863 $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
864 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as a";
865 $sql .= " ON d.rowid = a.fk_adherent_type AND a.statut > 0";
866 $sql .= " WHERE d.entity IN (".getEntity('member_type').")";
867 $sql .= " AND d.statut=1";
868 $sql .= " GROUP BY d.rowid, d.libelle, d.subscription, d.amount, d.caneditamount, d.vote, d.note, d.duration, d.statut, d.morphy";
869
870 $result = $db->query($sql);
871 if ($result) {
872 $num = $db->num_rows($result);
873
874 print '<br><div class="div-table-responsive">';
875 print '<table class="tagtable liste">'."\n";
876 print '<input type="hidden" name="action" value="create">';
877
878 print '<tr class="liste_titre">';
879 print '<th>'.$langs->trans("Label").'</th>';
880 print '<th class="center">'.$langs->trans("MembershipDuration").'</th>';
881 print '<th class="center">'.$langs->trans("Amount").'</th>';
882 print '<th class="center">'.$langs->trans("MembersNature").'</th>';
883 if (empty($hidevoteallowed)) {
884 print '<th class="center">'.$langs->trans("VoteAllowed").'</th>';
885 }
886 if ($publiccounters) {
887 print '<th class="center">'.$langs->trans("Members").'</th>';
888 }
889 print '<th class="center">'.$langs->trans("NewSubscription").'</th>';
890 print "</tr>\n";
891
892 $i = 0;
893 while ($i < $num) {
894 $objp = $db->fetch_object($result); // Load the member type and information on it
895
896 $caneditamount = $objp->caneditamount;
897 $amountbytype = $adht->amountByType(1); // Load the array of amount per type
898
899 print '<tr class="oddeven">';
900 // Label
901 print '<td>'.dol_escape_htmltag($objp->label).'</td>';
902 // Duration
903 print '<td class="center">';
904 $unit = preg_replace("/[^a-zA-Z]+/", "", $objp->duration);
905 print max(1, intval($objp->duration)).' '.$units[$unit];
906 print '</td>';
907 // Amount
908 print '<td class="center"><span class="amount nowrap">';
909
910 // Set amount for the subscription from the the type and options:
911 // - First check the amount of the member type.
912 $amount = empty($amountbytype[$objp->rowid]) ? 0 : $amountbytype[$objp->rowid];
913 // - If not found, take the default amount only if the user is authorized to edit it
914 if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) {
915 $amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT');
916 }
917 // - If not set, we accept to have amount defined as parameter (for backward compatibility).
918 if (empty($amount)) {
919 $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : '');
920 }
921 // - If a min is set, we take it into account
922 $amount = max(0, (float) $amount, (float) getDolGlobalInt("MEMBER_MIN_AMOUNT"));
923
924 $displayedamount = $amount;
925
926 if ($objp->subscription) {
927 if ($displayedamount > 0 || !$caneditamount) {
928 print price($displayedamount, 1, $langs, 1, 0, -1, $conf->currency);
929 }
930 if ($caneditamount && $displayedamount > 0) {
931 print $form->textwithpicto('', $langs->transnoentities("CanEditAmountShortForValues"), 1, 'help', '', 0, 3);
932 } elseif ($caneditamount) {
933 print $langs->transnoentities("CanEditAmountShort");
934 }
935 } else {
936 print "–"; // No subscription required
937 }
938 print '</span></td>';
939 print '<td class="center">';
940 if ($objp->morphy == 'phy') {
941 print $langs->trans("Physical");
942 } elseif ($objp->morphy == 'mor') {
943 print $langs->trans("Moral");
944 } else {
945 print $langs->trans("MorAndPhy");
946 }
947 print '</td>';
948 if (empty($hidevoteallowed)) {
949 print '<td class="center">'.yn($objp->vote).'</td>';
950 }
951 $membercount = $objp->membercount > 0 ? $objp->membercount : "–";
952 if ($publiccounters) {
953 print '<td class="center">'.$membercount.'</td>';
954 }
955 print '<td class="center"><button class="button button-save reposition" name="typeid" type="submit" name="submit" value="'.$objp->rowid.'">'.$langs->trans("GetMembershipButtonLabel").'</button></td>';
956 print "</tr>";
957 $i++;
958 }
959
960 // If no record found
961 if ($num == 0) {
962 $colspan = 8;
963 print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
964 }
965
966 print "</table>";
967 print '</div>';
968
969 print '</form>';
970 } else {
971 dol_print_error($db);
972 }
973}
974
975//htmlPrintOnlineFooter($mysoc, $langs);
977
978$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
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.
llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Show header for new prospect.
Definition new.php:122
llxFooterVierge()
Show footer for new societe.
Definition new.php:143
htmlPrintOnlineHeader($mysoc, $langs, $showlogo=1, $alttext='', $subimageconst='', $altlogo1='', $altlogo2='')
Show the header of a company in HTML public pages.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition date.lib.php:125
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.
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-...
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.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formatted error messages to output (Used to show messages on html output).
dol_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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
force_switch_entity($newEntity)
Force switching conf of entity, even if user is connected Fox example when trying to go on public for...
Definition new.php:123
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.