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