From 74b41ec99ad537090e788935ab7a56357576ebb7 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Tue, 13 Sep 2011 15:41:31 +0000 Subject: [PATCH] fix bug regarding merge_print with export_limit set in calendar, as calendar may pass a search query instead of a list of ids (this is the reason, why the test within bo_merge on export_limit is not working as expected) --- calendar/inc/class.calendar_merge.inc.php | 7 ++++++- etemplate/inc/class.bo_merge.inc.php | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/calendar/inc/class.calendar_merge.inc.php b/calendar/inc/class.calendar_merge.inc.php index c5f02fd163..a1eb62ff07 100644 --- a/calendar/inc/class.calendar_merge.inc.php +++ b/calendar/inc/class.calendar_merge.inc.php @@ -135,7 +135,12 @@ class calendar_merge extends bo_merge $events = array($id); $this->ids = $events; } - + // as this function allows to pass query- parameters, we need to check the result of the query against export_limit restrictions + if (bo_merge::hasExportLimit($this->export_limit) && !bo_merge::is_export_limit_excepted() && count($events) > (int)$this->export_limit) + { + $err = lang('No rights to export more then %1 entries!',(int)$this->export_limit); + throw new egw_exception_wrong_userinput($err); + } $replacements = array(); $n = 0; foreach($events as $event) diff --git a/etemplate/inc/class.bo_merge.inc.php b/etemplate/inc/class.bo_merge.inc.php index d0a35a65cf..1ae3059dad 100644 --- a/etemplate/inc/class.bo_merge.inc.php +++ b/etemplate/inc/class.bo_merge.inc.php @@ -601,12 +601,22 @@ abstract class bo_merge if ($contentrepeat) $content = $contentrepeat; //content to repeat if ($lableprint) $content = $Labelrepeat; - // generate replacements - if(!($replacements = $this->get_replacements($id,$content))) + // generate replacements; if exeption is thrown, catch it set error message and return false + try { - $err = lang('Entry not found!'); + if(!($replacements = $this->get_replacements($id,$content))) + { + $err = lang('Entry not found!'); + return false; + } + } + catch (egw_exception_wrong_userinput $e) + { + // if this returns with an exeption, something failed big time + $err = $e->getMessage(); return false; } + // some general replacements: current user, date and time if (strpos($content,'$$user/') !== null && ($user = $GLOBALS['egw']->accounts->id2name($GLOBALS['egw_info']['user']['account_id'],'person_id'))) {