dolibarr  16.0.5
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 require '../../main.inc.php';
49 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
50 require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
51 require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
52 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
53 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
54 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
55 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
56 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/paymentterm.class.php';
57 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.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");
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  accessforbidden('', 0, 0, 1);
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("email")) {
205  $error++;
206  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
207  }
208  if (!GETPOST("label")) {
209  $error++;
210  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."<br>\n";
211  }
212  if (!GETPOST("note")) {
213  $error++;
214  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."<br>\n";
215  }
216  if (!GETPOST("email")) {
217  $error++;
218  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
219  }
220  if (!GETPOST("lastname")) {
221  $error++;
222  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name"))."<br>\n";
223  }
224  if (!GETPOST("societe")) {
225  $error++;
226  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<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  if (!GETPOST("country_id") && !empty(floatval($project->price_booth))) {
234  $error++;
235  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Country"))."<br>\n";
236  }
237 
238  if (!$error) {
239  // Getting the thirdparty or creating it
240  $thirdparty = new Societe($db);
241  $resultfetchthirdparty = $thirdparty->fetch('', $societe);
242 
243  if ($resultfetchthirdparty<=0) {
244  // Need to create a new one (not found or multiple with the same name)
245  $thirdparty->name = $societe;
246  $thirdparty->address = GETPOST("address");
247  $thirdparty->zip = GETPOST("zipcode");
248  $thirdparty->town = GETPOST("town");
249  $thirdparty->client = 2;
250  $thirdparty->fournisseur = 0;
251  $thirdparty->country_id = GETPOST("country_id", 'int');
252  $thirdparty->state_id = GETPOST("state_id", 'int');
253  $thirdparty->email = $email;
254 
255  // Load object modCodeTiers
256  $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
257  if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
258  $module = substr($module, 0, dol_strlen($module) - 4);
259  }
260  $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
261  foreach ($dirsociete as $dirroot) {
262  $res = dol_include_once($dirroot.$module.'.php');
263  if ($res) {
264  break;
265  }
266  }
267  $modCodeClient = new $module($db);
268 
269  if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
270  $tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
271  }
272  $thirdparty->code_client = $tmpcode;
273  $readythirdparty = $thirdparty->create($user);
274  if ($readythirdparty <0) {
275  $error++;
276  $errmsg .= $thirdparty->error;
277  } else {
278  $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs);
279  $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs);
280  }
281  }
282  // From there we have a thirdparty, now looking for the contact
283  if (!$error) {
284  $contact = new Contact($db);
285  $resultcontact = $contact->fetch('', '', '', $email);
286  if ($resultcontact<=0) {
287  // Need to create a contact
288  $contact->socid = $thirdparty->id;
289  $contact->lastname = (string) GETPOST("lastname", 'alpha');
290  $contact->firstname = (string) GETPOST("firstname", 'alpha');
291  $contact->address = (string) GETPOST("address", 'alpha');
292  $contact->zip = (string) GETPOST("zipcode", 'alpha');
293  $contact->town = (string) GETPOST("town", 'alpha');
294  $contact->country_id = (int) GETPOST("country_id", 'int');
295  $contact->state_id = (int) GETPOST("state_id", 'int');
296  $contact->email = $email;
297  $contact->statut = 1; //Default status to Actif
298 
299  $resultcreatecontact = $contact->create($user);
300  if ($resultcreatecontact<0) {
301  $error++;
302  $errmsg .= $contact->error;
303  }
304  }
305  }
306 
307  if (!$error) {
308  // Adding supplier tag and tag from setup to thirdparty
309  $category = new Categorie($db);
310 
311  $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH);
312 
313  if ($resultcategory<=0) {
314  $error++;
315  $errmsg .= $category->error;
316  } else {
317  $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CUSTOMER, false);
318  if ($resultsetcategory < 0) {
319  $error++;
320  $errmsg .= $thirdparty->error;
321  } else {
322  $thirdparty->fournisseur = 1;
323 
324  // Load object modCodeFournisseur
325  $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
326  if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
327  $module = substr($module, 0, dol_strlen($module) - 4);
328  }
329  $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
330  foreach ($dirsociete as $dirroot) {
331  $res = dol_include_once($dirroot.$module.'.php');
332  if ($res) {
333  break;
334  }
335  }
336  $modCodeFournisseur = new $module;
337  if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
338  $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1);
339  }
340  $thirdparty->code_fournisseur = $tmpcode;
341 
342  $res = $thirdparty->update(0, $user, 1, 1, 1);
343 
344  if ($res <= 0) {
345  $error++;
346  }
347  }
348  }
349  }
350 
351  if (!$error) {
352  // We have the contact and the thirdparty
353  $conforbooth = new ConferenceOrBooth($db);
354  $conforbooth->label = $label;
355  $conforbooth->fk_soc = $thirdparty->id;
356  $conforbooth->fk_project = $project->id;
357  $conforbooth->note = $note;
358  $conforbooth->fk_action = $eventtype;
359  $conforbooth->datep = $datestart;
360  $conforbooth->datep2 = $dateend;
361  $conforbooth->datec = dol_now();
362  $conforbooth->tms = dol_now();
363  $resultconforbooth = $conforbooth->create($user);
364  if ($resultconforbooth<=0) {
365  $error++;
366  $errmsg .= $conforbooth->error;
367  } else {
368  // Adding the contact to the project
369  $resultaddcontact = $conforbooth->add_contact($contact->id, 'RESPONSIBLE');
370  if ($resultaddcontact<0) {
371  $error++;
372  $errmsg .= $conforbooth->error;
373  } else {
374  // If this is a paying booth, we have to redirect to payment page and create an invoice
375  if (!empty(floatval($project->price_booth))) {
376  $productforinvoicerow = new Product($db);
377  $resultprod = $productforinvoicerow->fetch($conf->global->SERVICE_BOOTH_LOCATION);
378  if ($resultprod < 0) {
379  $error++;
380  $errmsg .= $productforinvoicerow->error;
381  } else {
382  $facture = new Facture($db);
383  $facture->type = Facture::TYPE_STANDARD;
384  $facture->socid = $thirdparty->id;
385  $facture->paye = 0;
386  $facture->date = dol_now();
387  $facture->cond_reglement_id = $contact->cond_reglement_id;
388  $facture->fk_project = $project->id;
389 
390  if (empty($facture->cond_reglement_id)) {
391  $paymenttermstatic = new PaymentTerm($contact->db);
392  $facture->cond_reglement_id = $paymenttermstatic->getDefaultId();
393  if (empty($facture->cond_reglement_id)) {
394  $error++;
395  $contact->error = 'ErrorNoPaymentTermRECEPFound';
396  $contact->errors[] = $contact->error;
397  }
398  }
399  $resultfacture = $facture->create($user);
400  if ($resultfacture <= 0) {
401  $contact->error = $facture->error;
402  $contact->errors = $facture->errors;
403  $error++;
404  } else {
405  $db->commit();
406  $facture->add_object_linked($conforbooth->element, $conforbooth->id);
407  }
408  }
409 
410  if (!$error) {
411  // Add line to draft invoice
412  $vattouse = get_default_tva($mysoc, $thirdparty, $productforinvoicerow->id);
413  $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);
414  if ($result <= 0) {
415  $contact->error = $facture->error;
416  $contact->errors = $facture->errors;
417  $error++;
418  }
419  /*if (!$error) {
420  $valid = true;
421  $sourcetouse = 'boothlocation';
422  $reftouse = $facture->id;
423  $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$conforbooth->id;
424  if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
425  if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
426  $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
427  } else {
428  $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
429  }
430  }
431  Header("Location: ".$redirection);
432  exit;
433  }*/
434  }
435  } else {
436  // If no price has been set for the booth, we confirm it as suggested and we update
437  $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
438  $conforbooth->update($user);
439  }
440  }
441  }
442  }
443  }
444  if (!$error) {
445  $db->commit();
446 
447  // Sending mail
448  require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
449  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
450  $formmail = new FormMail($db);
451  // Set output language
452  $outputlangs = new Translate('', $conf);
453  $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
454  // Load traductions files required by page
455  $outputlangs->loadLangs(array("main", "members"));
456  // Get email content from template
457  $arraydefaultmessage = null;
458 
459  $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH;
460  if (!empty($labeltouse)) {
461  $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
462  }
463 
464  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
465  $subject = $arraydefaultmessage->topic;
466  $msg = $arraydefaultmessage->content;
467  }
468 
469  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
470  complete_substitutions_array($substitutionarray, $outputlangs, $object);
471 
472  $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
473  $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
474 
475  $sendto = $thirdparty->email;
476  $from = $conf->global->MAILING_EMAIL_FROM;
477  $urlback = $_SERVER["REQUEST_URI"];
478 
479  $ishtml = dol_textishtml($texttosend); // May contain urls
480 
481  $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml);
482 
483  $result = $mailfile->sendfile();
484  if ($result) {
485  dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
486  } else {
487  dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
488  }
489 
490  $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
491  $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl;
492  Header("Location: ".$redirection);
493  exit;
494  } else {
495  $db->rollback();
496  }
497 }
498 
499 
500 /*
501  * View
502  */
503 
504 $form = new Form($db);
505 $formcompany = new FormCompany($db);
506 
507 llxHeaderVierge($langs->trans("NewSuggestionOfBooth"));
508 
509 print '<br>';
510 
511 // Event summary
512 print '<div class="center">';
513 print '<span class="large">'.$project->title.'</span><br>';
514 print img_picto('', 'calendar', 'class="pictofixedwidth"').$langs->trans("Date").': ';
515 print dol_print_date($project->date_start, 'daytext');
516 if ($project->date_end && $project->date_start != $project->date_end) {
517  print ' - '.dol_print_date($project->date_end, 'daytext');
518 }
519 print '<br><br>'."\n";
520 //print $langs->trans("EvntOrgRegistrationWelcomeMessage")."\n";
521 //print $project->note_public."\n";
522 //print img_picto('', 'map-marker-alt').$langs->trans("Location").': xxxx';
523 print '</div>';
524 
525 
526 print load_fiche_titre($langs->trans("NewSuggestionOfBooth"), '', '', 0, 0, 'center');
527 
528 
529 print '<div align="center">';
530 print '<div id="divsubscribe">';
531 print '<div class="center subscriptionformhelptext justify">';
532 
533 dol_htmloutput_errors($errmsg);
534 
535 // Print form
536 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
537 print '<input type="hidden" name="token" value="'.newToken().'" / >';
538 print '<input type="hidden" name="entity" value="'.$entity.'" />';
539 print '<input type="hidden" name="action" value="add" />';
540 print '<input type="hidden" name="id" value="'.$id.'" />';
541 print '<input type="hidden" name="securekey" value="'.$securekeyreceived.'" />';
542 
543 print '<br>';
544 
545 print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
546 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
547 
548 print dol_get_fiche_head('');
549 
550 print '<script type="text/javascript">
551 jQuery(document).ready(function () {
552  jQuery(document).ready(function () {
553  jQuery("#selectcountry_id").change(function() {
554  document.newmember.action.value="create";
555  document.newmember.submit();
556  });
557  });
558 });
559 </script>';
560 
561 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
562 
563 // Name
564 print '<tr><td><label for="lastname">'.$langs->trans("Lastname").'<span style="color: red">*</span></label></td>';
565 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>';
566 print '</tr>';
567 // Email
568 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";
569 // Company
570 print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'<span style="color: red">*</span>';
571 print ' </td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
572 // Address
573 print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
574 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";
575 // Zip / Town
576 print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
577 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
578 print ' / ';
579 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
580 print '</td></tr>';
581 // Country
582 print '<tr><td>'.$langs->trans('Country');
583 print '<span style="color:red">*</span>';
584 
585 print '</td><td>';
586 $country_id = GETPOST('country_id');
587 if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
588  $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
589 }
590 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
591  $country_code = dol_user_country();
592  //print $country_code;
593  if ($country_code) {
594  $new_country_id = getCountry($country_code, 3, $db, $langs);
595  //print 'xxx'.$country_code.' - '.$new_country_id;
596  if ($new_country_id) {
597  $country_id = $new_country_id;
598  }
599  }
600 }
601 $country_code = getCountry($country_id, 2, $db, $langs);
602 print $form->select_country($country_id, 'country_id');
603 print '</td></tr>';
604 // State
605 if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
606  print '<tr><td>'.$langs->trans('State').'</td><td>';
607  if ($country_code) {
608  print $formcompany->select_state(GETPOST("state_id"), $country_code);
609  } else {
610  print '';
611  }
612  print '</td></tr>';
613 }
614 // Type of event
615 print '<tr><td>'.$langs->trans("Format").'<span style="color: red">*</span></td>'."\n";
616 print '<td>'.Form::selectarray('eventtype', $arrayofconfboothtype, $eventtype, 1).'</td>';
617 // Label
618 print '<tr><td>'.$langs->trans("LabelOfBooth").'<span style="color: red">*</span></td>'."\n";
619 print '</td><td><input type="text" name="label" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>'."\n";
620 // Note
621 print '<tr><td>'.$langs->trans("Description").'<span style="color: red">*</span></td>'."\n";
622 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";
623 
624 print "</table>\n";
625 
626 print dol_get_fiche_end();
627 
628 
629 // Show all action buttons
630 print '<div class="center">';
631 print '<br>';
632 print '<input type="submit" value="'.$langs->trans("SuggestBooth").'" name="suggestbooth" id="suggestbooth" class="button">';
633 print '</div>';
634 print '<br><br>';
635 
636 
637 
638 print "</form>\n";
639 print "<br>";
640 print '</div></div>';
641 
642 
644 
645 $db->close();
llxFooterVierge
llxFooterVierge()
Show footer for new member.
Definition: suggestbooth.php:173
make_substitutions
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
Definition: functions.lib.php:7839
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:48
dol_escape_htmltag
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.
Definition: functions.lib.php:1468
Project
Class to manage projects.
Definition: project.class.php:35
dol_htmloutput_errors
dol_htmloutput_errors($mesgstring='', $mesgarray=array(), $keepembedded=0)
Print formated error messages to output (Used to show messages on html output).
Definition: functions.lib.php:8367
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
llxHeaderVierge
if(empty($conf->eventorganization->enabled)) llxHeaderVierge($title, $head="", $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
Show header for new member.
Definition: suggestbooth.php:123
dol_include_once
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
Definition: functions.lib.php:1033
Translate
Class to manage translations.
Definition: translate.class.php:30
top_htmlhead
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:1482
CMailFile
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Definition: CMailFile.class.php:38
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
PaymentTerm
Class to manage payment terms records in dictionary.
Definition: paymentterm.class.php:28
Categorie
Class to manage categories.
Definition: categorie.class.php:47
Facture
Class to manage invoices.
Definition: facture.class.php:60
printCommonFooter
printCommonFooter($zone='private')
Print common footer : conf->global->MAIN_HTML_FOOTER js for switch of menu hider js for conf->global-...
Definition: functions.lib.php:9150
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
FormCompany
Class to build HTML component for third parties management Only common components are here.
Definition: html.formcompany.class.php:40
img_picto
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Definition: functions.lib.php:3880
dol_user_country
dol_user_country()
Return country code for current user.
Definition: functions.lib.php:3584
dol_hash
dol_hash($chain, $type='0')
Returns a hash of a string.
Definition: security.lib.php:104
CActionComm
Class to manage different types of events.
Definition: cactioncomm.class.php:29
isValidEmail
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
Definition: functions.lib.php:3681
getCommonSubstitutionArray
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
Definition: functions.lib.php:7275
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
Contact
Class to manage contact/addresses.
Definition: contact.class.php:40
ConferenceOrBooth
Class for ConferenceOrBooth.
Definition: conferenceorbooth.class.php:33
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
get_default_tva
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...
Definition: functions.lib.php:6304
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3747
dol_get_fiche_end
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Definition: functions.lib.php:2018
Facture\TYPE_STANDARD
const TYPE_STANDARD
Standard invoice.
Definition: facture.class.php:382
ExtraFields
Class to manage standard extra fields.
Definition: extrafields.class.php:39
Product
Class to manage products or services.
Definition: product.class.php:46
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
getCountry
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
Definition: company.lib.php:489
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
dol_textishtml
dol_textishtml($msg, $option=0)
Return if a text is a html content.
Definition: functions.lib.php:7185
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
FormMail
Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new For...
Definition: html.formmail.class.php:38
dol_mktime
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...
Definition: functions.lib.php:2757
complete_substitutions_array
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...
Definition: functions.lib.php:7961