Skip to content
Permalink
Browse files

MDL-48421 navigation: accounting for potential regression

  • Loading branch information...
Tim Price
Tim Price committed Dec 16, 2014
1 parent 85e59ac commit 6eb3da841dfa77b2b53c145749cdba23ced2fa6c
Showing with 9 additions and 7 deletions.
  1. +9 −7 lib/navigationlib.php
@@ -1632,13 +1632,15 @@ protected function load_all_categories($categoryid = self::LOAD_ROOT_CATEGORIES,
// have been loaded
$addedcategories = $this->addedcategories;
unset($addedcategories[$categoryid]);
list($sql, $params) = $DB->get_in_or_equal(array_keys($addedcategories), SQL_PARAMS_NAMED, 'parent', false);
if ($showbasecategories) {
// We need to include categories with parent = 0 as well
$sqlwhere .= " AND (cc.parent = :categoryid OR cc.parent = 0) AND cc.parent {$sql}";
} else {
// All we need is categories that match the parent
$sqlwhere .= " AND cc.parent = :categoryid AND cc.parent {$sql}";
if (count($addedcategories) > 0) {
list($sql, $params) = $DB->get_in_or_equal(array_keys($addedcategories), SQL_PARAMS_NAMED, 'parent', false);
if ($showbasecategories) {
// We need to include categories with parent = 0 as well
$sqlwhere .= " AND (cc.parent = :categoryid OR cc.parent = 0) AND cc.parent {$sql}";
} else {
// All we need is categories that match the parent
$sqlwhere .= " AND cc.parent = :categoryid AND cc.parent {$sql}";
}
}
$params['categoryid'] = $categoryid;
} else {

0 comments on commit 6eb3da8

Please sign in to comment.
You can’t perform that action at this time.