summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-06-21 10:01:03 +0100
committerLester Caine <lester@lsces.co.uk>2026-06-21 10:01:03 +0100
commit8829bafaa683836e0ae16ead818b50ded9ec94f9 (patch)
tree5561f1826b963fd96f036dda5b17e0ad5a3ad42d
parentc3608912295032da3733e41d04a4dc5ee49b3cc8 (diff)
downloadstock-8829bafaa683836e0ae16ead818b50ded9ec94f9.tar.gz
stock-8829bafaa683836e0ae16ead818b50ded9ec94f9.tar.bz2
stock-8829bafaa683836e0ae16ead818b50ded9ec94f9.zip
Append KLID in brackets to component title where available
Add klid correlated subquery to both load() and getList(), then append it in getTitleFromHash(). Enrich title in the getList() foreach so list pages see the updated value without calling getTitleFromHash() themselves. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-rwxr-xr-xincludes/classes/StockComponent.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/includes/classes/StockComponent.php b/includes/classes/StockComponent.php
index 01093c9..a214c2f 100755
--- a/includes/classes/StockComponent.php
+++ b/includes/classes/StockComponent.php
@@ -74,9 +74,11 @@ class StockComponent extends StockBase {
$this->getServicesSql( 'content_load_sql_function', $selectSql, $joinSql, $whereSql, $bindVars );
+ $X = BIT_DB_PREFIX;
$sql = "SELECT lc.* $selectSql
, uue.`login` AS `modifier_user`, uue.`real_name` AS `modifier_real_name`
, uuc.`login` AS `creator_user`, uuc.`real_name` AS `creator_real_name`
+ , (SELECT FIRST 1 x.`xkey` FROM `{$X}liberty_xref` x WHERE x.`content_id` = lc.`content_id` AND x.`item` = 'KLID') AS `klid`
FROM `".BIT_DB_PREFIX."liberty_content` lc
LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON (uue.`user_id` = lc.`modifier_user_id`)
LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON (uuc.`user_id` = lc.`user_id`) $joinSql
@@ -214,6 +216,9 @@ class StockComponent extends StockBase {
$this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars );
+ $X = BIT_DB_PREFIX;
+ $selectSql .= ", (SELECT FIRST 1 x.`xkey` FROM `{$X}liberty_xref` x WHERE x.`content_id` = lc.`content_id` AND x.`item` = 'KLID') AS `klid`";
+
$orderby = !empty( $pListHash['sort_mode'] )
? " ORDER BY ".$this->mDb->convertSortmode( $pListHash['sort_mode'] )
: '';
@@ -239,6 +244,7 @@ class StockComponent extends StockBase {
if( $rows = $this->mDb->query( $query, $bindVars, $pListHash['max_records'], $pListHash['offset'] ) ) {
foreach( $rows as $row ) {
$row['display_url'] = static::getDisplayUrlFromHash( $row );
+ $row['title'] = static::getTitleFromHash( $row );
$ret[$row['hash_key']] = $row;
}
}
@@ -313,6 +319,9 @@ class StockComponent extends StockBase {
$ret .= ' '.$pHash['content_id'];
}
}
+ if( !empty( $pHash['klid'] ) ) {
+ $ret .= ' ('.$pHash['klid'].')';
+ }
return $ret;
}
return 'empty_component';