diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-09 17:52:28 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-09 17:52:28 +0100 |
| commit | cc23974a923e8b98ada7127fd2f09f75d97da01e (patch) | |
| tree | ef2dcca283fb1703ad2665fef71d1168a556e447 | |
| parent | e792a1a73506f2c09b60528418a36f2c3035f399 (diff) | |
| download | stock-cc23974a923e8b98ada7127fd2f09f75d97da01e.tar.gz stock-cc23974a923e8b98ada7127fd2f09f75d97da01e.tar.bz2 stock-cc23974a923e8b98ada7127fd2f09f75d97da01e.zip | |
stock: kitlocker tab visibility; view icon cleanup
- edit/view_component: hide kitlocker and stgrp xref tabs for
non-kitlocker components (no KLID value); tabs appear at end when shown
- view_component: floaticon moved inside header; protector services removed
- view_component: edit/delete icons; remove redundant services_inc includes
- view_movement: floaticon moved inside header div
- assembly_icons_inc: remove stale Add Component link (edit BOM tab handles it)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rwxr-xr-x | edit_component.php | 6 | ||||
| -rwxr-xr-x | templates/assembly_icons_inc.tpl | 3 | ||||
| -rwxr-xr-x | templates/edit_component.tpl | 24 | ||||
| -rwxr-xr-x | templates/view_component.tpl | 34 | ||||
| -rw-r--r-- | templates/view_movement.tpl | 11 | ||||
| -rwxr-xr-x | view_component.php | 6 |
6 files changed, 57 insertions, 27 deletions
diff --git a/edit_component.php b/edit_component.php index f75be10..ef2cc8f 100755 --- a/edit_component.php +++ b/edit_component.php @@ -81,6 +81,12 @@ if( !$gContent->isValid() && !empty( $_REQUEST['title'] ) ) { $gContent->loadXrefInfo(); $gBitSmarty->assign( 'gXrefInfo', $gContent->mXrefInfo ); +$isKitlocker = $gContent->mContentId ? (bool)$gBitDb->getOne( + "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."liberty_xref` WHERE `content_id`=? AND `item`='KLID'", + [ $gContent->mContentId ] +) : false; +$gBitSmarty->assign( 'isKitlocker', $isKitlocker ); + $gContent->invokeServices( 'content_edit_function' ); $gBitSystem->display( 'bitpackage:stock/edit_component.tpl', KernelTools::tra('Edit Component: ').$gContent->getTitle(), [ 'display_mode' => 'edit' ] ); diff --git a/templates/assembly_icons_inc.tpl b/templates/assembly_icons_inc.tpl index e1dd64e..e69de29 100755 --- a/templates/assembly_icons_inc.tpl +++ b/templates/assembly_icons_inc.tpl @@ -1,3 +0,0 @@ -{if $gContent->hasUpdatePermission()} - <a title="{tr}Add Component{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_component.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="list-add" iexplain="Add Component"}</a> -{/if} diff --git a/templates/edit_component.tpl b/templates/edit_component.tpl index a3c15c2..9bf6bcc 100755 --- a/templates/edit_component.tpl +++ b/templates/edit_component.tpl @@ -25,16 +25,28 @@ {/forminput} </div> - {include file="bitpackage:liberty/edit_services_inc.tpl" serviceFile="content_edit_mini_tpl"} - {if $gXrefInfo->mGroups} {jstabs} + {assign var=klGroup value=null} + {assign var=sgGroup value=null} {foreach $gXrefInfo->mGroups as $xrefGroup} - {include file=$gContent->getXrefListTemplate($xrefGroup->mTemplate) - xrefGroup=$xrefGroup - allow_add=true - allow_edit=true} + {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} + {/if} {/foreach} + {if $isKitlocker && $klGroup} + {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 37b42ef..770005a 100755 --- a/templates/view_component.tpl +++ b/templates/view_component.tpl @@ -4,34 +4,46 @@ {/if} <div class="display stock"> - {if empty($liberty_preview)} + {formfeedback hash=$feedback} + <div class="header"> + {if empty($liberty_preview)} <div class="floaticon"> - {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='icon' serviceHash=$gContent->mInfo} {if $gContent->hasUpdatePermission()} <a title="{tr}Edit{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_component.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="edit" iexplain="Edit Component"}</a> <a title="{tr}Delete{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_component.php?content_id={$gContent->mContentId}&delete=1">{biticon ipackage="icons" iname="user-trash" iexplain="Delete Component"}</a> {/if} </div> - {/if} - - {formfeedback hash=$feedback} - <div class="header"> + {/if} <h1>{$gContent->getTitle()|escape}</h1> </div> <div class="body"> - {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='body' serviceHash=$gContent->mInfo} {if $gContent->mInfo.data ne ''} <p class="description">{$gContent->mInfo.parsed_data}</p> {/if} {jstabs} {if $gXrefInfo->mGroups} + {assign var=klGroup value=null} + {assign var=sgGroup value=null} {foreach $gXrefInfo->mGroups as $xrefGroup} - {include file=$gContent->getXrefListTemplate($xrefGroup->mTemplate) - xrefGroup=$xrefGroup - allow_edit=false} + {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} + {/if} {/foreach} + {if $isKitlocker && $klGroup} + {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}"} @@ -60,8 +72,6 @@ {/jstabs} </div><!-- end .body --> - {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='view' serviceHash=$gContent->mInfo} - {if $gGallery && $gGallery->isCommentable()} {include file="bitpackage:liberty/comments.tpl"} {/if} diff --git a/templates/view_movement.tpl b/templates/view_movement.tpl index f3d157f..f038cb6 100644 --- a/templates/view_movement.tpl +++ b/templates/view_movement.tpl @@ -1,12 +1,11 @@ {strip} <div class="display stock"> - <div class="floaticon"> - {if $gBitUser->hasPermission('p_stock_create')} - <a title="{tr}Edit{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_movement.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="edit" iexplain="Edit Movement"}</a> - {/if} - </div> - <div class="header"> + <div class="floaticon"> + {if $gBitUser->hasPermission('p_stock_create')} + <a title="{tr}Edit{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_movement.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="edit" iexplain="Edit Movement"}</a> + {/if} + </div> <h1>{$gContent->getTitle()|escape}</h1> </div> diff --git a/view_component.php b/view_component.php index 2940441..f82a5c2 100755 --- a/view_component.php +++ b/view_component.php @@ -37,6 +37,12 @@ $gContent->addHit(); $gContent->loadXrefInfo(); $gBitSmarty->assign( 'gXrefInfo', $gContent->mXrefInfo ); +$isKitlocker = (bool)$gBitDb->getOne( + "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."liberty_xref` WHERE `content_id`=? AND `item`='KLID'", + [ $gContent->mContentId ] +); +$gBitSmarty->assign( 'isKitlocker', $isKitlocker ); + // Stock levels for this component, calculated from movement xrefs if( $gContent->isValid() ) { $X = BIT_DB_PREFIX; |
