Skip to content

Commit

Permalink
catch null custom column for multi-database setup - see #89
Browse files Browse the repository at this point in the history
  • Loading branch information
mikespub committed Aug 23, 2024
1 parent f1c5418 commit ebac67c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ x.x.x - TODO
* Upgrade magnific-popup package to 1.2.0
* Upgrade swagger-ui-dist package and link to 5.17.14
* Update language files via Gitlocalize - see PRs from @horus68 and his intrepid band of translators ;-)
* Fix transparent search suggestions box - see pull request #96 from @dunxd for issue #95 by @marioscube
* Catch potential null custom columns for multi-database setup - see issue #89 by @Chirishman

2.7.1 - 20240526 Use external storage + settings for epubjs reader
* Changes in config_default.php file:
Expand Down
10 changes: 6 additions & 4 deletions lib/Pages/PageIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ public function getFilterCountEntries()
}
}
// @todo apply filter?
$customColumnList = CustomColumnType::checkCustomColumnList(Config::get('calibre_custom_column'));
// for multi-database setup, not all databases may have all custom columns - see issue #89
$customColumnList = CustomColumnType::checkCustomColumnList(Config::get('calibre_custom_column'), $this->getDatabaseId());
foreach ($customColumnList as $lookup) {
$customColumn = CustomColumnType::createByLookup($lookup, $this->getDatabaseId());
$customColumn->setHandler($this->handler);
if (!is_null($customColumn) && $customColumn->isSearchable()) {
$customColumn->setHandler($this->handler);
array_push($this->entryArray, $customColumn->getCount());
}
}
Expand Down Expand Up @@ -193,11 +194,12 @@ public function getTopCountEntries()
array_push($this->entryArray, $languages);
}
}
$customColumnList = CustomColumnType::checkCustomColumnList(Config::get('calibre_custom_column'));
// for multi-database setup, not all databases may have all custom columns - see issue #89
$customColumnList = CustomColumnType::checkCustomColumnList(Config::get('calibre_custom_column'), $this->getDatabaseId());
foreach ($customColumnList as $lookup) {
$customColumn = CustomColumnType::createByLookup($lookup, $this->getDatabaseId());
$customColumn->setHandler($this->handler);
if (!is_null($customColumn) && $customColumn->isSearchable()) {
$customColumn->setHandler($this->handler);
array_push($this->entryArray, $customColumn->getCount());
}
}
Expand Down

0 comments on commit ebac67c

Please sign in to comment.