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