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