diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 47b70c2a3a3..a38315cb804 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -129,14 +129,18 @@ if ($reshook < 0) { if (empty($reshook)) { $error = 0; - $backurlforlist = dol_buildpath('/eventorganization/conferenceorbooth_list.php', 1); + if (!empty($withproject)) { + $backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_list.php?withproject=1&fk_project='.((int) $fk_project); + } else { + $backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_list.php'; + } if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = dol_buildpath('/eventorganization/conferenceorbooth_card.php', 1).'?id='.($id > 0 ? $id : '__ID__').($withproject ? '&withproject=1' : ''); + $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?fk_project='.((int) $fk_project).'&id='.($id > 0 ? $id : '__ID__').($withproject ? '&withproject=1' : ''); } } } @@ -271,17 +275,6 @@ if (!empty($withproject)) { print ''; } - // Visibility - print ''.$langs->trans("Visibility").''; - if ($projectstatic->public == 0) { - print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); - print $langs->trans("PrivateProject"); - } else { - print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); - print $langs->trans("SharedProject"); - } - print ''; - // Budget print ''.$langs->trans("Budget").''; if (strcmp($projectstatic->budget_amount, '')) { @@ -296,7 +289,7 @@ if (!empty($withproject)) { $end = dol_print_date($projectstatic->date_end, 'day'); print ' - '; print($end ? $end : '?'); - if ($object->hasDelay()) { + if ($projectstatic->hasDelay()) { print img_warning("Late"); } print ''; @@ -308,11 +301,22 @@ if (!empty($withproject)) { $end = dol_print_date($projectstatic->date_end_event, 'day'); print ' - '; print($end ? $end : '?'); - if ($object->hasDelay()) { + if ($projectstatic->hasDelay()) { print img_warning("Late"); } print ''; + // Visibility + print ''.$langs->trans("Visibility").''; + if ($projectstatic->public == 0) { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans("PrivateProject"); + } else { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans("SharedProject"); + } + print ''; + // Location event print ''.$langs->trans("Location").''; print $projectstatic->location; @@ -334,11 +338,6 @@ if (!empty($withproject)) { print ''; - // Description - print ''; - // Categories if (isModEnabled('category')) { print '"; } + // Description + print ''; + print '"; + // Link to ICS for the event + print '"; + + // Link for ICS for conference or booth print ''; @@ -438,7 +456,7 @@ if (!empty($withproject)) { print '
'; } -// Part to create +// Part to create a conference or booth if ($action == 'create') { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ConferenceOrBooth")), '', 'object_'.$object->picto); @@ -477,7 +495,7 @@ if ($action == 'create') { //dol_set_focus('input[name="ref"]'); } -// Part to edit record +// Part to edit conference or booth if (($id || $ref) && $action == 'edit') { print load_fiche_titre($langs->trans("ConferenceOrBooth"), '', 'object_'.$object->picto); @@ -514,7 +532,7 @@ if (($id || $ref) && $action == 'edit') { print ''; } -// Part to show record +// Part to show conference or booth if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { $res = $object->fetch_optionals(); diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 072279261a3..ac948910951 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; - +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; @@ -60,9 +60,10 @@ $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothattendeecard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -$lineid = GETPOSTINT('lineid'); $mode = GETPOST('mode', 'alpha'); +$lineid = GETPOSTINT('lineid'); + $conf_or_booth_id = GETPOSTINT('conforboothid'); $fk_project = GETPOSTINT('fk_project'); $withproject = 1; @@ -76,10 +77,9 @@ $hookmanager->initHooks(array('conferenceorboothattendeecard', 'globalcard')); / $confOrBooth = null; - -if ($conf_or_booth_id > 0) { +if ($conf_or_booth_id > 0 || $fk_project > 0) { $confOrBooth = new ConferenceOrBooth($db); - $result = $confOrBooth->fetch($id > 0 ? $id : $conf_or_booth_id); + $result = $confOrBooth->fetch($fk_project > 0 ? $fk_project : $conf_or_booth_id); if ($result < 0) { setEventMessages(null, $confOrBooth->errors, 'errors'); } else { @@ -135,6 +135,17 @@ $permissionnote = $user->hasRight('eventorganization', 'write'); // Used by the $permissiondellink = $user->hasRight('eventorganization', 'write'); // Used by the include of actions_dellink.inc.php $upload_dir = $conf->eventorganization->multidir_output[isset($object->entity) ? $object->entity : 1]; +// Security check +if ($user->socid > 0) { + accessforbidden(); +} +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +$result = restrictedArea($user, 'eventorganization', $object->id, '', '', 'fk_soc', 'id', $isdraft); + +if (!$permissiontoread) { + accessforbidden(); +} + /* * Actions @@ -160,7 +171,7 @@ if (empty($reshook)) { if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { $backtopage = $backurlforlist; } else { - $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?fk_project='.((int) $fk_project).'&id='.($id > 0 ? $id : '__ID__'); + $backtopage = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?fk_project='.((int) $fk_project).'&id='.($id > 0 ? $id : '__ID__').($withproject ? '&withproject=1' : ''); } } } @@ -231,13 +242,16 @@ if (!empty($projectstatic->socid)) { $projectstatic->fetch_thirdparty(); } - +$withProjectUrl = ''; $object->project = clone $projectstatic; if (!empty($withproject)) { // Tabs for project $tab = 'eventorganisation'; + $withProjectUrl = "&withproject=1"; + $head = project_prepare_head($projectstatic); + print dol_get_fiche_head($head, $tab, $langs->trans("Project"), -1, ($projectstatic->public ? 'projectpub' : 'project'), 0, '', ''); $param = ($mode == 'mine' ? '&mode=mine' : ''); @@ -256,7 +270,7 @@ if (!empty($withproject)) { $morehtmlref .= ''; // Define a complementary filter for search of next/prev ref. - if (!$user->hasRight('projet', 'all', 'lire')) { + if (!$user->hasRight('project', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); $projectstatic->next_prev_filter = "rowid:IN:".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0'); } @@ -301,17 +315,15 @@ if (!empty($withproject)) { print ''; } - // Visibility - print ''; - // Date start - end - print ''; - // Budget - print ''; + // Visibility + print ''; + + // Location event + print ''; + // Other attributes $cols = 2; //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; @@ -342,18 +375,18 @@ if (!empty($withproject)) { print '
'.$langs->trans("Description").''; - print dol_htmlentitiesbr($projectstatic->description); - print '
'.$langs->trans("Categories").''; @@ -346,6 +345,11 @@ if (!empty($withproject)) { print "
'.$langs->trans("Description").''; + print dol_htmlentitiesbr($projectstatic->description); + print '
'; $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); @@ -380,6 +384,20 @@ if (!empty($withproject)) { print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, null, '', 0, '', 'projectid'); print "
'.$langs->trans("EventOrganizationICSLinkProject").''; + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; + + // Show message + $message = 'ref.'.ics').'&output=file">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').''; + print $message; + print "
'.$langs->trans("EventOrganizationICSLink").''; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -421,7 +439,7 @@ if (!empty($withproject)) { //print ''; //print ajax_autoselect("linkregister"); print '
'.$langs->trans("Visibility").''; - if ($projectstatic->public) { - print $langs->trans('SharedProject'); - } else { - print $langs->trans('PrivateProject'); + // Budget + print '
'.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) { + print ''.price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency).''; } print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + // Date start - end project + print '
'.$langs->trans("Dates").' ('.$langs->trans("Project").')'; $start = dol_print_date($projectstatic->date_start, 'day'); print($start ? $start : '?'); $end = dol_print_date($projectstatic->date_end, 'day'); @@ -322,13 +334,34 @@ if (!empty($withproject)) { } print '
'.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) { - print price($projectstatic->budget_amount, 0, $langs, 1, 0, 0, $conf->currency); + // Date start - end of event + print '
'.$langs->trans("Dates").' ('.$langs->trans("Event").')'; + $start = dol_print_date($projectstatic->date_start_event, 'day'); + print($start ? $start : '?'); + $end = dol_print_date($projectstatic->date_end_event, 'day'); + print ' - '; + print($end ? $end : '?'); + if ($projectstatic->hasDelay()) { + print img_warning("Late"); } print '
'.$langs->trans("Visibility").''; + if ($projectstatic->public == 0) { + print img_picto($langs->trans('PrivateProject'), 'private', 'class="paddingrightonly"'); + print $langs->trans("PrivateProject"); + } else { + print img_picto($langs->trans('SharedProject'), 'world', 'class="paddingrightonly"'); + print $langs->trans("SharedProject"); + } + print '
'.$langs->trans("Location").''; + print $projectstatic->location; + print '
'; + // Categories + if (isModEnabled('category')) { + print '"; + } + // Description print ''; - // Categories - if (isModEnabled('category')) { - print '"; - } - print '"; - print '"; + + // Link to ICS for the event + print '"; + + // Link for ICS for conference or booth + print '"; @@ -400,13 +453,13 @@ if (!empty($withproject)) { print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage")); //print ''; print ''; @@ -440,8 +493,8 @@ if (!empty($withproject)) { print '
'; } -// Part to create -if ($action == 'create' && $confOrBooth !== null) { +// Part to create an attendee +if ($action == 'create' && $confOrBooth === null) { print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("ConferenceOrBoothAttendee")), '', 'object_'.$object->picto); @@ -449,9 +502,6 @@ if ($action == 'create' && $confOrBooth !== null) { print ''; print ''; - if ($confOrBooth->id > 0) { - print ''; - } if ($projectstatic->id > 0) { print ''; print ''; @@ -485,7 +535,7 @@ if ($action == 'create' && $confOrBooth !== null) { //dol_set_focus('input[name="ref"]'); } -// Part to edit record +// Part to edit attendee if (($id || $ref) && $action == 'edit' && $confOrBooth !== null) { print load_fiche_titre($langs->trans("ConferenceOrBoothAttendee"), '', 'object_'.$object->picto); @@ -528,7 +578,7 @@ if (($id || $ref) && $action == 'edit' && $confOrBooth !== null) { print ''; } -// Part to show record +// Part to show attendee if ($confOrBooth !== null && $object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { $object->fetch_optionals(); @@ -574,7 +624,7 @@ if ($confOrBooth !== null && $object->id > 0 && (empty($action) || ($action != ' // Object card // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
';
'.$langs->trans("Categories").''; + print $form->showCategories($projectstatic->id, Categorie::TYPE_PROJECT, 1); + print "
'.$langs->trans("Description").''; print nl2br($projectstatic->description); print '
'.$langs->trans("Categories").''; - print $form->showCategories($projectstatic->id, 'project', 1); - print "
'; $typeofdata = 'checkbox:'.($projectstatic->accept_conference_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); @@ -382,14 +415,34 @@ if (!empty($withproject)) { print $form->editfieldval($form->textwithpicto($langs->trans('PriceOfRegistration'), $langs->trans("PriceOfRegistrationHelp")), 'price_registration', $projectstatic->price_registration, $projectstatic, 0, 'amount', '', null, null, '', 0, '', 'projectid'); print "
'.$langs->trans("EventOrganizationICSLink").''; + print '
'; + print $form->editfieldkey($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', '', $projectstatic, $permissiontoadd, 'integer:3', '', 0, 0, 'projectid'); + print ''; + print $form->editfieldval($form->textwithpicto($langs->trans('MaxNbOfAttendees'), ''), 'max_attendees', $projectstatic->max_attendees, $projectstatic, $permissiontoadd, 'integer:3', '', null, null, '', 0, '', 'projectid'); + print "
'.$langs->trans("EventOrganizationICSLinkProject").''; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // Show message $message = 'global->MAIN_AGENDA_XCAL_EXPORTKEY ? urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) : '...'); + $message .= '&exportkey='.urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY', '...')); + $message .= "&project=".$projectid.'&module='.urlencode('project@eventorganization').'&file='.urlencode('calendar-'.$project->ref.'.ics').'&output=file">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').''; + print $message; + print "
'.$langs->trans("EventOrganizationICSLink").''; + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; + + // Show message + $message = 'id.'&module='.urlencode('@eventorganization').'&status='.ConferenceOrBooth::STATUS_CONFIRMED.'">'.$langs->trans('DownloadICSLink').img_picto('', 'download', 'class="paddingleft"').''; print $message; print "
'; - $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$projectstatic->id; - $encodedsecurekey = dol_hash(getDolGlobalString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.$projectstatic->id, 'md5'); + $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $projectstatic->id); + $encodedsecurekey = dol_hash(getDolGlobalString("EVENTORGANIZATION_SECUREKEY").'conferenceorbooth'.((int) $projectstatic->id), 'md5'); $linksuggest .= '&securekey='.urlencode($encodedsecurekey); //print ''; //print ajax_autoselect("linkregister"); print '