diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index ceac7015065..36df3b1a7b9 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -3791,7 +3791,6 @@ abstract class CommonObject
} elseif ($objecttype == 'contact') {
$module = 'societe';
}
-
// Set classfile
$classfile = strtolower($subelement);
$classname = ucfirst($subelement);
@@ -3823,6 +3822,11 @@ abstract class CommonObject
$classfile = 'conferenceorboothattendee';
$classname = 'ConferenceOrBoothAttendee';
$module = 'eventorganization';
+ } elseif ($objecttype == 'conferenceorbooth') {
+ $classpath = 'eventorganization/class';
+ $classfile = 'conferenceorbooth';
+ $classname = 'ConferenceOrBooth';
+ $module = 'eventorganization';
}
// Here $module, $classfile and $classname are set
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 816e0a79225..d548c7d91e1 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -7642,6 +7642,10 @@ class Form
$tplpath = 'expensereport';
} elseif ($objecttype == 'subscription') {
$tplpath = 'adherents';
+ } elseif ($objecttype == 'conferenceorbooth') {
+ $tplpath = 'eventorganization';
+ } elseif ($objecttype == 'conferenceorboothattendee') {
+ $tplpath = 'eventorganization';
}
global $linkedObjectBlock;
diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php
index f983994c4ec..6ae9ab9664b 100644
--- a/htdocs/eventorganization/conferenceorbooth_card.php
+++ b/htdocs/eventorganization/conferenceorbooth_card.php
@@ -330,7 +330,15 @@ if (!empty($withproject)) {
print "";
print '
'.$langs->trans("EventOrganizationICSLink").' ';
- print '';
+ // Define $urlwithroot
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
+
+ // Show message
+ $message = 'entity : "");
+ $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
+ $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').' ';
+ print $message;
print " ";
print '';
@@ -496,6 +504,41 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$keyforbreak='pubregister';
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
+ $object->fetchObjectLinked();
+
+
+ if (is_array($object->linkedObjects) && count($object->linkedObjects)>0 && array_key_exists("facture", $object->linkedObjects)) {
+ foreach ($object->linkedObjects["facture"] as $fac) {
+ /**
+ * @var $fac Facture
+ */
+ if (empty($fac->paye)) {
+ $key = 'paymentlink_'.$fac->id;
+ print '';
+ print img_picto('', 'globe').' '.$langs->trans("ToOfferALinkForOnlinePayment", $langs->transnoentitiesnoconv('Online')) . ' '. $fac->ref.' ';
+ print ' ';
+
+ print '';
+ $sourcetouse = 'boothlocation';
+ $reftouse = $fac->id;
+ $redirection = $dolibarr_main_url_root.'/public/payment/newpayment.php?source='.$sourcetouse.'&ref='.$reftouse.'&booth='.$object->id;
+ if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
+ if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
+ $redirection .= '&securekey='.dol_hash($conf->global->PAYMENT_SECURITY_TOKEN . $sourcetouse . $reftouse, 2); // Use the source in the hash to avoid duplicates if the references are identical
+ } else {
+ $redirection .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
+ }
+ }
+ print '';
+ print ' ';
+ print ' ';
+ }
+ }
+ }
//var_dump($object);
// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php
index 0b1221006a8..ab595e8b86e 100644
--- a/htdocs/eventorganization/conferenceorbooth_list.php
+++ b/htdocs/eventorganization/conferenceorbooth_list.php
@@ -421,8 +421,6 @@ if ($projectid > 0) {
$message = 'entity : "");
$message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
$message .= "&project=".$projectid.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').' ';
- $message .= '';
- $message .= ' ';
print $message;
print "";
diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php
index c5f3a91b10e..fe5ea292e8b 100644
--- a/htdocs/eventorganization/conferenceorboothattendee_card.php
+++ b/htdocs/eventorganization/conferenceorboothattendee_card.php
@@ -336,7 +336,15 @@ if (!empty($withproject)) {
print "";
print ''.$langs->trans("EventOrganizationICSLink").' ';
- print '';
+ // Define $urlwithroot
+ $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
+
+ // Show message
+ $message = 'entity : "");
+ $message .= '&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...');
+ $message .= "&project=".$projectstatic->id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').' ';
+ print $message;
print " ";
print '';
diff --git a/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php b/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php
new file mode 100644
index 00000000000..f67e086a575
--- /dev/null
+++ b/htdocs/eventorganization/tpl/linkedobjectblock.tpl.php
@@ -0,0 +1,47 @@
+
+ * Copyright (C) 2013 Juanjo Menent
+ * Copyright (C) 2014 Marcos GarcĂa
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+// Protection to avoid direct call of template
+if (empty($conf) || !is_object($conf)) {
+ print "Error, template page can't be called as URL";
+ exit;
+}
+
+echo "\n";
+
+global $user;
+
+$langs = $GLOBALS['langs'];
+$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
+$langs->load("eventorganization");
+
+$total = 0;
+foreach ($linkedObjectBlock as $key => $objectlink) {
+ echo '';
+ echo '' . $langs->trans(get_class($objectlink)) . ' ';
+ echo ''.$objectlink->getNomUrl(1).' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').' ';
+ echo ' ';
+}
+
+echo "\n";
diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang
index f361e6bc192..67a242e640a 100644
--- a/htdocs/langs/en_US/eventorganization.lang
+++ b/htdocs/langs/en_US/eventorganization.lang
@@ -119,6 +119,8 @@ EventType = Event type
LabelOfBooth=Booth label
LabelOfconference=Conference label
ConferenceIsNotConfirmed=Subcription not available, conference is not confirmed yet
+DateMustBeBeforeThan=%s must be before %s
+DateMustBeAfterThan=%s must be after %s
#
# Vote page
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index 2f566d4bb31..4db8a62a625 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -1031,6 +1031,8 @@ if ($ispaymentok) {
if ($resultattendee < 0) {
setEventMessages(null, $attendeetovalidate->errors, "errors");
} else {
+ $attendeetovalidate->amount=$FinalPaymentAmt;
+ $attendeetovalidate->update($user);
$attendeetovalidate->validate($user);
// Sending mail
@@ -1051,8 +1053,9 @@ if ($ispaymentok) {
$arraydefaultmessage = null;
$labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT;
+
if (!empty($labeltouse)) {
- $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, '');
+ $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
}
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
@@ -1066,7 +1069,7 @@ if ($ispaymentok) {
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
- $sendto = $thirdparty->email;
+ $sendto = $attendeetovalidate->email;
$from = $conf->global->MAILING_EMAIL_FROM;
$urlback = $_SERVER["REQUEST_URI"];
@@ -1233,7 +1236,7 @@ if ($ispaymentok) {
$labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT;
if (!empty($labeltouse)) {
- $arraydefaultmessage = $formmail->getEMailTemplate($db, 'eventorganization_send', $user, $outputlangs, $labeltouse, 1, '');
+ $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
}
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php
index 3ab8e165c7e..c695ea9cec1 100644
--- a/htdocs/public/project/suggestbooth.php
+++ b/htdocs/public/project/suggestbooth.php
@@ -81,9 +81,8 @@ $email = GETPOST("email");
$societe = GETPOST("societe");
$label = GETPOST("label");
$note = GETPOST("note");
-$datestart = GETPOST("datestart");
-$dateend = GETPOST("dateend");
-
+$datestart = dol_mktime(0, 0, 0, GETPOST('datestartmonth', 'int'), GETPOST('datestartday', 'int'), GETPOST('datestartyear', 'int'));
+$dateend = dol_mktime(23, 59, 59, GETPOST('dateendmonth', 'int'), GETPOST('dateendday', 'int'), GETPOST('dateendyear', 'int'));
$id = GETPOST('id');
$project = new Project($db);
@@ -225,13 +224,19 @@ if (empty($reshook) && $action == 'add') {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Note"))." \n";
}
- if (!GETPOST("datestart")) {
+ if (empty($datestart)) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateStart"))." \n";
+ } elseif ($datestart < $project->date_start) {
+ $error++;
+ $errmsg .= $langs->trans("DateMustBeAfterThan", $langs->transnoentitiesnoconv("DateStart"), dol_print_date($project->date_start))." \n";
}
- if (!GETPOST("dateend")) {
+ if (empty($dateend)) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd"))." \n";
+ } elseif ($dateend > dol_mktime(23, 59, 59, dol_print_date($project->date_end, '%m'), dol_print_date($project->date_end, '%d'), dol_print_date($project->date_end, '%Y'))) {
+ $error++;
+ $errmsg .= $langs->trans("DateMustBeBeforeThan", $langs->transnoentitiesnoconv("DateEnd"), dol_print_date($project->date_end))." \n";
}
if (!GETPOST("email")) {
$error++;
@@ -376,7 +381,7 @@ if (empty($reshook) && $action == 'add') {
$conforbooth->fk_project = $project->id;
$conforbooth->note = $note;
$conforbooth->fk_action = $eventtype;
- $conforbooth->datep =$datestart;
+ $conforbooth->datep = $datestart;
$conforbooth->datep2 = $dateend;
$conforbooth->datec = dol_now();
$conforbooth->tms = dol_now();
@@ -423,7 +428,7 @@ if (empty($reshook) && $action == 'add') {
$error++;
} else {
$db->commit();
- $facture->add_object_linked($contact->element, $contact->id);
+ $facture->add_object_linked($conforbooth->element, $conforbooth->id);
}
}
@@ -436,7 +441,7 @@ if (empty($reshook) && $action == 'add') {
$contact->errors = $facture->errors;
$error++;
}
- if (!$error) {
+ /*if (!$error) {
$valid = true;
$sourcetouse = 'boothlocation';
$reftouse = $facture->id;
@@ -450,54 +455,12 @@ if (empty($reshook) && $action == 'add') {
}
Header("Location: ".$redirection);
exit;
- }
+ }*/
}
} else {
// If no price has been set for the booth, we confirm it as suggested and we update
$conforbooth->status = ConferenceOrBooth::STATUS_SUGGESTED;
$conforbooth->update($user);
- // Sending mail
- require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
- include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
- $formmail = new FormMail($db);
- // Set output language
- $outputlangs = new Translate('', $conf);
- $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
- // Load traductions files required by page
- $outputlangs->loadLangs(array("main", "members"));
- // Get email content from template
- $arraydefaultmessage = null;
-
- $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH;
- if (!empty($labeltouse)) {
- $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
- }
-
- if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
- $subject = $arraydefaultmessage->topic;
- $msg = $arraydefaultmessage->content;
- }
-
- $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
- complete_substitutions_array($substitutionarray, $outputlangs, $object);
-
- $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
- $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
-
- $sendto = $thirdparty->email;
- $from = $conf->global->MAILING_EMAIL_FROM;
- $urlback = $_SERVER["REQUEST_URI"];
-
- $ishtml = dol_textishtml($texttosend); // May contain urls
-
- $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml);
-
- $result = $mailfile->sendfile();
- if ($result) {
- dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
- } else {
- dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
- }
}
}
}
@@ -505,6 +468,50 @@ if (empty($reshook) && $action == 'add') {
}
if (!$error) {
$db->commit();
+
+ // Sending mail
+ require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
+ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
+ $formmail = new FormMail($db);
+ // Set output language
+ $outputlangs = new Translate('', $conf);
+ $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang);
+ // Load traductions files required by page
+ $outputlangs->loadLangs(array("main", "members"));
+ // Get email content from template
+ $arraydefaultmessage = null;
+
+ $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH;
+ if (!empty($labeltouse)) {
+ $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, '');
+ }
+
+ if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
+ $subject = $arraydefaultmessage->topic;
+ $msg = $arraydefaultmessage->content;
+ }
+
+ $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $thirdparty);
+ complete_substitutions_array($substitutionarray, $outputlangs, $object);
+
+ $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
+ $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
+
+ $sendto = $thirdparty->email;
+ $from = $conf->global->MAILING_EMAIL_FROM;
+ $urlback = $_SERVER["REQUEST_URI"];
+
+ $ishtml = dol_textishtml($texttosend); // May contain urls
+
+ $mailfile = new CMailFile($subjecttosend, $sendto, $from, $texttosend, array(), array(), array(), '', '', 0, $ishtml);
+
+ $result = $mailfile->sendfile();
+ if ($result) {
+ dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment');
+ } else {
+ dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment');
+ }
+
$securekeyurl = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$id, 2);
$redirection = $dolibarr_main_url_root.'/public/eventorganization/subscriptionok.php?id='.$id.'&securekey='.$securekeyurl;
Header("Location: ".$redirection);
@@ -630,12 +637,23 @@ print ' * '."\n";
print ' '."\n";
// Start Date
-print ''.$langs->trans("DateStart").'* '."\n";
-print ' '."\n";
+print ''.$langs->trans("DateStart").'* ';
+if (!empty($project->date_start)) {
+ print '('.$langs->trans('Min'). ' '.dol_print_date($project->date_start).')';
+}
+print ' '."\n";
+print '';
+print $form->selectDate((empty($datestart)?$project->date_start:$datestart), 'datestart');
+print ' '."\n";
// End Date
-print ''.$langs->trans("DateEnd").'* '."\n";
-print ' '."\n";
-
+print ''.$langs->trans("DateEnd").'* ';
+if (!empty($project->date_end)) {
+ print '('.$langs->trans('Max'). ' '.dol_print_date($project->date_end).')';
+}
+print ' '."\n";
+print '';
+print $form->selectDate(empty($dateend)?$project->date_end:$dateend, 'dateend');
+print ' '."\n";
print "\n";