diff --git a/application/libraries/FilterCmptLib.php b/application/libraries/FilterCmptLib.php index 272899de6..b1de89245 100644 --- a/application/libraries/FilterCmptLib.php +++ b/application/libraries/FilterCmptLib.php @@ -1,7 +1,7 @@ getSession(); // If session is NOT empty -> a filter was already loaded - if ($session != null) + if (!isError($session) && $session != null) { // Retrieve the filterId stored in the session $sessionFilterId = $this->_getSessionElement(FilterCmptLib::FILTER_ID); @@ -219,9 +219,7 @@ class FilterCmptLib } } } - - // If the session is empty -> first time that this filter is loaded - if ($session == null) + else { // Load filter definition data from DB $definition = $this->_loadDefinition( @@ -602,7 +600,7 @@ class FilterCmptLib { $session = getSessionElement(self::SESSION_NAME, $this->_filterUniqueId); - if (isset($session[$name])) + if (!isError($session) && isset($session[$name])) { return $session[$name]; } @@ -623,7 +621,7 @@ class FilterCmptLib if (!$this->_ci->permissionlib->hasAtLeastOne($this->_requiredPermissions, self::PERMISSION_FILTER_METHOD, self::PERMISSION_TYPE)) { - $this->_setSession(error('The required permission is not help by the logged user')); + $this->_setSession(error('The required permission is not held by the logged user')); return false; } @@ -904,7 +902,7 @@ class FilterCmptLib $filterCmptsSession = getSession(self::SESSION_NAME); // If something is present in session - if ($filterCmptsSession != null) + if (!isError($filterCmptsSession) && $filterCmptsSession != null) { // Loops in the session for all the filter components foreach ($filterCmptsSession as $filterCmpt => $filterCmptData) @@ -951,9 +949,11 @@ class FilterCmptLib { $session = getSessionElement(self::SESSION_NAME, $this->_filterUniqueId); - $session[$name] = $value; - - setSessionElement(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value + if (!isError($session) && $session != null) + { + $session[$name] = $value; + setSessionElement(self::SESSION_NAME, $this->_filterUniqueId, $session); // stores the single value + } } /** @@ -965,7 +965,7 @@ class FilterCmptLib $filterCmptsSession = getSession(self::SESSION_NAME); // If something is present in session - if ($filterCmptsSession != null) + if (!isError($filterCmptsSession) && $filterCmptsSession != null) { // Loops in the session for all the filter components foreach ($filterCmptsSession as $filterCmpt => $filterCmptData) @@ -1174,3 +1174,4 @@ class FilterCmptLib return $filterName; } } + diff --git a/public/js/plugins/Api.js b/public/js/plugins/Api.js index 0b8e2fd17..895ecf70d 100644 --- a/public/js/plugins/Api.js +++ b/public/js/plugins/Api.js @@ -328,6 +328,7 @@ export default { url: error.request.responseURL }]; } else { + if (error.response.data.errors == undefined) return []; return error.response.data.errors; } } else if (error.request) { @@ -346,6 +347,9 @@ export default { function popHandleableErrors(errorHandling, errors) { const result = {}; const copy = []; + + if (errors == undefined) return {}; + while (errors.length) copy.push(errors.pop()); for (var error of copy) { @@ -551,4 +555,4 @@ export default { app.provide('$api', app.config.globalProperties.$api); } -}; \ No newline at end of file +};