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