dolibarr 21.0.0-beta
suggestbooth.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2021 Dorian Vabre <dorian.vabre@gmail.com>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
4 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26if (!defined('NOLOGIN')) {
27 define("NOLOGIN", 1); // This means this output page does not require to be logged.
28}
29if (!defined('NOCSRFCHECK')) {
30 define("NOCSRFCHECK", 1); // We accept to go on this page from external web site.
31}
32if (!defined('NOIPCHECK')) {
33 define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
34}
35if (!defined('NOBROWSERNOTIF')) {
36 define('NOBROWSERNOTIF', '1');
37}
38
39
40// For MultiCompany module.
41// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
42// Because 2 entities can have the same ref.
43$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
44if (is_numeric($entity)) {
45 define("DOLENTITY", $entity);
46}
47
48// Load Dolibarr environment
49require '../../main.inc.php';
50require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
51require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
52require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
53require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
54require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
55require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
56require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
57require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php';
58require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
59require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
60
61global $dolibarr_main_url_root;
62
71// Init vars
72$errmsg = '';
73$num = 0;
74$error = 0;
75$errors = [];
76$backtopage = GETPOST('backtopage', 'alpha');
77$action = GETPOST('action', 'aZ09');
78
79$eventtype = GETPOSTINT("eventtype");
80$email = GETPOST("email");
81$societe = GETPOST("societe");
82$label = GETPOST("label");
83$note = GETPOST("note");
84$datestart = dol_mktime(0, 0, 0, GETPOSTINT('datestartmonth'), GETPOSTINT('datestartday'), GETPOSTINT('datestartyear'));
85$dateend = dol_mktime(23, 59, 59, GETPOSTINT('dateendmonth'), GETPOSTINT('dateendday'), GETPOSTINT('dateendyear'));
86$id = GETPOST('id');
87
88$project = new Project($db);
89$resultproject = $project->fetch($id);
90if ($resultproject < 0) {
91 $error++;
92 $errmsg .= $project->error;
93}
94
95// Security check
96$securekeyreceived = GETPOST('securekey', 'alpha');
97$securekeytocompare = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY') . 'conferenceorbooth'.$id, 'md5');
98
99if ($securekeytocompare != $securekeyreceived) {
100 print $langs->trans('MissingOrBadSecureKey');
101 exit;
102}
103
104// Load translation files
105$langs->loadLangs(array("main", "companies", "install", "other", "eventorganization"));
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$user->loadDefaultValues();
113
114$cactioncomm = new CActionComm($db);
115$arrayofconfboothtype = $cactioncomm->liste_array('', 'id', '', 0, "module='booth@eventorganization'");
116if ($arrayofconfboothtype == -1) {
117 $arrayofconfboothtype = [];
118}
119// Security check
120if (empty($conf->eventorganization->enabled)) {
121 httponly_accessforbidden('Module Event organization not enabled');
122}
123
124
136function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = [])
137{
138 global $conf, $langs, $mysoc;
139
140 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
141
142 print '<body id="mainbody" class="publicnewmemberform">';
143
144 // Define urllogo
145 $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
146
147 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
148 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
149 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
150 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
151 } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
152 $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
153 }
154
155 print '<div class="center">';
156
157 // Output html code for logo
158 if ($urllogo) {
159 print '<div class="backgreypublicpayment">';
160 print '<div class="logopublicpayment">';
161 print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
162 print '>';
163 print '</div>';
164 if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) {
165 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>';
166 }
167 print '</div>';
168 }
169
170 if (getDolGlobalString('PROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH')) {
171 print '<div class="backimagepublicsuggestbooth">';
172 print '<img id="idPROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH" src="' . getDolGlobalString('PROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH').'">';
173 print '</div>';
174 }
175
176 print '</div>';
177
178 print '<div class="divmainbodylarge">';
179}
180
187{
188 print '</div>';
189
190 printCommonFooter('public');
191
192 print "</body>\n";
193 print "</html>\n";
194}
195
196
197
198/*
199 * Actions
200 */
201
202$parameters = array();
203// Note that $action and $object may have been modified by some hooks
204$reshook = $hookmanager->executeHooks('doActions', $parameters, $project, $action);
205if ($reshook < 0) {
206 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
207}
208
209// Action called when page is submitted
210if (empty($reshook) && $action == 'add') { // Test on permission not required here. This is an anonymous public ssubmission. Check is done on the secureket + mitigation.
211 $error = 0;
212
213 $urlback = '';
214
215 $db->begin();
216
217 if (!GETPOST("lastname")) {
218 $error++;
219 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."<br>\n";
220 }
221 if (!GETPOST("email")) {
222 $error++;
223 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
224 }
225 if (!GETPOST("country_id") && !empty((float) $project->price_booth)) {
226 $error++;
227 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."<br>\n";
228 }
229 if (!GETPOST("societe")) {
230 $error++;
231 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<br>\n";
232 }
233 if (!GETPOST("label")) {
234 $error++;
235 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."<br>\n";
236 }
237 if (!GETPOST("note")) {
238 $error++;
239 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."<br>\n";
240 }
241 if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
242 $error++;
243 $langs->load("errors");
244 $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
245 }
246
247 $thirdparty = null;
248 if (!$error) {
249 // Getting the thirdparty or creating it
250 $thirdparty = new Societe($db);
251 $resultfetchthirdparty = $thirdparty->fetch(0, $societe);
252
253 if ($resultfetchthirdparty < 0) {
254 // If an error was found
255 $error++;
256 $errmsg .= $thirdparty->error;
257 $errors = array_merge($errors, $thirdparty->errors);
258 } elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected
259 // Creation of a new thirdparty
260 $genericcompanyname = 'Unknown company';
261
262 if (!empty($societe)) {
263 $thirdparty->name = $societe;
264 } else {
265 $thirdparty->name = $genericcompanyname;
266 }
267 $thirdparty->address = GETPOST("address");
268 $thirdparty->zip = GETPOST("zipcode");
269 $thirdparty->town = GETPOST("town");
270 $thirdparty->client = $thirdparty::PROSPECT;
271 $thirdparty->fournisseur = 0;
272 $thirdparty->country_id = GETPOSTINT("country_id");
273 $thirdparty->state_id = GETPOSTINT("state_id");
274 $thirdparty->email = ($emailcompany ? $emailcompany : $email);
275
276 // Load object modCodeTiers
277 $module = getDolGlobalString('SOCIETE_CODECLIENT_ADDON', 'mod_codeclient_leopard');
278 if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
279 $module = substr($module, 0, dol_strlen($module) - 4);
280 }
281 $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
282 foreach ($dirsociete as $dirroot) {
283 $res = dol_include_once($dirroot.$module.'.php');
284 if ($res) {
285 break;
286 }
287 }
288 $modCodeClient = new $module($db);
289 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
290
291 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
292 $tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
293 }
294 $thirdparty->code_client = $tmpcode;
295 $readythirdparty = $thirdparty->create($user);
296 if ($readythirdparty < 0) {
297 $error++;
298 $errmsg .= $thirdparty->error;
299 $errors = array_merge($errors, $thirdparty->errors);
300 } else {
301 $thirdparty->country_code = getCountry($thirdparty->country_id, '2', $db, $langs);
302 $thirdparty->country = getCountry($thirdparty->country_code, '', $db, $langs);
303 }
304 }
305 // From there we have a thirdparty, now looking for the contact
306 if (!$error) {
307 $contact = new Contact($db);
308 $resultcontact = $contact->fetch(0, null, '', $email);
309 if ($resultcontact <= 0) {
310 // Need to create a contact
311 $contact->socid = $thirdparty->id;
312 $contact->lastname = (string) GETPOST("lastname", 'alpha');
313 $contact->firstname = (string) GETPOST("firstname", 'alpha');
314 $contact->address = (string) GETPOST("address", 'alpha');
315 $contact->zip = (string) GETPOST("zipcode", 'alpha');
316 $contact->town = (string) GETPOST("town", 'alpha');
317 $contact->country_id = GETPOSTINT("country_id");
318 $contact->state_id = GETPOSTINT("state_id");
319 $contact->email = $email;
320 $contact->statut = 1; //Default status to Actif
321
322 $resultcreatecontact = $contact->create($user);
323 if ($resultcreatecontact < 0) {
324 $error++;
325 $errmsg .= $contact->error;
326 }
327 }
328 }
329
330 if (!$error) {
331 // Adding supplier tag and tag from setup to thirdparty
332 $category = new Categorie($db);
333
334 $resultcategory = $category->fetch(getDolGlobalString('EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'));
335
336 if ($resultcategory <= 0) {
337 $error++;
338 $errmsg .= $category->error;
339 } else {
340 $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), Categorie::TYPE_CUSTOMER, false);
341 if ($resultsetcategory < 0) {
342 $error++;
343 $errmsg .= $thirdparty->error;
344 } else {
345 $thirdparty->fournisseur = 1;
346
347 // Load object modCodeFournisseur
348 $module = getDolGlobalString('SOCIETE_CODECLIENT_ADDON', 'mod_codeclient_leopard');
349 if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
350 $module = substr($module, 0, dol_strlen($module) - 4);
351 }
352 $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
353 foreach ($dirsociete as $dirroot) {
354 $res = dol_include_once($dirroot.$module.'.php');
355 if ($res) {
356 break;
357 }
358 }
359 $modCodeFournisseur = new $module($db);
360 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
361 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
362 $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1);
363 }
364 $thirdparty->code_fournisseur = $tmpcode;
365
366 $res = $thirdparty->update(0, $user, 1, 1, 1);
367
368 if ($res <= 0) {
369 $error++;
370 }
371 }
372 }
373 }
374
375 if (!$error) {
376 // We have the contact and the thirdparty
377 $conforbooth = new ConferenceOrBooth($db);
378 $conforbooth->label = $label;
379 $conforbooth->fk_soc = $thirdparty->id;
380 $conforbooth->fk_project = $project->id;
381 $conforbooth->note = $note;
382 $conforbooth->fk_action = $eventtype;
383 $conforbooth->datep = $datestart;
384 $conforbooth->datep2 = $dateend;
385 $conforbooth->datec = dol_now();
386 $conforbooth->tms = dol_now();
387 $conforbooth->ip = getUserRemoteIP();
388
389 $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
390 $now = dol_now();
391 $minmonthpost = dol_time_plus_duree($now, -1, "m");
392
393 // Calculate nb of post for IP
394 $nb_post_ip = 0;
395 if ($nb_post_max > 0) { // Calculate only if there is a limit to check
396 $sql = "SELECT COUNT(ref) as nb_confs";
397 $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
398 $sql .= " WHERE ip = '".$db->escape($conforbooth->ip)."'";
399 $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
400 $resql = $db->query($sql);
401 if ($resql) {
402 $num = $db->num_rows($resql);
403 $i = 0;
404 while ($i < $num) {
405 $i++;
406 $obj = $db->fetch_object($resql);
407 $nb_post_ip = $obj->nb_confs;
408 }
409 }
410 }
411
412 $resultconforbooth = 0;
413
414 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
415 $error++;
416 $errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
417 array_push($conforbooth->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
418 setEventMessage($errmsg, 'errors');
419 } else {
420 $resultconforbooth = $conforbooth->create($user);
421 }
422 if ($resultconforbooth <= 0) {
423 $error++;
424 $errmsg .= $conforbooth->error;
425 } else {
426 // Adding the contact to the project
427 $resultaddcontact = $conforbooth->add_contact($contact->id, 'RESPONSIBLE');
428 if ($resultaddcontact < 0) {
429 $error++;
430 $errmsg .= $conforbooth->error;
431 } else {
432 // If this is a paying booth, we have to redirect to payment page and create an invoice
433 $facture = null;
434 if (!empty((float) $project->price_booth)) {
435 $productforinvoicerow = new Product($db);
436 $resultprod = $productforinvoicerow->fetch(getDolGlobalString('SERVICE_BOOTH_LOCATION'));
437 if ($resultprod < 0) {
438 $error++;
439 $errmsg .= $productforinvoicerow->error;
440 } else {
441 $facture = new Facture($db);
442 $facture->type = Facture::TYPE_STANDARD;
443 $facture->socid = $thirdparty->id;
444 $facture->paye = 0;
445 $facture->date = dol_now();
446 $facture->cond_reglement_id = $contact->cond_reglement_id;
447 $facture->fk_project = $project->id;
448
449 if (empty($facture->cond_reglement_id)) {
450 $paymenttermstatic = new PaymentTerm($contact->db);
451 $facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
452 if (empty($facture->cond_reglement_id)) {
453 $error++;
454 $contact->error = 'ErrorNoPaymentTermRECEPFound';
455 $contact->errors[] = $contact->error;
456 }
457 }
458 $resultfacture = $facture->create($user);
459 if ($resultfacture <= 0) {
460 $contact->error = $facture->error;
461 $contact->errors = $facture->errors;
462 $error++;
463 } else {
464 $db->commit();
465 $facture->add_object_linked($conforbooth->element, $conforbooth->id);
466 }
467 }
468
469 if (!$error && is_object($facture)) {
470 // Add line to draft invoice
471 $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id);
472 $result = $facture->addline($langs->trans("BoothLocationFee", $conforbooth->label, dol_print_date($conforbooth->datep, '%d/%m/%y %H:%M:%S'), dol_print_date($conforbooth->datep2, '%d/%m/%y %H:%M:%S')), (float) $project->price_booth, 1, $vattouse, 0, 0, $productforinvoicerow->id, 0, dol_now(), '', 0, 0, 0, 'HT', 0, 1);
473 if ($result <= 0) {
474 $contact->error = $facture->error;
475 $contact->errors = $facture->errors;
476 $error++;
477 }
478 /*if (!$error) {
479 $valid = true;
480 $sourcetouse = 'boothlocation';
481 $reftouse = $facture->id;
482 $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id;
483 if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
484 if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
485 $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, '2'); // Use the source in the hash to avoid duplicates if the references are identical
486 } else {
487 $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
488 }
489 }
490 header("Location: ".$redirection);
491 exit;
492 }*/
493 }
494 } else {
495 // If no price has been set for the booth, we confirm it as suggested and we update
496 $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
497 $conforbooth->update($user);
498 }
499 }
500 }
501 }
502 }
503
504 if (!$error && is_object($thirdparty)) {
505 $db->commit();
506
507 // Sending mail
508 require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
509 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
510 $formmail = new FormMail($db);
511 // Set output language
512 $outputlangs = new Translate('', $conf);
513 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
514 // Load traductions files required by page
515 $outputlangs->loadLangs(array("main", "members", "eventorganization"));
516 // Get email content from template
517 $arraydefaultmessage = null;
518
519 $labeltouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH');
520 if (!empty($labeltouse)) {
521 $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
522 }
523
524 $subject = '';
525 $msg = '';
526 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
527 $subject = $arraydefaultmessage->topic;
528 $msg = $arraydefaultmessage->content;
529 }
530
531 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
532 complete_substitutions_array($substitutionarray, $outputlangs, $project);
533
534 $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
535 $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
536
537 $sendto = $thirdparty->email;
538 $from = getDolGlobalString('MAILING_EMAIL_FROM');
539 $urlback = $_SERVER["REQUEST_URI"];
540 $trackid = 'proj'.$project->id;
541
542 $ishtml = dol_textishtml($texttosend); // May contain urls
543
544 $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml ? 1 : 0, '', '', $trackid);
545
546 $result = $mailfile->sendfile();
547 if ($result) {
548 dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
549 } else {
550 dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
551 }
552
553 $securekeyurl = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY') . 'conferenceorbooth'.$id, '2');
554 $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl;
555 header("Location: ".$redirection);
556 exit;
557 } else {
558 $db->rollback();
559 }
560}
561
562
563/*
564 * View
565 */
566
567$form = new Form($db);
568$formcompany = new FormCompany($db);
569
570llxHeaderVierge($langs->trans("NewSuggestionOfBooth"));
571
572
573print '<div align="center">';
574print '<div id="divsubscribe">';
575
576print '<br>';
577
578// Sub banner
579print '<div class="center subscriptionformbanner subbanner justify margintoponly paddingtop marginbottomonly padingbottom">';
580print load_fiche_titre($langs->trans("NewSuggestionOfBooth"), '', '', 0, '', 'center');
581// Welcome message
582print '<span class="opacitymedium">'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'</span>';
583print '<br>';
584// Title
585print '<span class="eventlabel large">'.dol_escape_htmltag($project->title . ' '. $project->label).'</span><br>';
586print '</div>';
587
588
589// Help text
590print '<div class="justify subscriptionformhelptext">';
591
592if ($project->date_start_event || $project->date_end_event) {
593 print '<br><span class="fa fa-calendar pictofixedwidth opacitymedium"></span>';
594}
595if ($project->date_start_event) {
596 $format = 'day';
597 $tmparray = dol_getdate($project->date_start_event, false, '');
598 if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) {
599 $format = 'dayhour';
600 }
601 print dol_print_date($project->date_start_event, $format);
602}
603if ($project->date_start_event && $project->date_end_event) {
604 print ' - ';
605}
606if ($project->date_end_event) {
607 $format = 'day';
608 $tmparray = dol_getdate($project->date_end_event, false, '');
609 if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) {
610 $format = 'dayhour';
611 }
612 print dol_print_date($project->date_end_event, $format);
613}
614if ($project->date_start_event || $project->date_end_event) {
615 print '<br>';
616}
617if ($project->location) {
618 print '<span class="fa fa-map-marked-alt pictofixedwidth opacitymedium"></span>'.dol_escape_htmltag($project->location).'<br>';
619}
620if ($project->note_public) {
621 print '<br><!-- note public --><span class="opacitymedium">'.dol_htmlentitiesbr($project->note_public).'</span><br>';
622}
623
624print '</div>';
625
626print '<br>';
627
628
629dol_htmloutput_errors($errmsg, $errors);
630
631// Print form
632print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
633print '<input type="hidden" name="token" value="'.newToken().'" / >';
634print '<input type="hidden" name="entity" value="'.$entity.'" />';
635print '<input type="hidden" name="action" value="add" />';
636print '<input type="hidden" name="id" value="'.$id.'" />';
637print '<input type="hidden" name="securekey" value="'.$securekeyreceived.'" />';
638
639
640print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
641//print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
642
643print dol_get_fiche_head();
644
645print '<script type="text/javascript">
646jQuery(document).ready(function () {
647 jQuery(document).ready(function () {
648 jQuery("#selectcountry_id").change(function() {
649 document.newmember.action.value="create";
650 document.newmember.submit();
651 });
652 });
653});
654</script>';
655
656print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
657
658// Name
659print '<tr><td><label for="lastname">'.$langs->trans("Lastname").'<span class="star">*</span></label></td>';
660print '<td colspan="3"><input name="lastname" id="lastname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("lastname", 'alpha') ? GETPOST("lastname", 'alpha') : $object->lastname).'" autofocus="autofocus"></td>';
661print '</tr>';
662// Email
663print '<tr><td>'.$langs->trans("Email").'<span class="star">*</span></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
664// Company
665print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'<span class="star">*</span>';
666print ' </td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
667// Address
668print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
669print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
670// Zip / Town
671print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
672print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
673print ' / ';
674print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
675print '</td></tr>';
676// Country
677print '<tr><td>'.$langs->trans('Country');
678print '<span class="star">*</span>';
679print '</td><td>';
680$country_id = GETPOST('country_id');
681if (!$country_id && getDolGlobalString('MEMBER_NEWFORM_FORCECOUNTRYCODE')) {
682 $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, '2', $db, $langs);
683}
684if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
685 $country_code = dol_user_country();
686 //print $country_code;
687 if ($country_code) {
688 $new_country_id = getCountry($country_code, '3', $db, $langs);
689 //print 'xxx'.$country_code.' - '.$new_country_id;
690 if ($new_country_id) {
691 $country_id = $new_country_id;
692 }
693 }
694}
695$country_code = getCountry($country_id, '2', $db, $langs);
696print $form->select_country($country_id, 'country_id');
697print '</td></tr>';
698// State
699if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
700 print '<tr><td>'.$langs->trans('State').'</td><td>';
701 if ($country_code) {
702 print $formcompany->select_state(GETPOST("state_id"), $country_code);
703 } else {
704 print '';
705 }
706 print '</td></tr>';
707}
708// Type of event
709print '<tr><td>'.$langs->trans("Format").'<span class="star">*</span></td>'."\n";
710print '<td>'.Form::selectarray('eventtype', $arrayofconfboothtype, $eventtype, 1).'</td>';
711// Label
712print '<tr><td>'.$langs->trans("LabelOfBooth").'<span class="star">*</span></td>'."\n";
713print '</td><td><input type="text" name="label" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>'."\n";
714// Note
715print '<tr><td>'.$langs->trans("Description").'<span class="star">*</span></td>'."\n";
716print '<td><textarea name="note" id="note" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
717
718print "</table>\n";
719
720print dol_get_fiche_end();
721
722
723// Show all action buttons
724print '<div class="center">';
725print '<br>';
726print '<input type="submit" value="'.$langs->trans("SuggestBooth").'" name="suggestbooth" id="suggestbooth" class="button">';
727print '</div>';
728print '<br><br>';
729
730
731print "</form>\n";
732print "<br>";
733print '</div></div>';
734
735
737
738$db->close();
$id
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
Class to manage different types of events.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage categories.
Class for ConferenceOrBooth.
Class to manage contact/addresses.
Class to manage standard extra fields.
Class to manage invoices.
const TYPE_STANDARD
Standard invoice.
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 payment terms records in dictionary.
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
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.
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.
dol_user_country()
Return country code for current user.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
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...
dol_textishtml($msg, $option=0)
Return if a text is a html content.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
Function that return vat rate of a product line (according to seller, buyer and product vat rate) VAT...
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_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
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.
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.
if($arrayofconfboothtype==-1) if(empty( $conf->eventorganization->enabled)) llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs=[], $arrayofcss=[])
Show header for new member.
llxFooterVierge()
Show footer for new member.