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