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