From aa84b76b6a09e78f859ee1fd8b59ab0107d4f3b2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 8 Oct 2020 11:43:12 +0200 Subject: [PATCH] FIX Multicompany compatibility (missing entity value) --- htdocs/admin/agenda_xcal.php | 6 +++--- htdocs/public/agenda/agendaexport.php | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 7df74ba6a9d..bc9eedb9177 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -160,13 +160,13 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai // Show message $message = ''; -$urlvcal = ''.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; +$urlvcal = ''.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.($conf->entity > 1 ? "&entity=".$conf->entity : "").'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'vcal', $urlvcal); $message .= '
'; -$urlical = ''.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; +$urlical = ''.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.($conf->entity > 1 ? "&entity=".$conf->entity : "").'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', $urlical); $message .= '
'; -$urlrss = ''.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; +$urlrss = ''.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.($conf->entity > 1 ? "&entity=".$conf->entity : "").'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').''; $message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'rss', $urlrss); $message .= '
'; $message .= '
'; diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index a7eef6c2ede..8b671e8930e 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -58,6 +58,11 @@ function llxFooterVierge() print ''; } +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_numeric($entity)) define("DOLENTITY", $entity); + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';