24 if (!defined(
'NOLOGIN')) {
27 if (!defined(
'NOCSRFCHECK')) {
28 define(
"NOCSRFCHECK", 1);
30 if (!defined(
'NOIPCHECK')) {
31 define(
'NOIPCHECK',
'1');
33 if (!defined(
'NOBROWSERNOTIF')) {
34 define(
'NOBROWSERNOTIF',
'1');
36 if (!defined(
'NOIPCHECK')) {
37 define(
'NOIPCHECK',
'1');
43 $entity = (!empty($_GET[
'entity']) ? (int) $_GET[
'entity'] : (!empty($_POST[
'entity']) ? (int) $_POST[
'entity'] : 1));
44 if (is_numeric($entity)) {
45 define(
"DOLENTITY", $entity);
48 require
'../../main.inc.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
50 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/eventorganization/class/conferenceorbooth.class.php';
52 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
56 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/paymentterm.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
59 global $dolibarr_main_url_root;
65 $backtopage =
GETPOST(
'backtopage',
'alpha');
66 $action =
GETPOST(
'action',
'aZ09');
68 $eventtype =
GETPOST(
"eventtype");
73 $datestart =
GETPOST(
"datestart");
79 $resultproject = $project->fetch($id);
80 if ($resultproject < 0) {
82 $errmsg .= $project->error;
86 $securekeyreceived =
GETPOST(
"securekey");
87 $securekeytocompare =
dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.
'conferenceorbooth'.$id,
'md5');
89 if ($securekeytocompare != $securekeyreceived) {
90 print $langs->trans(
'MissingOrBadSecureKey');
95 $langs->loadLangs(array(
"main",
"companies",
"install",
"other",
"eventorganization"));
98 $hookmanager->initHooks(array(
'publicnewmembercard',
'globalcard'));
102 $user->loadDefaultValues();
105 $arrayofconfboothtype = $cactioncomm->liste_array(
'',
'id',
'', 0,
"module='conference@eventorganization'");
108 if (empty($conf->eventorganization->enabled)) {
124 function llxHeaderVierge($title, $head =
"", $disablejs = 0, $disablehead = 0, $arrayofjs =
'', $arrayofcss =
'')
126 global $user, $conf, $langs, $mysoc;
128 top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
130 print
'<body id="mainbody" class="publicnewmemberform">';
133 $urllogo = DOL_URL_ROOT.
'/theme/common/login_logo.png';
135 if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_small)) {
136 $urllogo = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/thumbs/'.$mysoc->logo_small);
137 } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.
'/logos/'.$mysoc->logo)) {
138 $urllogo = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/'.$mysoc->logo);
139 } elseif (is_readable(DOL_DOCUMENT_ROOT.
'/theme/dolibarr_logo.svg')) {
140 $urllogo = DOL_URL_ROOT.
'/theme/dolibarr_logo.svg';
143 print
'<div class="center">';
147 print
'<div class="backgreypublicpayment">';
148 print
'<div class="logopublicpayment">';
149 print
'<img id="dolpaymentlogo" src="'.$urllogo.
'"';
152 if (empty($conf->global->MAIN_HIDE_POWERED_BY)) {
153 print
'<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans(
"PoweredBy").
'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.
'/theme/dolibarr_logo.svg" width="80px"></a></div>';
158 if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_SUGGEST_CONFERENCE)) {
159 print
'<div class="backimagepublicsuggestconference">';
160 print
'<img id="idPROJECT_IMAGE_PUBLIC_SUGGEST_CONFERENCE" src="'.$conf->global->PROJECT_IMAGE_PUBLIC_SUGGEST_CONFERENCE.
'">';
166 print
'<div class="divmainbodylarge">';
190 $parameters = array();
192 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $project, $action);
198 if (empty($reshook) && $action ==
'add') {
207 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Lastname")).
"<br>\n";
211 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Firstname")).
"<br>\n";
215 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Email")).
"<br>\n";
219 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Societe")).
"<br>\n";
223 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")).
"<br>\n";
227 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Note")).
"<br>\n";
231 $langs->load(
"errors");
232 $errmsg .= $langs->trans(
"ErrorBadEMail",
GETPOST(
"email")).
"<br>\n";
237 $thirdparty =
new Societe($db);
238 $resultfetchthirdparty = $thirdparty->fetch(
'', $societe);
240 if ($resultfetchthirdparty<=0) {
242 $thirdparty->name = $societe;
243 $thirdparty->address =
GETPOST(
"address");
244 $thirdparty->zip =
GETPOST(
"zipcode");
245 $thirdparty->town =
GETPOST(
"town");
246 $thirdparty->client = 2;
247 $thirdparty->fournisseur = 0;
248 $thirdparty->country_id =
GETPOST(
"country_id",
'int');
249 $thirdparty->state_id =
GETPOST(
"state_id",
'int');
250 $thirdparty->email = $email;
253 $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON :
'mod_codeclient_leopard');
254 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
255 $module = substr($module, 0,
dol_strlen($module) - 4);
257 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
258 foreach ($dirsociete as $dirroot) {
264 $modCodeClient =
new $module($db);
266 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
267 $tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
269 $thirdparty->code_client = $tmpcode;
270 $readythirdparty = $thirdparty->create($user);
271 if ($readythirdparty <0) {
273 $errmsg .= $thirdparty->error;
275 $thirdparty->country_code =
getCountry($thirdparty->country_id, 2, $db, $langs);
276 $thirdparty->country =
getCountry($thirdparty->country_code, 0, $db, $langs);
282 $resultcontact = $contact->fetch(
'',
'',
'', $email);
283 if ($resultcontact<=0) {
285 $contact->socid = $thirdparty->id;
286 $contact->lastname = (string)
GETPOST(
"lastname",
'alpha');
287 $contact->firstname = (string)
GETPOST(
"firstname",
'alpha');
288 $contact->address = (string)
GETPOST(
"address",
'alpha');
289 $contact->zip = (string)
GETPOST(
"zipcode",
'alpha');
290 $contact->town = (string)
GETPOST(
"town",
'alpha');
291 $contact->country_id = (int)
GETPOST(
"country_id",
'int');
292 $contact->state_id = (int)
GETPOST(
"state_id",
'int');
293 $contact->email = $email;
294 $contact->statut = 1;
295 $resultcreatecontact = $contact->create($user);
296 if ($resultcreatecontact<0) {
298 $errmsg .= $contact->error;
307 $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF);
309 if ($resultcategory<=0) {
311 $errmsg .= $category->error;
313 $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), CATEGORIE::TYPE_CUSTOMER,
false);
314 if ($resultsetcategory < 0) {
316 $errmsg .= $thirdparty->error;
318 $thirdparty->fournisseur = 1;
321 $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON :
'mod_codeclient_leopard');
322 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
323 $module = substr($module, 0,
dol_strlen($module) - 4);
325 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
326 foreach ($dirsociete as $dirroot) {
332 $modCodeFournisseur =
new $module;
333 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
334 $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1);
336 $thirdparty->code_fournisseur = $tmpcode;
338 $res = $thirdparty->update(0, $user, 1, 1, 1);
350 $conforbooth->label = $label;
351 $conforbooth->fk_soc = $thirdparty->id;
352 $conforbooth->fk_project = $project->id;
353 $conforbooth->note = $note;
354 $conforbooth->fk_action = $eventtype;
355 $conforbooth->datep =$datestart;
356 $conforbooth->datep2 = $dateend;
357 $conforbooth->datec =
dol_now();
359 $conforbooth->firstname = $contact->firstname;
360 $conforbooth->lastname = $contact->lastname;
361 $resultconforbooth = $conforbooth->create($user);
362 if ($resultconforbooth<=0) {
364 $errmsg .= $conforbooth->error;
367 $resultaddcontact = $conforbooth->add_contact($contact->id,
'SPEAKER');
368 if ($resultaddcontact<0) {
370 $errmsg .= $conforbooth->error;
372 $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
373 $conforbooth->update($user);
376 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
377 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
381 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
383 $outputlangs->loadLangs(array(
"main",
"members"));
385 $arraydefaultmessage =
null;
387 $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF;
388 if (!empty($labeltouse)) {
389 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $labeltouse, 1,
'');
392 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
393 $subject = $arraydefaultmessage->topic;
394 $msg = $arraydefaultmessage->content;
403 $sendto = $thirdparty->email;
404 $from = $conf->global->MAILING_EMAIL_FROM;
405 $urlback = $_SERVER[
"REQUEST_URI"];
409 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(),
'',
'', 0, $ishtml);
411 $result = $mailfile->sendfile();
413 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
415 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
423 $securekeyurl =
dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.
'conferenceorbooth'.$id, 2);
424 $redirection = $dolibarr_main_url_root.
'/public/eventorganization/subscriptionok.php?id='.$id.
'&securekey='.$securekeyurl;
425 Header(
"Location: ".$redirection);
445 print
'<div class="center">';
446 print
'<span class="large">'.$project->title.
'</span><br>';
447 print
img_picto(
'',
'calendar',
'class="pictofixedwidth"').$langs->trans(
"Date").
': ';
449 if ($project->date_end && $project->date_start != $project->date_end) {
450 print
' - '.dol_print_date($project->date_end,
'daytext');
452 print
'<br><br>'.
"\n";
459 print
load_fiche_titre($langs->trans(
"NewSuggestionOfConference"),
'',
'', 0, 0,
'center');
462 print
'<div align="center">';
463 print
'<div id="divsubscribe">';
464 print
'<div class="center subscriptionformhelptext justify">';
469 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="POST" name="newmember">'.
"\n";
470 print
'<input type="hidden" name="token" value="'.newToken().
'" / >';
471 print
'<input type="hidden" name="entity" value="'.$entity.
'" />';
472 print
'<input type="hidden" name="action" value="add" />';
473 print
'<input type="hidden" name="id" value="'.$id.
'" />';
474 print
'<input type="hidden" name="securekey" value="'.$securekeyreceived.
'" />';
478 print
'<br><span class="opacitymedium">'.$langs->trans(
"FieldsWithAreMandatory",
'*').
'</span><br>';
483 print
'<script type="text/javascript">
484 jQuery(document).ready(function () {
485 jQuery(document).ready(function () {
486 jQuery("#selectcountry_id").change(function() {
487 document.newmember.action.value="create";
488 document.newmember.submit();
494 print
'<table class="border" summary="form to subscribe" id="tablesubscribe">'.
"\n";
497 print
'<tr><td><label for="lastname">'.$langs->trans(
"Lastname").
'<span style="color: red">*</span></label></td>';
498 print
'<td colspan="3"><input name="lastname" id="lastname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(
GETPOST(
"lastname",
'alpha') ?
GETPOST(
"lastname",
'alpha') : $object->lastname).
'" autofocus="autofocus"></td>';
501 print
'<tr><td><label for="firstname">'.$langs->trans(
"Firstname").
'<span style="color: red">*</span></label></td>';
502 print
'<td colspan="3"><input name="firstname" id="firstname" type="text" class="maxwidth100onsmartphone" maxlength="80" value="'.dol_escape_htmltag(
GETPOST(
"firstname",
'alpha') ?
GETPOST(
"firstname",
'alpha') : $object->firstname).
'" autofocus="autofocus"></td>';
505 print
'<tr><td>'.$langs->trans(
"Email").
'<span style="color: red">*</span></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.
dol_escape_htmltag(
GETPOST(
'email')).
'"></td></tr>'.
"\n";
507 print
'<tr id="trcompany" class="trcompany"><td>'.$langs->trans(
"Company").
'<span style="color: red">*</span>';
508 print
' </td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(
GETPOST(
'societe')).
'"></td></tr>'.
"\n";
510 print
'<tr><td>'.$langs->trans(
"Address").
'</td><td>'.
"\n";
511 print
'<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
dol_escape_htmltag(
GETPOST(
'address',
'restricthtml'), 0, 1).
'</textarea></td></tr>'.
"\n";
513 print
'<tr><td>'.$langs->trans(
'Zip').
' / '.$langs->trans(
'Town').
'</td><td>';
514 print $formcompany->select_ziptown(
GETPOST(
'zipcode'),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6, 1);
516 print $formcompany->select_ziptown(
GETPOST(
'town'),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'), 0, 1);
519 print
'<tr><td>'.$langs->trans(
'Country').
'</td><td>';
520 $country_id =
GETPOST(
'country_id');
521 if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
522 $country_id =
getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
524 if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
528 $new_country_id =
getCountry($country_code, 3, $db, $langs);
530 if ($new_country_id) {
531 $country_id = $new_country_id;
535 $country_code =
getCountry($country_id, 2, $db, $langs);
536 print
$form->select_country($country_id,
'country_id');
539 if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
540 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
542 print $formcompany->select_state(
GETPOST(
"state_id"), $country_code);
549 print
'<tr><td>'.$langs->trans(
"Format").
'<span style="color: red">*</span></td>'.
"\n";
550 print
'<td>'.Form::selectarray(
'eventtype', $arrayofconfboothtype, $eventtype, 1).
'</td>';
552 print
'<tr><td>'.$langs->trans(
"LabelOfconference").
'<span style="color: red">*</span></td>'.
"\n";
553 print
'</td><td><input type="text" name="label" class="minwidth150" value="'.dol_escape_htmltag(
GETPOST(
'label')).
'"></td></tr>'.
"\n";
555 print
'<tr><td>'.$langs->trans(
"Description").
'<span style="color: red">*</span></td>'.
"\n";
556 print
'<td><textarea name="note" id="note" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.
'">'.
dol_escape_htmltag(
GETPOST(
'note',
'restricthtml'), 0, 1).
'</textarea></td></tr>'.
"\n";
564 print
'<div class="center">';
566 print
'<input type="submit" value="'.$langs->trans(
"SuggestConference").
'" name="suggestconference" id="suggestconference" class="button">';
574 print
'</div></div>';