dolibarr 22.0.5
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-2025 MDW <mdeweerd@users.noreply.github.com>
4 * Copyright (C) 2024-2025 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
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((int) $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'.((int) $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
138function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = [], $arrayofcss = []) // @phan-suppress-current-line PhanRedefineFunction
139{
140 global $conf, $langs, $mysoc;
141
142 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
143
144 print '<body id="mainbody" class="publicnewmemberform">';
145
146 // Define urllogo
147 $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
148
149 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
150 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
151 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
152 $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
153 } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
154 $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
155 }
156
157 print '<div class="center">';
158
159 // Output html code for logo
160 if ($urllogo) {
161 print '<div class="backgreypublicpayment">';
162 print '<div class="logopublicpayment">';
163 print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
164 print '>';
165 print '</div>';
166 if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) {
167 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>';
168 }
169 print '</div>';
170 }
171
172 if (getDolGlobalString('PROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH')) {
173 print '<div class="backimagepublicsuggestbooth">';
174 print '<img id="idPROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH" src="' . getDolGlobalString('PROJECT_IMAGE_PUBLIC_SUGGEST_BOOTH').'">';
175 print '</div>';
176 }
177
178 print '</div>';
179
180 print '<div class="divmainbodylarge">';
181}
182
190function llxFooterVierge() // @phan-suppress-current-line PhanRedefineFunction
191{
192 print '</div>';
193
194 printCommonFooter('public');
195
196 print "</body>\n";
197 print "</html>\n";
198}
199
200
201
202/*
203 * Actions
204 */
205
206$parameters = array();
207// Note that $action and $object may have been modified by some hooks
208$reshook = $hookmanager->executeHooks('doActions', $parameters, $project, $action);
209if ($reshook < 0) {
210 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
211}
212
213// Action called when page is submitted
214if (empty($reshook) && $action == 'add') { // Test on permission not required here. This is an anonymous public ssubmission. Check is done on the secureket + mitigation.
215 $error = 0;
216
217 $urlback = '';
218
219 $db->begin();
220
221 if (!GETPOST("lastname")) {
222 $error++;
223 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."<br>\n";
224 }
225 if (!GETPOST("email")) {
226 $error++;
227 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
228 }
229 if (!GETPOST("country_id") && !empty((float) $project->price_booth)) {
230 $error++;
231 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."<br>\n";
232 }
233 if (!GETPOST("societe")) {
234 $error++;
235 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty"))."<br>\n";
236 }
237 if (!GETPOST("label")) {
238 $error++;
239 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."<br>\n";
240 }
241 if (!GETPOST("note")) {
242 $error++;
243 $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."<br>\n";
244 }
245 if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
246 $error++;
247 $langs->load("errors");
248 $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
249 }
250
251 $thirdparty = null;
252 if (!$error) {
253 // Getting the thirdparty or creating it
254 $thirdparty = new Societe($db);
255 $resultfetchthirdparty = $thirdparty->fetch(0, $societe);
256
257 if ($resultfetchthirdparty < 0) {
258 // If an error was found
259 $error++;
260 $errmsg .= $thirdparty->error;
261 $errors = array_merge($errors, $thirdparty->errors);
262 } elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected
263 // Creation of a new thirdparty
264 $genericcompanyname = 'Unknown company';
265
266 if (!empty($societe)) {
267 $thirdparty->name = $societe;
268 } else {
269 $thirdparty->name = $genericcompanyname;
270 }
271 $thirdparty->address = GETPOST("address");
272 $thirdparty->zip = GETPOST("zipcode");
273 $thirdparty->town = GETPOST("town");
274 $thirdparty->client = $thirdparty::PROSPECT;
275 $thirdparty->fournisseur = 0;
276 $thirdparty->country_id = GETPOSTINT("country_id");
277 $thirdparty->state_id = GETPOSTINT("state_id");
278 $thirdparty->email = ($emailcompany ? $emailcompany : $email);
279
280 // Load object modCodeTiers
281 $module = getDolGlobalString('SOCIETE_CODECLIENT_ADDON', 'mod_codeclient_leopard');
282 if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
283 $module = substr($module, 0, dol_strlen($module) - 4);
284 }
285 $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
286 foreach ($dirsociete as $dirroot) {
287 $res = dol_include_once($dirroot.$module.'.php');
288 if ($res) {
289 break;
290 }
291 }
292 $modCodeClient = new $module($db);
293 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
294
295 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
296 $tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
297 }
298 $thirdparty->code_client = $tmpcode;
299 $readythirdparty = $thirdparty->create($user);
300 if ($readythirdparty < 0) {
301 $error++;
302 $errmsg .= $thirdparty->error;
303 $errors = array_merge($errors, $thirdparty->errors);
304 } else {
305 $thirdparty->country_code = getCountry($thirdparty->country_id, '2', $db, $langs);
306 $thirdparty->country = getCountry($thirdparty->country_code, '', $db, $langs);
307 }
308 }
309 // From there we have a thirdparty, now looking for the contact
310 if (!$error) {
311 $contact = new Contact($db);
312 $resultcontact = $contact->fetch(0, null, '', $email);
313 if ($resultcontact <= 0) {
314 // Need to create a contact
315 $contact->socid = $thirdparty->id;
316 $contact->lastname = (string) GETPOST("lastname", 'alpha');
317 $contact->firstname = (string) GETPOST("firstname", 'alpha');
318 $contact->address = (string) GETPOST("address", 'alpha');
319 $contact->zip = (string) GETPOST("zipcode", 'alpha');
320 $contact->town = (string) GETPOST("town", 'alpha');
321 $contact->country_id = GETPOSTINT("country_id");
322 $contact->state_id = GETPOSTINT("state_id");
323 $contact->email = $email;
324 $contact->statut = 1; //Default status to Actif
325
326 $resultcreatecontact = $contact->create($user);
327 if ($resultcreatecontact < 0) {
328 $error++;
329 $errmsg .= $contact->error;
330 }
331 }
332 }
333
334 if (!$error) {
335 // Adding supplier tag and tag from setup to thirdparty
336 $category = new Categorie($db);
337
338 $resultcategory = $category->fetch(getDolGlobalInt('EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'));
339
340 if ($resultcategory <= 0) {
341 $error++;
342 $errmsg .= $category->error;
343 } else {
344 $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), Categorie::TYPE_CUSTOMER, false);
345 if ($resultsetcategory < 0) {
346 $error++;
347 $errmsg .= $thirdparty->error;
348 } else {
349 $thirdparty->fournisseur = 1;
350
351 // Load object modCodeFournisseur
352 $module = getDolGlobalString('SOCIETE_CODECLIENT_ADDON', 'mod_codeclient_leopard');
353 if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
354 $module = substr($module, 0, dol_strlen($module) - 4);
355 }
356 $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
357 foreach ($dirsociete as $dirroot) {
358 $res = dol_include_once($dirroot.$module.'.php');
359 if ($res) {
360 break;
361 }
362 }
363 $modCodeFournisseur = new $module($db);
364 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
365 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
366 $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1);
367 }
368 $thirdparty->code_fournisseur = $tmpcode;
369
370 $res = $thirdparty->update(0, $user, 1, 1, 1);
371
372 if ($res <= 0) {
373 $error++;
374 }
375 }
376 }
377 }
378
379 if (!$error) {
380 // We have the contact and the thirdparty
381 $conforbooth = new ConferenceOrBooth($db);
382 $conforbooth->label = $label;
383 $conforbooth->fk_soc = $thirdparty->id;
384 $conforbooth->fk_project = $project->id;
385 $conforbooth->note = $note;
386 $conforbooth->fk_action = $eventtype;
387 $conforbooth->datep = $datestart;
388 $conforbooth->datep2 = $dateend;
389 $conforbooth->datec = dol_now();
390 $conforbooth->tms = dol_now();
391 $conforbooth->ip = getUserRemoteIP();
392
393 $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
394 $now = dol_now();
395 $minmonthpost = dol_time_plus_duree($now, -1, "m");
396
397 // Calculate nb of post for IP
398 $nb_post_ip = 0;
399 if ($nb_post_max > 0) { // Calculate only if there is a limit to check
400 $sql = "SELECT COUNT(ref) as nb_confs";
401 $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
402 $sql .= " WHERE ip = '".$db->escape($conforbooth->ip)."'";
403 $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
404 $resql = $db->query($sql);
405 if ($resql) {
406 $num = $db->num_rows($resql);
407 $i = 0;
408 while ($i < $num) {
409 $i++;
410 $obj = $db->fetch_object($resql);
411 $nb_post_ip = $obj->nb_confs;
412 }
413 }
414 }
415
416 $resultconforbooth = 0;
417
418 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
419 $error++;
420 $errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
421 array_push($conforbooth->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
422 setEventMessage($errmsg, 'errors');
423 } else {
424 $resultconforbooth = $conforbooth->create($user);
425 }
426 if ($resultconforbooth <= 0) {
427 $error++;
428 $errmsg .= $conforbooth->error;
429 } else {
430 // Adding the contact to the project
431 $resultaddcontact = $conforbooth->add_contact($contact->id, 'RESPONSIBLE');
432 if ($resultaddcontact < 0) {
433 $error++;
434 $errmsg .= $conforbooth->error;
435 } else {
436 // If this is a paying booth, we have to redirect to payment page and create an invoice
437 $facture = null;
438 if (!empty((float) $project->price_booth)) {
439 $productforinvoicerow = new Product($db);
440 $resultprod = $productforinvoicerow->fetch(getDolGlobalInt('SERVICE_BOOTH_LOCATION'));
441 if ($resultprod < 0) {
442 $error++;
443 $errmsg .= $productforinvoicerow->error;
444 } else {
445 $facture = new Facture($db);
446 $facture->type = Facture::TYPE_STANDARD;
447 $facture->socid = $thirdparty->id;
448 $facture->paye = 0;
449 $facture->date = dol_now();
450 $facture->cond_reglement_id = $contact->cond_reglement_id;
451 $facture->fk_project = $project->id;
452
453 if (empty($facture->cond_reglement_id)) {
454 $paymenttermstatic = new PaymentTerm($contact->db);
455 $facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
456 if (empty($facture->cond_reglement_id)) {
457 $error++;
458 $contact->error = 'ErrorNoPaymentTermRECEPFound';
459 $contact->errors[] = $contact->error;
460 }
461 }
462 $resultfacture = $facture->create($user);
463 if ($resultfacture <= 0) {
464 $contact->error = $facture->error;
465 $contact->errors = $facture->errors;
466 $error++;
467 } else {
468 $db->commit();
469 $facture->add_object_linked($conforbooth->element, $conforbooth->id);
470 }
471 }
472
473 if (!$error && is_object($facture)) {
474 // Add line to draft invoice
475 $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id);
476 $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);
477 if ($result <= 0) {
478 $contact->error = $facture->error;
479 $contact->errors = $facture->errors;
480 $error++;
481 }
482 /*if (!$error) {
483 $valid = true;
484 $sourcetouse = 'boothlocation';
485 $reftouse = $facture->id;
486 $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id;
487 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
488 if (getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
489 $redirection .= '&securekey='.dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . $sourcetouse . $reftouse, '2'); // Use the source in the hash to avoid duplicates if the references are identical
490 } else {
491 $redirection .= '&securekey='.getDolGlobalString('PAYMENT_SECURITY_TOKEN');
492 }
493 }
494 header("Location: ".$redirection);
495 exit;
496 }*/
497 }
498 } else {
499 // If no price has been set for the booth, we confirm it as suggested and we update
500 $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
501 $conforbooth->update($user);
502 }
503 }
504 }
505 }
506 }
507
508 if (!$error && is_object($thirdparty)) {
509 $db->commit();
510
511 // Sending mail
512 require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
513 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
514 $formmail = new FormMail($db);
515 // Set output language
516 $outputlangs = new Translate('', $conf);
517 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
518 // Load traductions files required by page
519 $outputlangs->loadLangs(array("main", "members", "eventorganization"));
520 // Get email content from template
521 $arraydefaultmessage = null;
522
523 $labeltouse = getDolGlobalInt('EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH');
524 if (!empty($labeltouse)) {
525 $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
526 }
527
528 $subject = '';
529 $msg = '';
530 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
531 $subject = $arraydefaultmessage->topic;
532 $msg = $arraydefaultmessage->content;
533 }
534
535 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
536 complete_substitutions_array($substitutionarray, $outputlangs, $project);
537
538 $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
539 $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
540
541 $sendto = $thirdparty->email;
542 $from = getDolGlobalString('MAILING_EMAIL_FROM');
543 $urlback = $_SERVER["REQUEST_URI"];
544 $trackid = 'proj'.$project->id;
545
546 $ishtml = dol_textishtml($texttosend); // May contain urls
547
548 $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml ? 1 : 0, '', '', $trackid);
549
550 $result = $mailfile->sendfile();
551 if ($result) {
552 dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
553 } else {
554 dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
555 }
556
557 $securekeyurl = dol_hash(getDolGlobalString('EVENTORGANIZATION_SECUREKEY') . 'conferenceorbooth'.((int) $id), 'md5');
558 $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl;
559 header("Location: ".$redirection);
560 exit;
561 } else {
562 $db->rollback();
563 }
564}
565
566
567/*
568 * View
569 */
570
571$form = new Form($db);
572$formcompany = new FormCompany($db);
573
574llxHeaderVierge($langs->trans("NewSuggestionOfBooth"));
575
576
577print '<div align="center">';
578print '<div id="divsubscribe">';
579
580print '<br>';
581
582// Sub banner
583print '<div class="center subscriptionformbanner subbanner justify margintoponly paddingtop marginbottomonly padingbottom">';
584print load_fiche_titre($langs->trans("NewSuggestionOfBooth"), '', '', 0, '', 'center');
585// Welcome message
586print '<span class="opacitymedium">'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'</span>';
587print '<br>';
588// Title
589print '<span class="eventlabel large">'.dol_escape_htmltag($project->title . ' '. $project->label).'</span><br>';
590print '</div>';
591
592
593// Help text
594print '<div class="justify subscriptionformhelptext">';
595
596if ($project->date_start_event || $project->date_end_event) {
597 print '<br><span class="fa fa-calendar pictofixedwidth opacitymedium"></span>';
598}
599if ($project->date_start_event) {
600 $format = 'day';
601 $tmparray = dol_getdate($project->date_start_event, false, '');
602 if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) {
603 $format = 'dayhour';
604 }
605 print dol_print_date($project->date_start_event, $format);
606}
607if ($project->date_start_event && $project->date_end_event) {
608 print ' - ';
609}
610if ($project->date_end_event) {
611 $format = 'day';
612 $tmparray = dol_getdate($project->date_end_event, false, '');
613 if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) {
614 $format = 'dayhour';
615 }
616 print dol_print_date($project->date_end_event, $format);
617}
618if ($project->date_start_event || $project->date_end_event) {
619 print '<br>';
620}
621if ($project->location) {
622 print '<span class="fa fa-map-marked-alt pictofixedwidth opacitymedium"></span>'.dol_escape_htmltag($project->location).'<br>';
623}
624if ($project->note_public) {
625 print '<br><!-- note public --><span class="opacitymedium">'.dol_htmlentitiesbr($project->note_public).'</span><br>';
626}
627
628print '</div>';
629
630print '<br>';
631
632
633dol_htmloutput_errors($errmsg, $errors);
634
635// Print form
636print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
637print '<input type="hidden" name="token" value="'.newToken().'" / >';
638print '<input type="hidden" name="entity" value="'.$entity.'" />';
639print '<input type="hidden" name="action" value="add" />';
640print '<input type="hidden" name="id" value="'.$id.'" />';
641print '<input type="hidden" name="securekey" value="'.$securekeyreceived.'" />';
642
643
644print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
645//print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
646
647print dol_get_fiche_head();
648
649print '<script type="text/javascript">
650jQuery(document).ready(function () {
651 jQuery(document).ready(function () {
652 jQuery("#selectcountry_id").change(function() {
653 document.newmember.action.value="create";
654 document.newmember.submit();
655 });
656 });
657});
658</script>';
659
660print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
661
662// Name
663print '<tr><td><label for="lastname">'.$langs->trans("Lastname").'<span class="star">*</span></label></td>';
664print '<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>';
665print '</tr>';
666// Email
667print '<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";
668// Company
669print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'<span class="star">*</span>';
670print ' </td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
671// Address
672print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
673print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
674// Zip / Town
675print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
676print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
677print ' / ';
678print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
679print '</td></tr>';
680// Country
681print '<tr><td>'.$langs->trans('Country');
682print '<span class="star">*</span>';
683print '</td><td>';
684$country_id = GETPOST('country_id');
685if (!$country_id && getDolGlobalString('MEMBER_NEWFORM_FORCECOUNTRYCODE')) {
686 $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, '2', $db, $langs);
687}
688if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
689 $country_code = dol_user_country();
690 //print $country_code;
691 if ($country_code) {
692 $new_country_id = getCountry($country_code, '3', $db, $langs);
693 //print 'xxx'.$country_code.' - '.$new_country_id;
694 if ($new_country_id) {
695 $country_id = $new_country_id;
696 }
697 }
698}
699$country_code = getCountry($country_id, '2', $db, $langs);
700print $form->select_country($country_id, 'country_id');
701print '</td></tr>';
702// State
703if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
704 print '<tr><td>'.$langs->trans('State').'</td><td>';
705 if ($country_code) {
706 print $formcompany->select_state(GETPOSTINT("state_id"), $country_code);
707 } else {
708 print '';
709 }
710 print '</td></tr>';
711}
712// Type of event
713print '<tr><td>'.$langs->trans("Format").'<span class="star">*</span></td>'."\n";
714print '<td>'.Form::selectarray('eventtype', $arrayofconfboothtype, $eventtype, 1).'</td>';
715// Label
716print '<tr><td>'.$langs->trans("LabelOfBooth").'<span class="star">*</span></td>'."\n";
717print '</td><td><input type="text" name="label" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>'."\n";
718// Note
719print '<tr><td>'.$langs->trans("Description").'<span class="star">*</span></td>'."\n";
720print '<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";
721
722print "</table>\n";
723
724print dol_get_fiche_end();
725
726
727// Show all action buttons
728print '<div class="center">';
729print '<br>';
730print '<input type="submit" value="'.$langs->trans("SuggestBooth").'" name="suggestbooth" id="suggestbooth" class="button">';
731print '</div>';
732print '<br><br>';
733
734
735print "</form>\n";
736print "<br>";
737print '</div></div>';
738
739
741
742$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:48
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
global $dolibarr_main_url_root
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, $morecssdiv='')
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.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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, $mode=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.