diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-11 10:42:10 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-11 10:42:10 +0100 |
| commit | 51195f3ae4cbc9ce3ae6f6054e75a72fdf0a5e32 (patch) | |
| tree | e0004f02fc8a910a9f00cc0f6e182e0e1d14d325 | |
| parent | 77995206ac8bdbd8129d1daabb02cba599250795 (diff) | |
| download | stock-51195f3ae4cbc9ce3ae6f6054e75a72fdf0a5e32.tar.gz stock-51195f3ae4cbc9ce3ae6f6054e75a72fdf0a5e32.tar.bz2 stock-51195f3ae4cbc9ce3ae6f6054e75a72fdf0a5e32.zip | |
stock: merge stgrp xrefs into kitlocker group at data level; revert stgrp template tag; drop sgGroup stash from component templates
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rwxr-xr-x | admin/schema_inc.php | 2 | ||||
| -rwxr-xr-x | edit_assembly.php | 9 | ||||
| -rwxr-xr-x | edit_component.php | 9 | ||||
| -rwxr-xr-x | includes/display_stock_assembly_inc.php | 9 | ||||
| -rwxr-xr-x | templates/edit_component.tpl | 7 | ||||
| -rwxr-xr-x | templates/view_component.tpl | 7 | ||||
| -rwxr-xr-x | view_component.php | 9 |
7 files changed, 37 insertions, 15 deletions
diff --git a/admin/schema_inc.php b/admin/schema_inc.php index d43bb76..edf8463 100755 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -88,7 +88,7 @@ $xrefItems = []; // ── 'stock' package-level groups — shared across stockassembly and stockcomponent ── // sort_order=1: stgrp (group tags, multi-valued KLGnn items) // sort_order=3: supplier (replaces per-type duplicates) -$xrefTypes[] = "INSERT INTO `{$X}liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`,`template`) VALUES ('stgrp', 'stock','Stock Groups', 1,3,'','kitlocker')"; +$xrefTypes[] = "INSERT INTO `{$X}liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`,`template`) VALUES ('stgrp', 'stock','Stock Groups', 1,3,'','')"; $xrefTypes[] = "INSERT INTO `{$X}liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`,`template`) VALUES ('supplier', 'stock','Supplier', 3,3,'','sup')"; // KLG01–KLG28 — Kitlocker group tags (multiple=0 per item; multiple items per record = multi-group tagging) diff --git a/edit_assembly.php b/edit_assembly.php index 812dc7c..a12b979 100755 --- a/edit_assembly.php +++ b/edit_assembly.php @@ -160,6 +160,15 @@ if( $gContent->isValid() ) { } $gContent->loadXrefInfo(); +if( isset( $gContent->mXrefInfo->mGroups['stgrp'] ) ) { + if( isset( $gContent->mXrefInfo->mGroups['kitlocker'] ) ) { + $gContent->mXrefInfo->mGroups['kitlocker']->mXrefs = array_merge( + $gContent->mXrefInfo->mGroups['kitlocker']->mXrefs, + $gContent->mXrefInfo->mGroups['stgrp']->mXrefs + ); + } + unset( $gContent->mXrefInfo->mGroups['stgrp'] ); +} $gBitSmarty->assign( 'gXrefInfo', $gContent->mXrefInfo ); $gContent->invokeServices( 'content_edit_function' ); diff --git a/edit_component.php b/edit_component.php index ef2cc8f..03e4dfd 100755 --- a/edit_component.php +++ b/edit_component.php @@ -79,6 +79,15 @@ if( !$gContent->isValid() && !empty( $_REQUEST['title'] ) ) { } $gContent->loadXrefInfo(); +if( isset( $gContent->mXrefInfo->mGroups['stgrp'] ) ) { + if( isset( $gContent->mXrefInfo->mGroups['kitlocker'] ) ) { + $gContent->mXrefInfo->mGroups['kitlocker']->mXrefs = array_merge( + $gContent->mXrefInfo->mGroups['kitlocker']->mXrefs, + $gContent->mXrefInfo->mGroups['stgrp']->mXrefs + ); + } + unset( $gContent->mXrefInfo->mGroups['stgrp'] ); +} $gBitSmarty->assign( 'gXrefInfo', $gContent->mXrefInfo ); $isKitlocker = $gContent->mContentId ? (bool)$gBitDb->getOne( diff --git a/includes/display_stock_assembly_inc.php b/includes/display_stock_assembly_inc.php index 51b16b1..21613c5 100755 --- a/includes/display_stock_assembly_inc.php +++ b/includes/display_stock_assembly_inc.php @@ -15,6 +15,15 @@ $listHash['max_records'] = $max_records; $gContent->loadComponents( $listHash ); $gContent->loadParentAssemblies(); $gContent->loadXrefInfo(); +if( isset( $gContent->mXrefInfo->mGroups['stgrp'] ) ) { + if( isset( $gContent->mXrefInfo->mGroups['kitlocker'] ) ) { + $gContent->mXrefInfo->mGroups['kitlocker']->mXrefs = array_merge( + $gContent->mXrefInfo->mGroups['kitlocker']->mXrefs, + $gContent->mXrefInfo->mGroups['stgrp']->mXrefs + ); + } + unset( $gContent->mXrefInfo->mGroups['stgrp'] ); +} $gBitSmarty->assign( 'gXrefInfo', $gContent->mXrefInfo ); $gContent->addHit(); diff --git a/templates/edit_component.tpl b/templates/edit_component.tpl index d8dad00..83b53a7 100755 --- a/templates/edit_component.tpl +++ b/templates/edit_component.tpl @@ -34,12 +34,9 @@ {if $gXrefInfo->mGroups} {jstabs} {assign var=klGroup value=null} - {assign var=sgGroup value=null} {foreach $gXrefInfo->mGroups as $xrefGroup} {if $xrefGroup->mXGroup eq 'kitlocker'} {assign var=klGroup value=$xrefGroup} - {elseif $xrefGroup->mXGroup eq 'stgrp'} - {assign var=sgGroup value=$xrefGroup} {else} {include file=$gContent->getXrefListTemplate($xrefGroup->mTemplate) xrefGroup=$xrefGroup allow_add=true allow_edit=true} @@ -49,10 +46,6 @@ {include file=$gContent->getXrefListTemplate($klGroup->mTemplate) xrefGroup=$klGroup allow_add=true allow_edit=true} {/if} - {if $isKitlocker && $sgGroup} - {include file=$gContent->getXrefListTemplate($sgGroup->mTemplate) - xrefGroup=$sgGroup allow_add=true allow_edit=true} - {/if} {/jstabs} {/if} diff --git a/templates/view_component.tpl b/templates/view_component.tpl index 864cb90..80466e7 100755 --- a/templates/view_component.tpl +++ b/templates/view_component.tpl @@ -24,12 +24,9 @@ {jstabs} {if $gXrefInfo->mGroups} {assign var=klGroup value=null} - {assign var=sgGroup value=null} {foreach $gXrefInfo->mGroups as $xrefGroup} {if $xrefGroup->mXGroup eq 'kitlocker'} {assign var=klGroup value=$xrefGroup} - {elseif $xrefGroup->mXGroup eq 'stgrp'} - {assign var=sgGroup value=$xrefGroup} {else} {include file=$gContent->getXrefListTemplate($xrefGroup->mTemplate) xrefGroup=$xrefGroup allow_edit=false} @@ -39,10 +36,6 @@ {include file=$gContent->getXrefListTemplate($klGroup->mTemplate) xrefGroup=$klGroup allow_edit=false} {/if} - {if $isKitlocker && $sgGroup} - {include file=$gContent->getXrefListTemplate($sgGroup->mTemplate) - xrefGroup=$sgGroup allow_edit=false} - {/if} {/if} {jstab title="{tr}Stock{/tr}"} diff --git a/view_component.php b/view_component.php index 765a269..266a3e1 100755 --- a/view_component.php +++ b/view_component.php @@ -35,6 +35,15 @@ if( is_object( $gGallery ) && $gGallery->isCommentable() ) { $gContent->addHit(); $gContent->loadXrefInfo(); +if( isset( $gContent->mXrefInfo->mGroups['stgrp'] ) ) { + if( isset( $gContent->mXrefInfo->mGroups['kitlocker'] ) ) { + $gContent->mXrefInfo->mGroups['kitlocker']->mXrefs = array_merge( + $gContent->mXrefInfo->mGroups['kitlocker']->mXrefs, + $gContent->mXrefInfo->mGroups['stgrp']->mXrefs + ); + } + unset( $gContent->mXrefInfo->mGroups['stgrp'] ); +} $gBitSmarty->assign( 'gXrefInfo', $gContent->mXrefInfo ); $isKitlocker = (bool)$gBitDb->getOne( |
