191$parameters = array();
193$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $project, $action);
199if (empty($reshook) && $action ==
'add') {
208 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Lastname")).
"<br>\n";
212 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Firstname")).
"<br>\n";
216 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Email")).
"<br>\n";
220 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Societe")).
"<br>\n";
224 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")).
"<br>\n";
228 $errmsg .= $langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Note")).
"<br>\n";
232 $langs->load(
"errors");
233 $errmsg .= $langs->trans(
"ErrorBadEMail",
GETPOST(
"email")).
"<br>\n";
238 $thirdparty =
new Societe($db);
239 $resultfetchthirdparty = $thirdparty->fetch(
'', $societe);
241 if ($resultfetchthirdparty < 0) {
244 $errmsg .= $thirdparty->error;
245 $errors = array_merge($errors, $thirdparty->errors);
246 } elseif ($resultfetchthirdparty == 0) {
248 $genericcompanyname =
'Unknown company';
250 if (!empty($societe)) {
251 $thirdparty->name = $societe;
253 $thirdparty->name = $genericcompanyname;
255 $thirdparty->address =
GETPOST(
"address");
256 $thirdparty->zip =
GETPOST(
"zipcode");
257 $thirdparty->town =
GETPOST(
"town");
258 $thirdparty->client = $thirdparty::PROSPECT;
259 $thirdparty->fournisseur = 0;
260 $thirdparty->country_id =
GETPOSTINT(
"country_id");
261 $thirdparty->state_id =
GETPOSTINT(
"state_id");
262 $thirdparty->email = ($emailcompany ? $emailcompany : $email);
266 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
267 $module = substr($module, 0,
dol_strlen($module) - 4);
269 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
270 foreach ($dirsociete as $dirroot) {
276 $modCodeClient =
new $module($db);
278 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
279 $tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
281 $thirdparty->code_client = $tmpcode;
282 $readythirdparty = $thirdparty->create($user);
283 if ($readythirdparty < 0) {
285 $errmsg .= $thirdparty->error;
286 $errors = array_merge($errors, $thirdparty->errors);
288 $thirdparty->country_code =
getCountry($thirdparty->country_id, 2, $db, $langs);
289 $thirdparty->country =
getCountry($thirdparty->country_code, 0, $db, $langs);
295 $resultcontact = $contact->fetch(
'',
'',
'', $email);
296 if ($resultcontact <= 0) {
298 $contact->socid = $thirdparty->id;
299 $contact->lastname = (string)
GETPOST(
"lastname",
'alpha');
300 $contact->firstname = (string)
GETPOST(
"firstname",
'alpha');
301 $contact->address = (string)
GETPOST(
"address",
'alpha');
302 $contact->zip = (string)
GETPOST(
"zipcode",
'alpha');
303 $contact->town = (string)
GETPOST(
"town",
'alpha');
304 $contact->country_id =
GETPOSTINT(
"country_id");
306 $contact->email = $email;
307 $contact->statut = 1;
308 $resultcreatecontact = $contact->create($user);
309 if ($resultcreatecontact < 0) {
311 $errmsg .= $contact->error;
320 $resultcategory = $category->fetch(
getDolGlobalString(
'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'));
322 if ($resultcategory <= 0) {
324 $errmsg .= $category->error;
326 $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), Categorie::TYPE_CUSTOMER,
false);
327 if ($resultsetcategory < 0) {
329 $errmsg .= $thirdparty->error;
331 $thirdparty->fournisseur = 1;
335 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
336 $module = substr($module, 0,
dol_strlen($module) - 4);
338 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
339 foreach ($dirsociete as $dirroot) {
345 $modCodeFournisseur =
new $module($db);
346 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
347 $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1);
349 $thirdparty->code_fournisseur = $tmpcode;
351 $res = $thirdparty->update(0, $user, 1, 1, 1);
363 $conforbooth->label = $label;
364 $conforbooth->fk_soc = $thirdparty->id;
365 $conforbooth->fk_project = $project->id;
366 $conforbooth->note = $note;
367 $conforbooth->fk_action = $eventtype;
368 $conforbooth->datep = $datestart;
369 $conforbooth->datep2 = $dateend;
370 $conforbooth->datec =
dol_now();
372 $conforbooth->firstname = $contact->firstname;
373 $conforbooth->lastname = $contact->lastname;
376 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
382 if ($nb_post_max > 0) {
383 $sql =
"SELECT COUNT(ref) as nb_confs";
384 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
385 $sql .=
" WHERE ip = '".$db->escape($conforbooth->ip).
"'";
386 $sql .=
" AND datec > '".$db->idate($minmonthpost).
"'";
387 $resql = $db->query($sql);
389 $num = $db->num_rows($resql);
393 $obj = $db->fetch_object($resql);
394 $nb_post_ip = $obj->nb_confs;
399 $resultconforbooth = 0;
401 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
403 $errmsg .= $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress");
404 array_push($conforbooth->errors, $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"));
407 $resultconforbooth = $conforbooth->create($user);
409 if ($resultconforbooth <= 0) {
411 $errmsg .= $conforbooth->error;
414 $resultaddcontact = $conforbooth->add_contact($contact->id,
'SPEAKER');
415 if ($resultaddcontact < 0) {
417 $errmsg .= $conforbooth->error;
419 $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
420 $conforbooth->update($user);
423 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
424 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
428 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
430 $outputlangs->loadLangs(array(
"main",
"members",
"eventorganization"));
432 $arraydefaultmessage =
null;
435 if (!empty($labeltouse)) {
436 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $labeltouse, 1,
'');
439 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
440 $subject = $arraydefaultmessage->topic;
441 $msg = $arraydefaultmessage->content;
450 $sendto = $thirdparty->email;
452 $urlback = $_SERVER[
"REQUEST_URI"];
453 $trackid =
'proj'.$project->id;
457 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(),
'',
'', 0, $ishtml,
'',
'', $trackid);
459 $result = $mailfile->sendfile();
461 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
463 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
473 $redirection = $dolibarr_main_url_root.
'/public/eventorganization/subscriptionok.php?id='.((int) $id).
'&securekey='.urlencode($securekeyurl);
474 header(
"Location: ".$redirection);
486$form =
new Form($db);
492print
'<div align="center">';
493print
'<div id="divsubscribe">';
498print
'<div class="center subscriptionformbanner subbanner justify margintoponly paddingtop marginbottomonly padingbottom">';
499print
load_fiche_titre($langs->trans(
"NewSuggestionOfConference"),
'',
'', 0, 0,
'center');
501print
'<span class="opacitymedium">'.$langs->trans(
"EvntOrgRegistrationWelcomeMessage").
'</span>';
504print
'<span class="eventlabel large">'.dol_escape_htmltag($project->title .
' '. $project->label).
'</span><br>';
508print
'<div class="justify subscriptionformhelptext">';
510if ($project->date_start_event || $project->date_end_event) {
511 print
'<br><span class="fa fa-calendar pictofixedwidth opacitymedium"></span>';
513if ($project->date_start_event) {
515 $tmparray =
dol_getdate($project->date_start_event,
false,
'');
516 if ($tmparray[
'hours'] || $tmparray[
'minutes'] || $tmparray[
'minutes']) {
521if ($project->date_start_event && $project->date_end_event) {
524if ($project->date_end_event) {
526 $tmparray =
dol_getdate($project->date_end_event,
false,
'');
527 if ($tmparray[
'hours'] || $tmparray[
'minutes'] || $tmparray[
'minutes']) {
532if ($project->date_start_event || $project->date_end_event) {
535if ($project->location) {
536 print
'<span class="fa fa-map-marked-alt pictofixedwidth opacitymedium"></span>'.dol_escape_htmltag($project->location).
'<br>';
538if ($project->note_public) {
539 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.