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