190$parameters = array();
192$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $project, $action);
198if (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) {
243 $errmsg .= $thirdparty->error;
244 $errors = array_merge($errors, $thirdparty->errors);
245 } elseif ($resultfetchthirdparty == 0) {
247 $genericcompanyname =
'Unknown company';
249 if (!empty($societe)) {
250 $thirdparty->name = $societe;
252 $thirdparty->name = $genericcompanyname;
254 $thirdparty->address =
GETPOST(
"address");
255 $thirdparty->zip =
GETPOST(
"zipcode");
256 $thirdparty->town =
GETPOST(
"town");
257 $thirdparty->client = $thirdparty::PROSPECT;
258 $thirdparty->fournisseur = 0;
259 $thirdparty->country_id =
GETPOST(
"country_id",
'int');
260 $thirdparty->state_id =
GETPOST(
"state_id",
'int');
261 $thirdparty->email = ($emailcompany ? $emailcompany : $email);
264 $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON :
'mod_codeclient_leopard');
265 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
266 $module = substr($module, 0,
dol_strlen($module) - 4);
268 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
269 foreach ($dirsociete as $dirroot) {
275 $modCodeClient =
new $module($db);
277 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
278 $tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
280 $thirdparty->code_client = $tmpcode;
281 $readythirdparty = $thirdparty->create($user);
282 if ($readythirdparty <0) {
284 $errmsg .= $thirdparty->error;
285 $errors = array_merge($errors, $thirdparty->errors);
287 $thirdparty->country_code =
getCountry($thirdparty->country_id, 2, $db, $langs);
288 $thirdparty->country =
getCountry($thirdparty->country_code, 0, $db, $langs);
294 $resultcontact = $contact->fetch(
'',
'',
'', $email);
295 if ($resultcontact<=0) {
297 $contact->socid = $thirdparty->id;
298 $contact->lastname = (string)
GETPOST(
"lastname",
'alpha');
299 $contact->firstname = (string)
GETPOST(
"firstname",
'alpha');
300 $contact->address = (string)
GETPOST(
"address",
'alpha');
301 $contact->zip = (string)
GETPOST(
"zipcode",
'alpha');
302 $contact->town = (string)
GETPOST(
"town",
'alpha');
303 $contact->country_id = (int)
GETPOST(
"country_id",
'int');
304 $contact->state_id = (int)
GETPOST(
"state_id",
'int');
305 $contact->email = $email;
306 $contact->statut = 1;
307 $resultcreatecontact = $contact->create($user);
308 if ($resultcreatecontact<0) {
310 $errmsg .= $contact->error;
319 $resultcategory = $category->fetch($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF);
321 if ($resultcategory<=0) {
323 $errmsg .= $category->error;
325 $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), Categorie::TYPE_CUSTOMER,
false);
326 if ($resultsetcategory < 0) {
328 $errmsg .= $thirdparty->error;
330 $thirdparty->fournisseur = 1;
333 $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON :
'mod_codeclient_leopard');
334 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
335 $module = substr($module, 0,
dol_strlen($module) - 4);
337 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
338 foreach ($dirsociete as $dirroot) {
344 $modCodeFournisseur =
new $module;
345 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
346 $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1);
348 $thirdparty->code_fournisseur = $tmpcode;
350 $res = $thirdparty->update(0, $user, 1, 1, 1);
362 $conforbooth->label = $label;
363 $conforbooth->fk_soc = $thirdparty->id;
364 $conforbooth->fk_project = $project->id;
365 $conforbooth->note = $note;
366 $conforbooth->fk_action = $eventtype;
367 $conforbooth->datep =$datestart;
368 $conforbooth->datep2 = $dateend;
369 $conforbooth->datec =
dol_now();
371 $conforbooth->firstname = $contact->firstname;
372 $conforbooth->lastname = $contact->lastname;
375 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
381 if ($nb_post_max > 0) {
382 $sql =
"SELECT COUNT(ref) as nb_confs";
383 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
384 $sql .=
" WHERE ip = '".$db->escape($conforbooth->ip).
"'";
385 $sql .=
" AND datec > '".$db->idate($minmonthpost).
"'";
386 $resql = $db->query($sql);
388 $num = $db->num_rows($resql);
392 $obj = $db->fetch_object($resql);
393 $nb_post_ip = $obj->nb_confs;
398 $resultconforbooth = 0;
400 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
402 $errmsg .= $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress");
403 array_push($conforbooth->errors, $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"));
406 $resultconforbooth = $conforbooth->create($user);
408 if ($resultconforbooth<=0) {
410 $errmsg .= $conforbooth->error;
413 $resultaddcontact = $conforbooth->add_contact($contact->id,
'SPEAKER');
414 if ($resultaddcontact<0) {
416 $errmsg .= $conforbooth->error;
418 $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
419 $conforbooth->update($user);
422 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
423 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
427 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
429 $outputlangs->loadLangs(array(
"main",
"members",
"eventorganization"));
431 $arraydefaultmessage =
null;
434 if (!empty($labeltouse)) {
435 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $labeltouse, 1,
'');
438 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
439 $subject = $arraydefaultmessage->topic;
440 $msg = $arraydefaultmessage->content;
449 $sendto = $thirdparty->email;
450 $from = $conf->global->MAILING_EMAIL_FROM;
451 $urlback = $_SERVER[
"REQUEST_URI"];
452 $trackid =
'proj'.$project->id;
456 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(),
'',
'', 0, $ishtml,
'',
'', $trackid);
458 $result = $mailfile->sendfile();
460 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
462 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
471 $securekeyurl =
dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.
'conferenceorbooth'.$id, 2);
472 $redirection = $dolibarr_main_url_root.
'/public/eventorganization/subscriptionok.php?id='.((int) $id).
'&securekey='.urlencode($securekeyurl);
473 Header(
"Location: ".$redirection);
485$form =
new Form($db);
491print
'<div align="center">';
492print
'<div id="divsubscribe">';
497print
'<div class="center subscriptionformbanner subbanner justify margintoponly paddingtop marginbottomonly padingbottom">';
498print
load_fiche_titre($langs->trans(
"NewSuggestionOfConference"),
'',
'', 0, 0,
'center');
500print
'<span class="opacitymedium">'.$langs->trans(
"EvntOrgRegistrationWelcomeMessage").
'</span>';
503print
'<span class="eventlabel large">'.dol_escape_htmltag($project->title .
' '. $project->label).
'</span><br>';
507print
'<div class="justify subscriptionformhelptext">';
509if ($project->date_start_event || $project->date_end_event) {
510 print
'<br><span class="fa fa-calendar pictofixedwidth opacitymedium"></span>';
512if ($project->date_start_event) {
514 $tmparray =
dol_getdate($project->date_start_event,
false,
'');
515 if ($tmparray[
'hours'] || $tmparray[
'minutes'] || $tmparray[
'minutes']) {
520if ($project->date_start_event && $project->date_end_event) {
523if ($project->date_end_event) {
525 $tmparray =
dol_getdate($project->date_end_event,
false,
'');
526 if ($tmparray[
'hours'] || $tmparray[
'minutes'] || $tmparray[
'minutes']) {
531if ($project->date_start_event || $project->date_end_event) {
534if ($project->location) {
535 print
'<span class="fa fa-map-marked-alt pictofixedwidth opacitymedium"></span>'.dol_escape_htmltag($project->location).
'<br>';
537if ($project->note_public) {
538 print
'<br><span class="opacitymedium">'.dol_htmlentitiesbr($project->note_public).
'</span><br>';
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Ouput html header of a page.