#779 It is possible to record a wrong OQL in the phrase book, but then it cannot be edited anymore!

SVN:trunk[2874]
This commit is contained in:
Romain Quetiez
2013-10-03 15:30:29 +00:00
parent fe41d09acb
commit 894b59eee1
2 changed files with 23 additions and 7 deletions

View File

@@ -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').':<br/><textarea cols="80" rows="3" READONLY>'.$sUrl.'</textarea>');
catch (OQLException $e)
{
$sMessage = '<div class="message message_error" style="padding-left: 30px;"><div style="padding: 10px;">'.Dict::Format('UI:RunQuery:Error', $e->getHtmlDesc()).'</div></div>';
}
$oPage->p(Dict::S('UI:Query:UrlForExcel').':<br/><textarea cols="80" rows="3" READONLY>'.$sUrl.'</textarea>');
if (!is_null($sMessage))
{
$oPage->p($sMessage);
}
}
return $aFieldsMap;
}

View File

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