ENH: play nicer with subsites module

This commit is contained in:
Igor Nadj 2015-09-15 17:28:28 +12:00
parent 2b98e7b7d9
commit 4f1d9f15f8
2 changed files with 30 additions and 4 deletions

View File

@ -116,7 +116,7 @@ class PagesDueForReviewReport extends SS_Report {
* @param array $params
* @param string $sort
* @param array $limit
* @return DataList
* @return SS_List
*/
public function sourceRecords($params, $sort, $limit) {
Versioned::reading_stage('Stage');
@ -159,6 +159,18 @@ class PagesDueForReviewReport extends SS_Report {
$records = $records->filter('OwnerNames:PartialMatch', $ownerNames);
}
return $records->sort('NextReviewDate', 'DESC');
// Make sure we get results from all subsites, because only the main site has the Reports section
$subsiteFilterBefore = null;
if(class_exists('Subsite')){
$subsiteFilterBefore = Subsite::disable_subsite_filter(true);
}
$r = new ArrayList($records->sort('NextReviewDate', 'DESC')->toArray());
if(class_exists('Subsite')){
Subsite::disable_subsite_filter($subsiteFilterBefore);
}
return $r;
}
}

View File

@ -90,7 +90,7 @@ class PagesWithoutReviewScheduleReport extends SS_Report {
* @param array $params
* @param string $sort
* @param array $limit
* @return DataList
* @return SS_List
*/
public function sourceRecords($params, $sort, $limit) {
Versioned::reading_stage('Stage');
@ -110,6 +110,20 @@ class PagesWithoutReviewScheduleReport extends SS_Report {
$records->sort('ParentID');
// Make sure we get results from all subsites, because only the main site has the Reports section
$subsiteFilterBefore = null;
if(class_exists('Subsite')){
$subsiteFilterBefore = Subsite::disable_subsite_filter(true);
}
$records = $records->toArray();
if(class_exists('Subsite')){
Subsite::disable_subsite_filter($subsiteFilterBefore);
}
// Trim out calculated values
$list = new ArrayList();
foreach($records as $record) {