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