Index: branches/5.1.x/core/kernel/db/dblist.php
===================================================================
diff -u -r13750 -r13882
--- branches/5.1.x/core/kernel/db/dblist.php (.../dblist.php) (revision 13750)
+++ branches/5.1.x/core/kernel/db/dblist.php (.../dblist.php) (revision 13882)
@@ -1,6 +1,6 @@
Application->getUnitOption($this->Prefix, 'ForeignKey');
if (is_array($foreign_key_field)) $foreign_key_field = getArrayValue($foreign_key_field, $parent_prefix);
- if (!$parent_table_key || !$foreign_key_field) return ;
+ if (!$parent_table_key || !$foreign_key_field) {
+ return ;
+ }
$parent_object =& $this->Application->recallObject($parent_prefix.'.'.$special);
- $parent_id = $parent_object->GetDBField($parent_table_key);
+ /* @var $parent_object kDBItem */
- if (!$parent_id) return ;
+ if (!$parent_object->isLoaded()) {
+ $this->addFilter('parent_filter', 'FALSE');
+ trigger_error('Parent ID not found (prefix: "' . rtrim($parent_prefix.'.'.$special, '.') . '"; sub-prefix: "' . $this->getPrefixSpecial() . '")', E_USER_NOTICE);
+ return ;
+ }
- $this->addFilter('parent_filter', '`'.$this->TableName.'`.`'.$foreign_key_field.'` = '.$parent_id); // only for list in this case
+ // only for list in this case
+ $parent_id = $parent_object->GetDBField($parent_table_key);
+ $this->addFilter('parent_filter', '`' . $this->TableName . '`.`' . $foreign_key_field . '` = ' . $this->Conn->qstr($parent_id));
}
}