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(0, $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);
278 '@phan-var-force ModeleThirdPartyCode $modCodeClient';
280 if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
281 $tmpcode = $modCodeClient->getNextValue($thirdparty, 0);
283 $thirdparty->code_client = $tmpcode;
284 $readythirdparty = $thirdparty->create($user);
285 if ($readythirdparty < 0) {
287 $errmsg .= $thirdparty->error;
288 $errors = array_merge($errors, $thirdparty->errors);
290 $thirdparty->country_code =
getCountry($thirdparty->country_id,
'2', $db, $langs);
291 $thirdparty->country =
getCountry($thirdparty->country_code,
'', $db, $langs);
297 $resultcontact = $contact->fetch(0,
null,
'', $email);
298 if ($resultcontact <= 0) {
300 $contact->socid = $thirdparty->id;
301 $contact->lastname = (string)
GETPOST(
"lastname",
'alpha');
302 $contact->firstname = (string)
GETPOST(
"firstname",
'alpha');
303 $contact->address = (string)
GETPOST(
"address",
'alpha');
304 $contact->zip = (string)
GETPOST(
"zipcode",
'alpha');
305 $contact->town = (string)
GETPOST(
"town",
'alpha');
306 $contact->country_id =
GETPOSTINT(
"country_id");
308 $contact->email = $email;
309 $contact->statut = 1;
310 $resultcreatecontact = $contact->create($user);
311 if ($resultcreatecontact < 0) {
313 $errmsg .= $contact->error;
322 $resultcategory = $category->fetch(
getDolGlobalString(
'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'));
324 if ($resultcategory <= 0) {
326 $errmsg .= $category->error;
328 $resultsetcategory = $thirdparty->setCategoriesCommon(array($category->id), Categorie::TYPE_CUSTOMER,
false);
329 if ($resultsetcategory < 0) {
331 $errmsg .= $thirdparty->error;
333 $thirdparty->fournisseur = 1;
337 if (substr($module, 0, 15) ==
'mod_codeclient_' && substr($module, -3) ==
'php') {
338 $module = substr($module, 0,
dol_strlen($module) - 4);
340 $dirsociete = array_merge(array(
'/core/modules/societe/'), $conf->modules_parts[
'societe']);
341 foreach ($dirsociete as $dirroot) {
347 $modCodeFournisseur =
new $module($db);
348 '@phan-var-force ModeleThirdPartyCode $modCodeFournisseur';
350 if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
351 $tmpcode = $modCodeFournisseur->getNextValue($thirdparty, 1);
353 $thirdparty->code_fournisseur = $tmpcode;
355 $res = $thirdparty->update(0, $user, 1, 1, 1);
367 $conforbooth->label = $label;
368 $conforbooth->fk_soc = $thirdparty->id;
369 $conforbooth->fk_project = $project->id;
370 $conforbooth->note = $note;
371 $conforbooth->fk_action = $eventtype;
372 $conforbooth->datep = $datestart;
373 $conforbooth->datep2 = $dateend;
374 $conforbooth->datec =
dol_now();
376 $conforbooth->firstname = $contact->firstname;
377 $conforbooth->lastname = $contact->lastname;
380 $nb_post_max =
getDolGlobalInt(
"MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS", 200);
386 if ($nb_post_max > 0) {
387 $sql =
"SELECT COUNT(ref) as nb_confs";
388 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
389 $sql .=
" WHERE ip = '".$db->escape($conforbooth->ip).
"'";
390 $sql .=
" AND datec > '".$db->idate($minmonthpost).
"'";
391 $resql = $db->query($sql);
393 $num = $db->num_rows($resql);
397 $obj = $db->fetch_object($resql);
398 $nb_post_ip = $obj->nb_confs;
403 $resultconforbooth = 0;
405 if ($nb_post_max > 0 && $nb_post_ip >= $nb_post_max) {
407 $errmsg .= $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress");
408 array_push($conforbooth->errors, $langs->trans(
"AlreadyTooMuchPostOnThisIPAdress"));
411 $resultconforbooth = $conforbooth->create($user);
413 if ($resultconforbooth <= 0) {
415 $errmsg .= $conforbooth->error;
418 $resultaddcontact = $conforbooth->add_contact($contact->id,
'SPEAKER');
419 if ($resultaddcontact < 0) {
421 $errmsg .= $conforbooth->error;
423 $conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
424 $conforbooth->update($user);
427 require_once DOL_DOCUMENT_ROOT.
'/core/class/CMailFile.class.php';
428 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmail.class.php';
432 $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
434 $outputlangs->loadLangs(array(
"main",
"members",
"eventorganization"));
436 $arraydefaultmessage =
null;
439 if (!empty($labeltouse)) {
440 $arraydefaultmessage = $formmail->getEMailTemplate($db,
'conferenceorbooth', $user, $outputlangs, $labeltouse, 1,
'');
445 if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
446 $subject = $arraydefaultmessage->topic;
447 $msg = $arraydefaultmessage->content;
456 $sendto = $thirdparty->email;
458 $urlback = $_SERVER[
"REQUEST_URI"];
459 $trackid =
'proj'.$project->id;
463 $mailfile =
new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(),
'',
'', 0, $ishtml ? 1 : 0,
'',
'', $trackid);
465 $result = $mailfile->sendfile();
467 dol_syslog(
"EMail sent to ".$sendto, LOG_DEBUG, 0,
'_payment');
469 dol_syslog(
"Failed to send EMail to ".$sendto, LOG_ERR, 0,
'_payment');
479 $redirection = $dolibarr_main_url_root.
'/public/eventorganization/subscriptionok.php?id='.((int) $id).
'&securekey='.urlencode($securekeyurl);
480 header(
"Location: ".$redirection);
492$form =
new Form($db);
498print
'<div align="center">';
499print
'<div id="divsubscribe">';
504print
'<div class="center subscriptionformbanner subbanner justify margintoponly paddingtop marginbottomonly padingbottom">';
505print
load_fiche_titre($langs->trans(
"NewSuggestionOfConference"),
'',
'', 0,
'',
'center');
507print
'<span class="opacitymedium">'.$langs->trans(
"EvntOrgRegistrationWelcomeMessage").
'</span>';
510print
'<span class="eventlabel large">'.dol_escape_htmltag($project->title .
' '. $project->label).
'</span><br>';
514print
'<div class="justify subscriptionformhelptext">';
516if ($project->date_start_event || $project->date_end_event) {
517 print
'<br><span class="fa fa-calendar pictofixedwidth opacitymedium"></span>';
519if ($project->date_start_event) {
521 $tmparray =
dol_getdate($project->date_start_event,
false,
'');
522 if ($tmparray[
'hours'] || $tmparray[
'minutes'] || $tmparray[
'minutes']) {
527if ($project->date_start_event && $project->date_end_event) {
530if ($project->date_end_event) {
532 $tmparray =
dol_getdate($project->date_end_event,
false,
'');
533 if ($tmparray[
'hours'] || $tmparray[
'minutes'] || $tmparray[
'minutes']) {
538if ($project->date_start_event || $project->date_end_event) {
541if ($project->location) {
542 print
'<span class="fa fa-map-marked-alt pictofixedwidth opacitymedium"></span>'.dol_escape_htmltag($project->location).
'<br>';
544if ($project->note_public) {
545 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.