dolibarr  17.0.4
suggestconference.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 
78 $id = GETPOST('id');
79 
80 $project = new Project($db);
81 $resultproject = $project->fetch($id);
82 if ($resultproject < 0) {
83  $error++;
84  $errmsg .= $project->error;
85 }
86 
87 // Security check
88 $securekeyreceived = GETPOST('securekey', 'alpha');
89 $securekeytocompare = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 'md5');
90 
91 if ($securekeytocompare != $securekeyreceived) {
92  print $langs->trans('MissingOrBadSecureKey');
93  exit;
94 }
95 
96 // Load translation files
97 $langs->loadLangs(array("main", "companies", "install", "other", "eventorganization"));
98 
99 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
100 $hookmanager->initHooks(array('publicnewmembercard', 'globalcard'));
101 
102 $extrafields = new ExtraFields($db);
103 
104 $user->loadDefaultValues();
105 
106 $cactioncomm = new CActionComm($db);
107 $arrayofconfboothtype = $cactioncomm->liste_array('', 'id', '', 0, "module='conference@eventorganization'");
108 
109 // Security check
110 if (empty($conf->eventorganization->enabled)) {
111  httponly_accessforbidden('Module Event organization not enabled');
112 }
113 
114 
126 function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '')
127 {
128  global $user, $conf, $langs, $mysoc;
129 
130  top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); // Show html headers
131 
132  print '<body id="mainbody" class="publicnewmemberform">';
133 
134  // Define urllogo
135  $urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
136 
137  if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
138  $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
139  } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
140  $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
141  } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
142  $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
143  }
144 
145  print '<div class="center">';
146 
147  // Output html code for logo
148  if ($urllogo) {
149  print '<div class="backgreypublicpayment">';
150  print '<div class="logopublicpayment">';
151  print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
152  print '>';
153  print '</div>';
154  if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
155  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>';
156  }
157  print '</div>';
158  }
159 
160  if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_SUGGEST_CONFERENCE)) {
161  print '<div class="backimagepublicsuggestconference">';
162  print '<img id="idPROJECT_IMAGE_PUBLIC_SUGGEST_CONFERENCE" src="'.$conf->global->PROJECT_IMAGE_PUBLIC_SUGGEST_CONFERENCE.'">';
163  print '</div>';
164  }
165 
166  print '</div>';
167 
168  print '<div class="divmainbodylarge">';
169 }
170 
176 function llxFooterVierge()
177 {
178  print '</div>';
179 
180  printCommonFooter('public');
181 
182  print "</body>\n";
183  print "</html>\n";
184 }
185 
186 
187 
188 /*
189  * Actions
190  */
191 
192 $parameters = array();
193 // Note that $action and $object may have been modified by some hooks
194 $reshook = $hookmanager->executeHooks('doActions', $parameters, $project, $action);
195 if ($reshook < 0) {
196  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
197 }
198 
199 // Action called when page is submitted
200 if (empty($reshook) && $action == 'add') {
201  $error = 0;
202 
203  $urlback = '';
204 
205  $db->begin();
206 
207  if (!GETPOST("lastname")) {
208  $error++;
209  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
210  }
211  if (!GETPOST("firstname")) {
212  $error++;
213  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
214  }
215  if (!GETPOST("email")) {
216  $error++;
217  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
218  }
219  if (!GETPOST("societe")) {
220  $error++;
221  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Societe"))."<br>\n";
222  }
223  if (!GETPOST("label")) {
224  $error++;
225  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label"))."<br>\n";
226  }
227  if (!GETPOST("note")) {
228  $error++;
229  $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))."<br>\n";
230  }
231  if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
232  $error++;
233  $langs->load("errors");
234  $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
235  }
236 
237  if (!$error) {
238  // Getting the thirdparty or creating it
239  $thirdparty = new Societe($db);
240  $resultfetchthirdparty = $thirdparty->fetch('', $societe);
241 
242  if ($resultfetchthirdparty < 0) {
243  // If an error was found
244  $error++;
245  $errmsg .= $thirdparty->error;
246  $errors = array_merge($errors, $thirdparty->errors);
247  } elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected
248  // Creation of a new thirdparty
249  $genericcompanyname = 'Unknown company';
250 
251  if (!empty($societe)) {
252  $thirdparty->name = $societe;
253  } else {
254  $thirdparty->name = $genericcompanyname;
255  }
256  $thirdparty->address = GETPOST("address");
257  $thirdparty->zip = GETPOST("zipcode");
258  $thirdparty->town = GETPOST("town");
259  $thirdparty->client = $thirdparty::PROSPECT;
260  $thirdparty->fournisseur = 0;
261  $thirdparty->country_id = GETPOST("country_id", 'int');
262  $thirdparty->state_id = GETPOST("state_id", 'int');
263  $thirdparty->email = ($emailcompany ? $emailcompany : $email);
264 
265  // Load object modCodeTiers
266  $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard');
267  if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') {
268  $module = substr($module, 0, dol_strlen($module) - 4);
269  }
270  $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']);
271  foreach ($dirsociete as $dirroot) {
272  $res = dol_include_once($dirroot.$module.'.php');
273  if ($res) {
274  break;
275  }
276  }
277  $modCodeClient = new $module($db);
278 
279  if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
280  $tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
281  }
282  $thirdparty->code_client = $tmpcode;
283  $readythirdparty = $thirdparty->create($user);
284  if ($readythirdparty <0) {
285  $error++;
286  $errmsg .= $thirdparty->error;
287  $errors = array_merge($errors, $thirdparty->errors);
288  } else {
289  $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs);
290  $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs);
291  }
292  }
293  // From there we have a thirdparty, now looking for the contact
294  if (!$error) {
295  $contact = new Contact($db);
296  $resultcontact = $contact->fetch('', '', '', $email);
297  if ($resultcontact<=0) {
298  // Need to create a contact
299  $contact->socid = $thirdparty->id;
300  $contact->lastname = (string) GETPOST("lastname", 'alpha');
301  $contact->firstname = (string) GETPOST("firstname", 'alpha');
302  $contact->address = (string) GETPOST("address", 'alpha');
303  $contact->zip = (string) GETPOST("zipcode", 'alpha');
304  $contact->town = (string) GETPOST("town", 'alpha');
305  $contact->country_id = (int) GETPOST("country_id", 'int');
306  $contact->state_id = (int) GETPOST("state_id", 'int');
307  $contact->email = $email;
308  $contact->statut = 1; //Default status to Actif
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_CONF);
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->firstname = $contact->firstname;
374  $conforbooth->lastname = $contact->lastname;
375  $conforbooth->ip = getUserRemoteIP();
376 
377  $nb_post_max = getDolGlobalInt("MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
378  $now = dol_now();
379  $minmonthpost = dol_time_plus_duree($now, -1, "m");
380 
381  // Calculate nb of post for IP
382  $nb_post_ip = 0;
383  if ($nb_post_max > 0) { // Calculate only if there is a limit to check
384  $sql = "SELECT COUNT(ref) as nb_confs";
385  $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm";
386  $sql .= " WHERE ip = '".$db->escape($conforbooth->ip)."'";
387  $sql .= " AND datec > '".$db->idate($minmonthpost)."'";
388  $resql = $db->query($sql);
389  if ($resql) {
390  $num = $db->num_rows($resql);
391  $i = 0;
392  while ($i < $num) {
393  $i++;
394  $obj = $db->fetch_object($resql);
395  $nb_post_ip = $obj->nb_confs;
396  }
397  }
398  }
399 
400  $resultconforbooth = 0;
401 
402  if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
403  $error++;
404  $errmsg .= $langs->trans("AlreadyTooMuchPostOnThisIPAdress");
405  array_push($conforbooth->errors, $langs->trans("AlreadyTooMuchPostOnThisIPAdress"));
406  setEventMessage($errmsg, 'errors');
407  } else {
408  $resultconforbooth = $conforbooth->create($user);
409  }
410  if ($resultconforbooth<=0) {
411  $error++;
412  $errmsg .= $conforbooth->error;
413  } else {
414  // Adding the contact to the project
415  $resultaddcontact = $conforbooth->add_contact($contact->id, 'SPEAKER');
416  if ($resultaddcontact<0) {
417  $error++;
418  $errmsg .= $conforbooth->error;
419  } else {
420  $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
421  $conforbooth->update($user);
422 
423  // Sending mail
424  require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
425  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
426  $formmail = new FormMail($db);
427  // Set output language
428  $outputlangs = new Translate('', $conf);
429  $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
430  // Load traductions files required by page
431  $outputlangs->loadLangs(array("main", "members", "eventorganization"));
432  // Get email content from template
433  $arraydefaultmessage = null;
434 
435  $labeltouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF');
436  if (!empty($labeltouse)) {
437  $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
438  }
439 
440  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
441  $subject = $arraydefaultmessage->topic;
442  $msg = $arraydefaultmessage->content;
443  }
444 
445  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
446  complete_substitutions_array($substitutionarray, $outputlangs, $project);
447 
448  $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
449  $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
450 
451  $sendto = $thirdparty->email;
452  $from = $conf->global->MAILING_EMAIL_FROM;
453  $urlback = $_SERVER["REQUEST_URI"];
454  $trackid = 'proj'.$project->id;
455 
456  $ishtml = dol_textishtml($texttosend); // May contain urls
457 
458  $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml, '', '', $trackid);
459 
460  $result = $mailfile->sendfile();
461  if ($result) {
462  dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
463  } else {
464  dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
465  }
466  }
467  }
468  }
469  }
470 
471  if (!$error) {
472  $db->commit();
473  $securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
474  $redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.((int) $id).'&securekey='.urlencode($securekeyurl);
475  Header("Location: ".$redirection);
476  exit;
477  } else {
478  $db->rollback();
479  }
480 }
481 
482 
483 /*
484  * View
485  */
486 
487 $form = new Form($db);
488 $formcompany = new FormCompany($db);
489 
490 llxHeaderVierge($langs->trans("NewSuggestionOfConference"));
491 
492 
493 print '<div align="center">';
494 print '<div id="divsubscribe">';
495 
496 print '<br>';
497 
498 // Sub banner
499 print '<div class="center subscriptionformbanner subbanner justify margintoponly paddingtop marginbottomonly padingbottom">';
500 print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center');
501 // Welcome message
502 print '<span class="opacitymedium">'.$langs->trans("EvntOrgRegistrationWelcomeMessage").'</span>';
503 print '<br>';
504 // Title
505 print '<span class="eventlabel large">'.dol_escape_htmltag($project->title . ' '. $project->label).'</span><br>';
506 print '</div>';
507 
508 // Help text
509 print '<div class="justify subscriptionformhelptext">';
510 
511 if ($project->date_start_event || $project->date_end_event) {
512  print '<br><span class="fa fa-calendar pictofixedwidth opacitymedium"></span>';
513 }
514 if ($project->date_start_event) {
515  $format = 'day';
516  $tmparray = dol_getdate($project->date_start_event, false, '');
517  if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) {
518  $format = 'dayhour';
519  }
520  print dol_print_date($project->date_start_event, $format);
521 }
522 if ($project->date_start_event && $project->date_end_event) {
523  print ' - ';
524 }
525 if ($project->date_end_event) {
526  $format = 'day';
527  $tmparray = dol_getdate($project->date_end_event, false, '');
528  if ($tmparray['hours'] || $tmparray['minutes'] || $tmparray['minutes']) {
529  $format = 'dayhour';
530  }
531  print dol_print_date($project->date_end_event, $format);
532 }
533 if ($project->date_start_event || $project->date_end_event) {
534  print '<br>';
535 }
536 if ($project->location) {
537  print '<span class="fa fa-map-marked-alt pictofixedwidth opacitymedium"></span>'.dol_escape_htmltag($project->location).'<br>';
538 }
539 if ($project->note_public) {
540  print '<br><span class="opacitymedium">'.dol_htmlentitiesbr($project->note_public).'</span><br>';
541 }
542 
543 print '</div>';
544 
545 print '<br>';
546 
547 
548 dol_htmloutput_errors($errmsg, $errors);
549 
550 // Print form
551 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
552 print '<input type="hidden" name="token" value="'.newToken().'" / >';
553 print '<input type="hidden" name="entity" value="'.$entity.'" />';
554 print '<input type="hidden" name="action" value="add" />';
555 print '<input type="hidden" name="id" value="'.$id.'" />';
556 print '<input type="hidden" name="securekey" value="'.$securekeyreceived.'" />';
557 
558 print '<br><span class="opacitymedium">'.$langs->trans("FieldsWithAreMandatory", '*').'</span><br>';
559 //print $langs->trans("FieldsWithIsForPublic",'**').'<br>';
560 
561 print dol_get_fiche_head('');
562 
563 print '<script type="text/javascript">
564 jQuery(document).ready(function () {
565  jQuery(document).ready(function () {
566  jQuery("#selectcountry_id").change(function() {
567  document.newmember.action.value="create";
568  document.newmember.submit();
569  });
570  });
571 });
572 </script>';
573 
574 print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
575 
576 // Last Name
577 print '<tr><td><label for="lastname">'.$langs->trans("Lastname").'<span style="color: red">*</span></label></td>';
578 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>';
579 print '</tr>';
580 // First Name
581 print '<tr><td><label for="firstname">'.$langs->trans("Firstname").'<span style="color: red">*</span></label></td>';
582 print '<td colspan="3"><input name="firstname" id="firstname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(GETPOST("firstname", 'alpha') ?GETPOST("firstname", 'alpha') : $object->firstname).'" autofocus="autofocus"></td>';
583 print '</tr>';
584 // Email
585 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";
586 // Company
587 print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'<span style="color: red">*</span>';
588 print ' </td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
589 // Address
590 print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
591 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";
592 // Zip / Town
593 print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
594 print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
595 print ' / ';
596 print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
597 print '</td></tr>';
598 // Country
599 print '<tr><td>'.$langs->trans('Country').'</td><td>';
600 $country_id = GETPOST('country_id');
601 if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
602  $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
603 }
604 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
605  $country_code = dol_user_country();
606  //print $country_code;
607  if ($country_code) {
608  $new_country_id = getCountry($country_code, 3, $db, $langs);
609  //print 'xxx'.$country_code.' - '.$new_country_id;
610  if ($new_country_id) {
611  $country_id = $new_country_id;
612  }
613  }
614 }
615 $country_code = getCountry($country_id, 2, $db, $langs);
616 print $form->select_country($country_id, 'country_id');
617 print '</td></tr>';
618 // State
619 if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
620  print '<tr><td>'.$langs->trans('State').'</td><td>';
621  if ($country_code) {
622  print $formcompany->select_state(GETPOST("state_id"), $country_code);
623  } else {
624  print '';
625  }
626  print '</td></tr>';
627 }
628 // Type of event
629 print '<tr><td>'.$langs->trans("Format").'<span style="color: red">*</span></td>'."\n";
630 print '<td>'.Form::selectarray('eventtype', $arrayofconfboothtype, $eventtype, 1).'</td>';
631 // Label
632 print '<tr><td>'.$langs->trans("LabelOfconference").'<span class="star">*</span></td>'."\n";
633 print '</td><td><input type="text" name="label" class="minwidth300" value="'.dol_escape_htmltag(GETPOST('label')).'"></td></tr>'."\n";
634 // Note
635 print '<tr><td>'.$langs->trans("Description").'<span class="star">*</span></td>'."\n";
636 print '<td><textarea name="note" id="note" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_4.'">'.dol_escape_htmltag(GETPOST('note', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
637 
638 print "</table>\n";
639 
640 print dol_get_fiche_end();
641 
642 
643 // Show all action buttons
644 print '<div class="center">';
645 print '<br>';
646 print '<input type="submit" value="'.$langs->trans("SuggestConference").'" name="suggestconference" id="suggestconference" class="button">';
647 print '<br><br>';
648 
649 
650 
651 
652 print "</form>\n";
653 print "<br>";
654 print '</div></div>';
655 
656 
658 
659 $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 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 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.
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.