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)

This commit is contained in:
Klaus Leithoff 2011-09-13 15:41:31 +00:00
parent 117179ad0f
commit 74b41ec99a
2 changed files with 19 additions and 4 deletions

View File

@ -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)

View File

@ -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')))
{