summaryrefslogtreecommitdiff
path: root/list_assemblies.php
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-28 16:42:45 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-28 16:42:45 +0100
commit639fd9f85e189cf98977af0caf20108bb557eb2a (patch)
tree79ef8f2f90047db450516f932b3e9527cac13bcb /list_assemblies.php
parent219a53a7296d821640c9b7abcdc26256e11b9850 (diff)
downloadstock-639fd9f85e189cf98977af0caf20108bb557eb2a.tar.gz
stock-639fd9f85e189cf98977af0caf20108bb557eb2a.tar.bz2
stock-639fd9f85e189cf98977af0caf20108bb557eb2a.zip
Hierarchical assembly browsing via list_assemblies.php
StockAssembly::getList(): add parent_content_id filter (EXISTS subquery) to show only direct children of a given assembly; add child_count subquery so the template can distinguish containers from leaf assemblies. list_assemblies.php: when assembly_id param present, filter to children of that assembly; assign parentAssembly for breadcrumb. list_assemblies_simple.tpl: breadcrumb trail when drilling down; title links to list_assemblies.php?assembly_id=X for containers, view.php for leaf assemblies (child_count == 0). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'list_assemblies.php')
-rwxr-xr-xlist_assemblies.php14
1 files changed, 12 insertions, 2 deletions
diff --git a/list_assemblies.php b/list_assemblies.php
index 8ca68ae..91ef83d 100755
--- a/list_assemblies.php
+++ b/list_assemblies.php
@@ -12,8 +12,18 @@ global $gBitSystem, $gBitSmarty, $gStockAssembly;
$gStockAssembly = new StockAssembly();
-$_REQUEST['root_only'] = true;
-$_REQUEST['show_empty'] = true;
+if( !empty( $_REQUEST['assembly_id'] ) && is_numeric( $_REQUEST['assembly_id'] ) ) {
+ $parentAssembly = new StockAssembly( (int)$_REQUEST['assembly_id'], null );
+ $parentAssembly->load();
+ if( $parentAssembly->isValid() ) {
+ $_REQUEST['parent_content_id'] = $parentAssembly->mContentId;
+ $_REQUEST['show_empty'] = true;
+ $gBitSmarty->assign( 'parentAssembly', $parentAssembly );
+ }
+} else {
+ $_REQUEST['root_only'] = true;
+ $_REQUEST['show_empty'] = true;
+}
if (!empty($_REQUEST['user_id']) && is_numeric($_REQUEST['user_id'])) {
if( $_REQUEST['user_id'] == $gBitUser->mUserId ) {