diff --git a/core/components/com_courses/admin/controllers/assets.php b/core/components/com_courses/admin/controllers/assets.php index b37ea9f5a85..6466943c2e4 100644 --- a/core/components/com_courses/admin/controllers/assets.php +++ b/core/components/com_courses/admin/controllers/assets.php @@ -86,8 +86,17 @@ public function displayTask() $tbl = new Tables\Asset($this->database); // print_r($this->view->filters); + // A scope id of 0 here means "every scope", but the table now reads a + // zero as "match nothing", so drop the key instead of passing it. + $where = $this->view->filters; + + if (empty($where['asset_scope_id'])) + { + unset($where['asset_scope_id']); + } + $rows = $tbl->find(array( - 'w' => $this->view->filters + 'w' => $where )); // print_r($rows); diff --git a/core/components/com_courses/models/section.php b/core/components/com_courses/models/section.php index 74dd518a2fd..2b4d6595f36 100644 --- a/core/components/com_courses/models/section.php +++ b/core/components/com_courses/models/section.php @@ -310,7 +310,7 @@ public function access($action='view', $item='section') if (!isset($this->_permissions)) { $this->_permissions = Permissions::getInstance(); - $this->_permissions->set('offering_id', $this->get('id')); + $this->_permissions->set('offering_id', $this->get('offering_id')); $this->_permissions->set('section_id', $this->get('id')); } return $this->_permissions->access($action, $item); diff --git a/core/components/com_courses/tables/asset.group.php b/core/components/com_courses/tables/asset.group.php index a85c71c2144..a7f79a8a3f5 100644 --- a/core/components/com_courses/tables/asset.group.php +++ b/core/components/com_courses/tables/asset.group.php @@ -101,7 +101,8 @@ private function _buildQuery($filters=array()) $where = array(); - if (isset($filters['unit_id']) && $filters['unit_id']) + // A unit_id of 0 must match no groups rather than dropping the clause + if (isset($filters['unit_id'])) { $where[] = "cag.unit_id=" . $this->_db->quote($filters['unit_id']); } diff --git a/core/components/com_courses/tables/asset.php b/core/components/com_courses/tables/asset.php index fde041a88ce..cd247003a11 100644 --- a/core/components/com_courses/tables/asset.php +++ b/core/components/com_courses/tables/asset.php @@ -127,7 +127,8 @@ private function _buildQuery($filters=array()) { $where[] = "ca.id=" . $this->_db->quote((int) $filters['asset_id']); } - if (!empty($filters['asset_scope_id'])) + // A scope id of 0 must match no assets rather than dropping the clause + if (isset($filters['asset_scope_id'])) { $where[] = "cag.id=" . $this->_db->quote((int) $filters['asset_scope_id']); } diff --git a/core/components/com_courses/tables/unit.php b/core/components/com_courses/tables/unit.php index 8e252801699..17022b0edbc 100644 --- a/core/components/com_courses/tables/unit.php +++ b/core/components/com_courses/tables/unit.php @@ -128,7 +128,9 @@ private function _buildQuery($filters=array()) $where = array(); - if (isset($filters['offering_id']) && $filters['offering_id']) + // Note the deliberate lack of a truthiness test: an offering_id of 0 + // has to match no units, not every unit in the table. + if (isset($filters['offering_id'])) { $where[] = "cu.offering_id=" . $this->_db->quote($filters['offering_id']); } diff --git a/core/plugins/courses/outline/views/outline/tmpl/edittool.php b/core/plugins/courses/outline/views/outline/tmpl/edittool.php index 9f39b14e7f0..6ab9f3c72f1 100644 --- a/core/plugins/courses/outline/views/outline/tmpl/edittool.php +++ b/core/plugins/courses/outline/views/outline/tmpl/edittool.php @@ -86,7 +86,7 @@
- files($asset) : array(); ?> + files($asset) : array(); ?>