Skip to content

Commit

Permalink
Bugfix in dbSearchItemListOfType()
Browse files Browse the repository at this point in the history
  • Loading branch information
arnemorken committed Jan 15, 2025
1 parent 4eb4672 commit 12bbd39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions data/alasql/anyTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,11 @@ anyTable.prototype.dbSearchItemLists = async function(id,grouping,groupId)
anyTable.prototype.dbSearchItemListOfType = async function(id,linkType,grouping,groupId)
{
let link_tablename = this.findLinkTableName(linkType);
if (this.tableExists(link_tablename)) {
if (this.tableExists(link_tablename) && (id || id === 0)) {
let factory = new anyTableFactory(this.connection);
let link_classname = this.linkTypes[linkType].className;
let link_classname = this.linkTypes && this.linkTypes[linkType]
? this.linkTypes[linkType].className
: null;
let table = await factory.createClass(link_classname,{type:linkType, header:true, path:this.path});
//console.log("created class "+link_classname);
if (table && (table.type != this.type || this.hasParentId())) {
Expand Down
2 changes: 1 addition & 1 deletion data/mysql/anyTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ protected function dbSearchItemLists($id=null,$grouping=false,$groupId=null)
protected function dbSearchItemListOfType($id,$linkType,$grouping=false,$groupId=null)
{
$link_tablename = $this->findLinkTableName($linkType);
if ($this->tableExists($link_tablename)) {
if ($this->tableExists($link_tablename) && ($id || $id === 0)) {
$table = anyTableFactory::createClass($linkType,$this);
//elog("created class ".$linkType);
if ($table && ($table->mType != $this->mType || $this->hasParentId())) {
Expand Down

0 comments on commit 12bbd39

Please sign in to comment.