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