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