diff --git a/application/query.class.inc.php b/application/query.class.inc.php index 5bd4ddbb4f..bc02bd817d 100644 --- a/application/query.class.inc.php +++ b/application/query.class.inc.php @@ -94,13 +94,26 @@ class QueryOQL extends Query { $sUrl = utils::GetAbsoluteUrlAppRoot().'webservices/export.php?format=spreadsheet&login_mode=basic&query='.$this->GetKey(); $sOql = $this->Get('oql'); - $oSearch = DBObjectSearch::FromOQL($sOql); - $aParameters = $oSearch->GetQueryParams(); - foreach($aParameters as $sParam => $val) + $sMessage = null; + try { - $sUrl .= '&arg_'.$sParam.'=["'.$sParam.'"]'; + $oSearch = DBObjectSearch::FromOQL($sOql); + $aParameters = $oSearch->GetQueryParams(); + foreach($aParameters as $sParam => $val) + { + $sUrl .= '&arg_'.$sParam.'=["'.$sParam.'"]'; + } } - $oPage->p(Dict::S('UI:Query:UrlForExcel').':
'); + catch (OQLException $e) + { + $sMessage = '
'.Dict::Format('UI:RunQuery:Error', $e->getHtmlDesc()).'
'; + } + + $oPage->p(Dict::S('UI:Query:UrlForExcel').':
'); + if (!is_null($sMessage)) + { + $oPage->p($sMessage); + } } return $aFieldsMap; } diff --git a/core/oql/oqlexception.class.inc.php b/core/oql/oqlexception.class.inc.php index d5e76db41a..f63250cd00 100644 --- a/core/oql/oqlexception.class.inc.php +++ b/core/oql/oqlexception.class.inc.php @@ -65,8 +65,11 @@ class OQLException extends CoreException if (!is_null($this->m_aExpecting) && (count($this->m_aExpecting) > 0)) { - $sExpectations = '{'.implode(', ', $this->m_aExpecting).'}'; - $sRet .= ", expecting ".htmlentities($sExpectations, ENT_QUOTES, 'UTF-8'); + if (count($this->m_aExpecting) < 30) + { + $sExpectations = '{'.implode(', ', $this->m_aExpecting).'}'; + $sRet .= ", expecting ".htmlentities($sExpectations, ENT_QUOTES, 'UTF-8'); + } $sSuggest = self::FindClosestString($this->m_sUnexpected, $this->m_aExpecting); if (strlen($sSuggest) > 0) {