N°2198 Fix "invalid filter" error when refreshing "Requests assigned to me"

This commit is contained in:
Pierre Goiffon
2019-05-07 18:39:21 +02:00
parent 12a2035791
commit a58529f46c
2 changed files with 15 additions and 10 deletions

View File

@@ -1172,16 +1172,21 @@ EOF
}
if (($bAutoReload) && ($this->m_sStyle != 'search')) // Search form do NOT auto-reload
{
$sFilter = addslashes(str_replace('"', "'", $this->m_oFilter->serialize())); // Used either for asynchronous or auto_reload
$sExtraParams = addslashes(str_replace('"', "'", json_encode($aExtraParams))); // JSON encode, change the style of the quotes and escape them
// Used either for asynchronous or auto_reload
$sFilter = addslashes(str_replace("'", "\'", $this->m_oFilter->serialize()));
$sExtraParams = addslashes(str_replace("'", "\'", json_encode($aExtraParams)));
$oPage->add_script('if (typeof window.oAutoReloadBlock == "undefined") {
window.oAutoReloadBlock = {};
}
if (typeof window.oAutoReloadBlock[\''.$sId.'\'] != "undefined") {
clearInterval(window.oAutoReloadBlock[\''.$sId.'\']);
}
window.oAutoReloadBlock[\''.$sId.'\'] = setInterval("ReloadBlock(\''.$sId.'\', \''.$this->m_sStyle.'\', \"'.$sFilter.'\", \"'.$sExtraParams.'\")", '.$iReloadInterval.');');
$oPage->add_script(
<<<JS
if (typeof window.oAutoReloadBlock == "undefined") {
window.oAutoReloadBlock = {};
}
if (typeof window.oAutoReloadBlock['$sId'] != "undefined") {
clearInterval(window.oAutoReloadBlock['$sId']);
}
window.oAutoReloadBlock['$sId'] = setInterval("ReloadBlock('$sId', '{$this->m_sStyle}', '$sFilter', '$sExtraParams')", '$iReloadInterval');
JS
);
}
return $sHtml;

View File

@@ -199,7 +199,7 @@ function ReloadBlock(divId, sStyle, sSerializedFilter, sExtraParams) {
$('#'+divId).block();
$.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php?style='+sStyle,
{operation: 'ajax', filter: sSerializedFilter, extra_params: sExtraParams},
{operation: 'ajax', filter: sSerializedFilter, encoding: 'serialize', extra_params: sExtraParams},
function (data) {
$('#'+divId).empty();
$('#'+divId).append(data);