192$parameters = array();
194$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $project, $action);
200if (empty($reshook) && $action ==
'add') {
209 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Lastname")).
"<br>\n";
213 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Firstname")).
"<br>\n";
217 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Email")).
"<br>\n";
221 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Societe")).
"<br>\n";
225 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")).
"<br>\n";
229 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Note")).
"<br>\n";
233 $langs->load(
"errors");
234 $errmsg .= $langs->trans(
"ErrorBadEMail",
GETPOST(
"email")).
"<br>\n";
239 $thirdparty =
new Societe($db);
240 $resultfetchthirdparty = $thirdparty->fetch(
'', $societe);
242 if ($resultfetchthirdparty < 0) {
245 $errmsg .= $thirdparty->error;
246 $errors = array_merge($errors, $thirdparty->errors);
247 } elseif ($resultfetchthirdparty == 0) {
249 $genericcompanyname =
'Unknown company';
251 if (!empty($societe)) {
252 $thirdparty->name = $societe;
254 $thirdparty->name = $genericcompanyname;
256 $thirdparty->address =
GETPOST(
"address");
257 $thirdparty->zip =
GETPOST(
"zipcode");
258 $thirdparty->town =
GETPOST(
"town");
259 $thirdparty->client = $thirdparty::PROSPECT;
260 $thirdparty->fournisseur = 0;
261 $thirdparty->country_id =
GETPOSTINT(
"country_id");
262 $thirdparty->state_id =
GETPOSTINT(
"state_id");
263 $thirdparty->email = ($emailcompany ? $emailcompany : $email);
267 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
268 $module = substr($module, 0,
dol_strlen($module) - 4);
270 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
271 foreach ($dirsociete as $dirroot) {
277 $modCodeClient =
new $module($db);
279 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
280 $tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
282 $thirdparty->code_client = $tmpcode;
283 $readythirdparty = $thirdparty->create($user);
284 if ($readythirdparty < 0) {
286 $errmsg .= $thirdparty->error;
287 $errors = array_merge($errors, $thirdparty->errors);
289 $thirdparty->country_code =
getCountry($thirdparty->country_id,
'2', $db, $langs);
290 $thirdparty->country =
getCountry($thirdparty->country_code,
'', $db, $langs);
296 $resultcontact = $contact->fetch(
'',
'',
'', $email);
297 if ($resultcontact <= 0) {
299 $contact->socid = $thirdparty->id;
300 $contact->lastname = (string)
GETPOST(
"lastname",
'alpha');
301 $contact->firstname = (string)
GETPOST(
"firstname",
'alpha');
302 $contact->address = (string)
GETPOST(
"address",
'alpha');
303 $contact->zip = (string)
GETPOST(
"zipcode",
'alpha');
304 $contact->town = (string)
GETPOST(
"town",
'alpha');
305 $contact->country_id =
GETPOSTINT(
"country_id");
307 $contact->email = $email;
308 $contact->statut = 1;
309 $resultcreatecontact = $contact->create($user);
310 if ($resultcreatecontact < 0) {
312 $errmsg .= $contact->error;
321 $resultcategory = $category->fetch(
getDolGlobalString(
'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'));
323 if ($resultcategory <= 0) {
325 $errmsg .= $category->error;
327 $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), Categorie::TYPE_CUSTOMER,
false);
328 if ($resultsetcategory < 0) {
330 $errmsg .= $thirdparty->error;
332 $thirdparty->fournisseur = 1;
336 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
337 $module = substr($module, 0,
dol_strlen($module) - 4);
339 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
340 foreach ($dirsociete as $dirroot) {
346 $modCodeFournisseur =
new $module($db);
347 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
348 $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1);
350 $thirdparty->code_fournisseur = $tmpcode;
352 $res = $thirdparty->update(0, $user, 1, 1, 1);
364 $conforbooth->label = $label;
365 $conforbooth->fk_soc = $thirdparty->id;
366 $conforbooth->fk_project = $project->id;
367 $conforbooth->note = $note;
368 $conforbooth->fk_action = $eventtype;
369 $conforbooth->datep = $datestart;
370 $conforbooth->datep2 = $dateend;
371 $conforbooth->datec =
dol_now();
373 $conforbooth->firstname = $contact->firstname;
374 $conforbooth->lastname = $contact->lastname;
377 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
383 if ($nb_post_max > 0) {
384 $sql =
"SELECT COUNT(ref) as nb_confs";
385 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
386 $sql .=
" WHERE ip = '".$db->escape($conforbooth->ip).
"'";
387 $sql .=
" AND datec > '".$db->idate($minmonthpost).
"'";
388 $resql = $db->query($sql);
390 $num = $db->num_rows($resql);
394 $obj = $db->fetch_object($resql);
395 $nb_post_ip = $obj->nb_confs;
400 $resultconforbooth = 0;
402 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
404 $errmsg .= $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress");
405 array_push($conforbooth->errors, $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"));
408 $resultconforbooth = $conforbooth->create($user);
410 if ($resultconforbooth <= 0) {
412 $errmsg .= $conforbooth->error;
415 $resultaddcontact = $conforbooth->add_contact($contact->id,
'SPEAKER');
416 if ($resultaddcontact < 0) {
418 $errmsg .= $conforbooth->error;
420 $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
421 $conforbooth->update($user);
424 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
425 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
429 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
431 $outputlangs->loadLangs(array(
"main",
"members",
"eventorganization"));
433 $arraydefaultmessage =
null;
436 if (!empty($labeltouse)) {
437 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $labeltouse, 1,
'');
440 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
441 $subject = $arraydefaultmessage->topic;
442 $msg = $arraydefaultmessage->content;
451 $sendto = $thirdparty->email;
453 $urlback = $_SERVER[
"REQUEST_URI"];
454 $trackid =
'proj'.$project->id;
458 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(),
'',
'', 0, $ishtml ? 1 : 0,
'',
'', $trackid);
460 $result = $mailfile->sendfile();
462 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
464 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
474 $redirection = $dolibarr_main_url_root.
'/public/eventorganization/subscriptionok.php?id='.((int) $id).
'&securekey='.urlencode($securekeyurl);
475 header(
"Location: ".$redirection);
487$form =
new Form($db);
493print
'<div align="center">';
494print
'<div id="divsubscribe">';
499print
'<div class="center subscriptionformbanner subbanner justify margintoponly paddingtop marginbottomonly padingbottom">';
500print
load_fiche_titre($langs->trans(
"NewSuggestionOfConference"),
'',
'', 0,
'',
'center');
502print
'<span class="opacitymedium">'.$langs->trans(
"EvntOrgRegistrationWelcomeMessage").
'</span>';
505print
'<span class="eventlabel large">'.dol_escape_htmltag($project->title .
' '. $project->label).
'</span><br>';
509print
'<div class="justify subscriptionformhelptext">';
511if ($project->date_start_event || $project->date_end_event) {
512 print
'<br><span class="fa fa-calendar pictofixedwidth opacitymedium"></span>';
514if ($project->date_start_event) {
516 $tmparray =
dol_getdate($project->date_start_event,
false,
'');
517 if ($tmparray[
'hours'] || $tmparray[
'minutes'] || $tmparray[
'minutes']) {
522if ($project->date_start_event && $project->date_end_event) {
525if ($project->date_end_event) {
527 $tmparray =
dol_getdate($project->date_end_event,
false,
'');
528 if ($tmparray[
'hours'] || $tmparray[
'minutes'] || $tmparray[
'minutes']) {
533if ($project->date_start_event || $project->date_end_event) {
536if ($project->location) {
537 print
'<span class="fa fa-map-marked-alt pictofixedwidth opacitymedium"></span>'.dol_escape_htmltag($project->location).
'<br>';
539if ($project->note_public) {
540 print
'<br><!-- note public --><span class="opacitymedium">'.dol_htmlentitiesbr($project->note_public).
'</span><br>';
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs=array(), $arrayofcss=array(), $disableforlogin=0, $disablenofollow=0, $disablenoindex=0)
Output html header of a page.