diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-15 11:53:20 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-15 11:53:20 +0100 |
| commit | 0b7b199e6f60efc7fb29e8c0f0515ae6562b27c4 (patch) | |
| tree | b3d8bb6c29b15855de1d514b88e9a7822a613072 /includes | |
| parent | 68d6d45635a040a5004581afc5ae78db729175d7 (diff) | |
| download | stock-0b7b199e6f60efc7fb29e8c0f0515ae6562b27c4.tar.gz stock-0b7b199e6f60efc7fb29e8c0f0515ae6562b27c4.tar.bz2 stock-0b7b199e6f60efc7fb29e8c0f0515ae6562b27c4.zip | |
Link prebuild count in user_galleries to its PBLD movement record
Add prebuild_content_id to StockAssembly::getList() (most recent PBLD
movement for the assembly owner) and link both the Prebuilt label and
count in user_galleries.tpl to view_movement.php?content_id=.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'includes')
| -rwxr-xr-x | includes/classes/StockAssembly.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/includes/classes/StockAssembly.php b/includes/classes/StockAssembly.php index 10a59d7..db017f7 100755 --- a/includes/classes/StockAssembly.php +++ b/includes/classes/StockAssembly.php @@ -1007,6 +1007,13 @@ class StockAssembly extends StockBase { AND mc.`content_type_guid` = 'stockmovement' AND mc.`user_id` = lc.`user_id` INNER JOIN `{$X}liberty_xref` xpbld ON xpbld.`content_id` = xasm.`content_id` AND xpbld.`item` = 'PBLD' WHERE xasm.`item` = 'ASSEMBLY' AND xasm.`xref` = lc.`content_id`) AS `prebuild_count`"; + $selectSql .= ", (SELECT FIRST 1 xpbld.`content_id` + FROM `{$X}liberty_xref` xasm + INNER JOIN `{$X}liberty_content` mc ON mc.`content_id` = xasm.`content_id` + AND mc.`content_type_guid` = 'stockmovement' AND mc.`user_id` = lc.`user_id` + INNER JOIN `{$X}liberty_xref` xpbld ON xpbld.`content_id` = xasm.`content_id` AND xpbld.`item` = 'PBLD' + WHERE xasm.`item` = 'ASSEMBLY' AND xasm.`xref` = lc.`content_id` + ORDER BY mc.`created` DESC) AS `prebuild_content_id`"; if( !empty( $pListHash['stgrp'] ) ) { $whereSql .= " AND EXISTS (SELECT 1 FROM `".BIT_DB_PREFIX."liberty_xref` sx WHERE sx.`content_id` = lc.`content_id` AND sx.`item` = ?)"; |
