Skip to content

Commit

Permalink
pkp/pkp-lib#2163 Fix PHP Notices for missing article columns
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr committed Aug 10, 2017
1 parent b2f8751 commit 2e0a1ab
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions classes/services/queryBuilders/SubmissionListQueryBuilder.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,38 @@ public function filterBySections($sectionIds) {
* @return object Query object
*/
public function appGet($q) {
$primaryLocale = \AppLocale::getPrimaryLocale();
$locale = \AppLocale::getLocale();

$this->columns[] = Capsule::raw('COALESCE(stl.setting_value, stpl.setting_value) AS section_title');
$this->columns[] = Capsule::raw('COALESCE(sal.setting_value, sapl.setting_value) AS section_abbrev');

$q->groupBy(Capsule::raw('COALESCE(stl.setting_value, stpl.setting_value)'));
$q->groupBy(Capsule::raw('COALESCE(sal.setting_value, sapl.setting_value)'));

$q->leftJoin('section_settings as stpl', function($join) use($primaryLocale) {
$join->on('s.section_id', '=', Capsule::raw("'stpl.section_id'"));
$join->on('stpl.setting_name', '=', Capsule::raw("'section_title'"));
$join->on('stpl.locale', '=', Capsule::raw("'{$primaryLocale}'"));
});

$q->leftJoin('section_settings as stl', function($join) use($locale) {
$join->on('s.section_id', '=', Capsule::raw("'stl.section_id'"));
$join->on('stl.setting_name', '=', Capsule::raw("'section_title'"));
$join->on('stl.locale', '=', Capsule::raw("'{$locale}'"));
});

$q->leftJoin('section_settings as sapl', function($join) use($primaryLocale) {
$join->on('s.section_id', '=', Capsule::raw("'sapl.section_id'"));
$join->on('sapl.setting_name', '=', Capsule::raw("'section_abbrev'"));
$join->on('sapl.locale', '=', Capsule::raw("'{$primaryLocale}'"));
});

$q->leftJoin('section_settings as sal', function($join) use($locale) {
$join->on('s.section_id', '=', Capsule::raw("'sal.section_id'"));
$join->on('sal.setting_name', '=', Capsule::raw("'section_abbrev'"));
$join->on('sal.locale', '=', Capsule::raw("'{$locale}'"));
});

if (!empty($this->sectionIds)) {
$q->whereIn('s.section_id', $this->sectionIds);
Expand Down

0 comments on commit 2e0a1ab

Please sign in to comment.