Skip to content
Permalink
Browse files

Fix issues with CATALOGUE_ENTRY_BACKREFS symbol, returning wrong results

  • Loading branch information...
chrisgraham committed Jul 22, 2019
1 parent bf0ed09 commit 82dbbc37e86ab9493d4d2df7df81928cb5c1e0c6
Showing with 11 additions and 6 deletions.
  1. +11 −6 sources/hooks/systems/symbols/CATALOGUE_ENTRY_BACKREFS.php
@@ -45,7 +45,7 @@ public function run($param)
}
$done = 0;
$table = 'catalogue_fields f JOIN ' . get_table_prefix() . 'catalogue_efv_short s ON (f.id=s.cf_id AND ' . db_string_equal_to('cf_type', 'reference') . ' OR cf_type LIKE \'' . db_encode_like('ck\_%') . '\')';
$table = 'catalogue_fields f JOIN ' . get_table_prefix() . 'catalogue_efv_short s ON (f.id=s.cf_id AND (' . db_string_equal_to('cf_type', 'reference') . ' OR cf_type LIKE \'' . db_encode_like('ck\_%') . '\'))';
if ($field_id !== null) {
$table .= ' AND f.id=' . strval($field_id);
}
@@ -61,15 +61,20 @@ public function run($param)
}
}
$results = $GLOBALS['SITE_DB']->query_select($table, $select, array('cv_value' => $param[0]), $order_by);
$_results = array();
foreach ($results as $result) {
if ($value != '') {
$value .= ',';
}
if ($resolve != '') {
$value .= $result['content_id'];
$_results[] = $result['content_id'];
} else {
$value .= strval($result['ce_id']);
$_results[] = strval($result['ce_id']);
}
}
$_results = array_unique($_results);
foreach ($_results as $_result) {
if ($value != '') {
$value .= ',';
}
$value .= $_result;
$done++;
if (($limit !== null) && ($done == $limit)) {

0 comments on commit 82dbbc3

Please sign in to comment.
You can’t perform that action at this time.