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