diff --git a/CHANGELOG.md b/CHANGELOG.md index f620fccd..65ce3f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ * gh-139 Sort selection lists * Filter ARS logs by user_id (required for data export on our site) +**Bug fixes** + +* Creating or editing a category would apply an unexpected filter in the Browse view + # 4.0.0 **New** diff --git a/component/backend/Controller/Category.php b/component/backend/Controller/Category.php index 04efa5cc..804d3071 100644 --- a/component/backend/Controller/Category.php +++ b/component/backend/Controller/Category.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die; +use Akeeba\ReleaseSystem\Admin\View\Categories\Html; use FOF30\Controller\DataController; class Category extends DataController @@ -46,9 +47,14 @@ protected function onBeforeAdd() 'language' => '*', ]; + /** @var Html $view */ + $dataModel = $this->getModel(); + foreach ($this->defaultsForAdd as $k => $v) { - if ($stateValue = $this->getModel()->getState($k, $v)) + $stateValue = $dataModel->getState($k); + + if (!is_null($stateValue)) { $this->defaultsForAdd[$k] = $stateValue; } diff --git a/component/backend/View/Categories/Html.php b/component/backend/View/Categories/Html.php index 3a9d98eb..bcca9416 100644 --- a/component/backend/View/Categories/Html.php +++ b/component/backend/View/Categories/Html.php @@ -9,6 +9,7 @@ defined('_JEXEC') or die; +use Akeeba\ReleaseSystem\Admin\Model\Categories; use FOF30\View\DataView\Html as BaseView; use JText; @@ -29,21 +30,16 @@ protected function onBeforeBrowse() { parent::onBeforeBrowse(); - $hash = 'ars'.strtolower($this->getName()); - - // ...ordering - $platform = $this->container->platform; - $input = $this->input; - $this->order = $platform->getUserStateFromRequest($hash . 'filter_order', 'filter_order', $input, 'id'); - $this->order_Dir = $platform->getUserStateFromRequest($hash . 'filter_order_Dir', 'filter_order_Dir', $input, 'DESC'); + /** @var Categories $model */ + $model = $this->getModel(); // ...filter state - $this->filters['title'] = $platform->getUserStateFromRequest($hash . 'filter_title', 'title', $input); - $this->filters['published'] = $platform->getUserStateFromRequest($hash . 'filter_published', 'published', $input); - $this->filters['type'] = $platform->getUserStateFromRequest($hash . 'filter_type', 'type', $input); - $this->filters['vgroup'] = $platform->getUserStateFromRequest($hash . 'filter_vgroup', 'vgroup', $input); - $this->filters['access'] = $platform->getUserStateFromRequest($hash . 'filter_access', 'access', $input); - $this->filters['language'] = $platform->getUserStateFromRequest($hash . 'filter_language', 'language', $input); + $this->filters['title'] = $model->getState('title'); + $this->filters['published'] = $model->getState('published'); + $this->filters['type'] = $model->getState('type'); + $this->filters['vgroup'] = $model->getState('vgroup'); + $this->filters['access'] = $model->getState('access'); + $this->filters['language'] = $model->getState('language'); // Construct the array of sorting fields $this->sortFields = array( diff --git a/component/backend/View/Categories/tmpl/default.php b/component/backend/View/Categories/tmpl/default.php index a3ea93c0..b0bfad82 100644 --- a/component/backend/View/Categories/tmpl/default.php +++ b/component/backend/View/Categories/tmpl/default.php @@ -13,7 +13,7 @@ defined('_JEXEC') or die; -$js = FEFHtml::jsOrderingBackend($this->order); +$js = FEFHtml::jsOrderingBackend($this->lists->order); $this->getContainer()->template->addJSInline($js); ?> @@ -49,7 +49,7 @@ - getPagination(), $this->sortFields, $this->order, $this->order_Dir)?> + getPagination(), $this->sortFields, $this->lists->order, $this->lists->order_Dir)?> @@ -63,22 +63,22 @@ - order_Dir, $this->order, 'browse'); ?> + lists->order_Dir, $this->lists->order, 'browse'); ?> - order_Dir, $this->order, 'browse'); ?> + lists->order_Dir, $this->lists->order, 'browse'); ?> - order_Dir, $this->order, 'browse'); ?> + lists->order_Dir, $this->lists->order, 'browse'); ?> - order_Dir, $this->order, 'browse'); ?> + lists->order_Dir, $this->lists->order, 'browse'); ?> - order_Dir, $this->order, 'browse'); ?> + lists->order_Dir, $this->lists->order, 'browse'); ?> - order_Dir, $this->order, 'browse'); ?> + lists->order_Dir, $this->lists->order, 'browse'); ?> @@ -158,8 +158,8 @@ - - + + \ No newline at end of file