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