From 199fb3be0f99808fc640da81ee12db2d381f734a Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Tue, 15 Oct 2019 14:29:27 +0200 Subject: [PATCH] Fix non-numeric value encountered on ical export --- htdocs/comm/action/class/actioncomm.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 5803c0afc20..1ce4dce01a0 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1543,6 +1543,19 @@ class ActionComm extends CommonObject $event['uid']='dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; $event['type']=$type; $datestart=$this->db->jdate($obj->datep)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); + + // fix for -> Warning: A non-numeric value encountered + if(is_numeric($this->db->jdate($obj->datep2))) + { + $dateend = $this->db->jdate($obj->datep2) + - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + } + else + { + // use start date as fall-back to avoid import erros on empty end date + $datestart = $dateend; + } + $dateend=$this->db->jdate($obj->datep2)-(empty($conf->global->AGENDA_EXPORT_FIX_TZ)?0:($conf->global->AGENDA_EXPORT_FIX_TZ*3600)); $duration=($datestart && $dateend)?($dateend - $datestart):0; $event['summary']=$obj->label.($obj->socname?" (".$obj->socname.")":"");