diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-07 16:51:15 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-07 16:51:15 +0100 |
| commit | 9f5cb5855df61554e38a6da5d036bd78d421a2a9 (patch) | |
| tree | 403cdd171269e8037cb8113f0735665ec916215c /templates | |
| parent | d75d099650de58ede08583e3dac27986544f799f (diff) | |
| download | stock-9f5cb5855df61554e38a6da5d036bd78d421a2a9.tar.gz stock-9f5cb5855df61554e38a6da5d036bd78d421a2a9.tar.bz2 stock-9f5cb5855df61554e38a6da5d036bd78d421a2a9.zip | |
Stock package: assembly/component model, package-level xref, imports, print BOM
- LibertyXrefInfo/LibertyXrefGroup: package-level guid support ('stock')
so stgrp, supplier, kitlocker groups are shared across SA and SC
- schema_inc.php: stgrp group with KLG01-28, supplier consolidated to 'stock'
level, kitlocker moved to 'stock', duplicate #PN/#PR removed
- StockAssembly::getList(): non_root_only and show_empty fixes for standalone
assemblies (no gallery hierarchy)
- StockBase::loadXrefInfo(): instantiates with 'stock' package guid
- list_assemblies.php: gallery_id param, show_empty default for flat list
- edit_assembly.php: STOCKCOMPONENT_CONTENT_TYPE_GUID → string literal
- ImportSimpleComponent: SCREF lookup fixed (xkey not xkey_ext), #SUP row
now carries PN/price/URL directly; #PN #PR #URL separate rows removed
- ImportKitlockerAssemblies, load_kitlocker_assemblies, load_component_list:
new importers for KitlockerAssemblies.csv (A/C split) and Component List.csv
- print_bom.php + print_bom.tpl: read-only printable BOM (p_stock_view only)
with auto window.print() on load
- component_order.tpl: print icon (floaticon), position number for print,
hidden-print on form controls
- list_stock.tpl: print icon
- view_assembly.tpl: print icon → print_bom.php; permission gates tightened
- ipackage duplicate attributes removed from templates
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'templates')
| -rwxr-xr-x | templates/assembly_icons_inc.tpl | 2 | ||||
| -rwxr-xr-x | templates/component_order.tpl | 11 | ||||
| -rwxr-xr-x | templates/list_assemblies2.tpl | 4 | ||||
| -rw-r--r-- | templates/list_assemblies_simple.tpl | 8 | ||||
| -rw-r--r-- | templates/list_components.tpl | 2 | ||||
| -rw-r--r-- | templates/list_stock.tpl | 3 | ||||
| -rw-r--r-- | templates/print_bom.tpl | 58 | ||||
| -rwxr-xr-x | templates/view_assembly.tpl | 19 |
8 files changed, 87 insertions, 20 deletions
diff --git a/templates/assembly_icons_inc.tpl b/templates/assembly_icons_inc.tpl index 07eff67..e1dd64e 100755 --- a/templates/assembly_icons_inc.tpl +++ b/templates/assembly_icons_inc.tpl @@ -1,3 +1,3 @@ {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" ipackage="icons" iexplain="Add Component"}</a> + <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/component_order.tpl b/templates/component_order.tpl index a1ac4c5..817c84d 100755 --- a/templates/component_order.tpl +++ b/templates/component_order.tpl @@ -1,6 +1,9 @@ {strip} <div class="edit stock"> <div class="header"> + <div class="floaticon hidden-print"> + <button type="button" class="btn btn-link" onclick="window.print()">{biticon ipackage="icons" iname="document-print" iexplain="Print"}</button> + </div> <h1>{tr}Parts List{/tr}: <a href="{$smarty.const.STOCK_PKG_URL}view_assembly.php?content_id={$gContent->mContentId}">{$gContent->getTitle()|escape}</a></h1> </div> @@ -13,7 +16,7 @@ <table class="table table-striped table-condensed"> <thead> <tr> - <th style="width:6em;">{tr}Order{/tr}</th> + <th style="width:4em;">{tr}#{/tr}</th> <th>{tr}Component{/tr}</th> <th>{tr}Description{/tr}</th> <th>{tr}Qty{/tr}</th> @@ -25,6 +28,7 @@ {if $gXrefInfo->mGroups.quantity && $gXrefInfo->mGroups.quantity->mXrefs} {foreach from=$gXrefInfo->mGroups.quantity->mXrefs item=row} {math equation="floor(x/1000)" x=$row.xorder|default:0 assign=thisGroup} + {math equation="x % 1000" x=$row.xorder|default:0 assign=posInGroup} {if $thisGroup != $lastGroup} <tr class="active"> <th colspan="5">{tr}Group{/tr} {$thisGroup}</th> @@ -33,9 +37,10 @@ {/if} <tr> <td> - <input type="text" class="form-control input-sm" size="5" + <input type="text" class="form-control input-sm hidden-print" size="5" name="xrefOrder[{$row.xref_id|escape}]" value="{$row.xorder|escape}" /> + <span class="visible-print-inline">{$posInGroup}</span> </td> <td> {if $row.xref > 0} @@ -58,7 +63,7 @@ </tbody> </table> - <div class="form-group submit"> + <div class="form-group submit hidden-print"> <input type="submit" class="btn btn-default" name="cancel" value="{tr}Back{/tr}" /> <input type="submit" class="btn btn-primary" name="save_order" value="{tr}Save{/tr}" /> </div> diff --git a/templates/list_assemblies2.tpl b/templates/list_assemblies2.tpl index c7f2765..24169ba 100755 --- a/templates/list_assemblies2.tpl +++ b/templates/list_assemblies2.tpl @@ -9,7 +9,7 @@ <section class="body"> <ul class="list-inline sortby"> - <li>{biticon ipackage="icons" iname="go-next" ipackage="icons" iexplain="sort by" iforce="icon"}</li> + <li>{biticon ipackage="icons" iname="go-next" iexplain="sort by" iforce="icon"}</li> {if $gBitSystem->isFeatureActive('stock_list_title')} <li>{smartlink ititle="Name" isort="title"}</li> {/if} @@ -41,7 +41,7 @@ {/if} </a> {if $gal.is_hidden|default:'n' == 'y' || $gal.is_private|default:'n' == 'y' || $gal.access_answer|default:false} - {biticon ipackage="icons" iname="lock" ipackage="icons" iexplain="Restricted"} + {biticon ipackage="icons" iname="lock" iexplain="Restricted"} {/if} </h3> </div> diff --git a/templates/list_assemblies_simple.tpl b/templates/list_assemblies_simple.tpl index 7c3b9d6..7d2eddf 100644 --- a/templates/list_assemblies_simple.tpl +++ b/templates/list_assemblies_simple.tpl @@ -2,7 +2,7 @@ <div class="listing stock"> <header> <div class="floaticon"> - {minifind prompt="Assemblies" content_id=$smarty.request.content_id} + {minifind prompt="Assemblies" gallery_id=$smarty.request.gallery_id} </div> <h1>{tr}Assemblies{/tr}{if $gQueryUserId} {tr}by{/tr} {displayname user_id=$gQueryUserId}{/if}</h1> </header> @@ -38,12 +38,12 @@ </td> <td> {if $gal.child_count > 0} - <a href="{$smarty.const.STOCK_PKG_URL}list_assemblies.php?content_id={$gal.content_id}">{$gal.title|escape}</a> + <a href="{$smarty.const.STOCK_PKG_URL}list_assemblies.php?gallery_id={$gal.content_id}">{$gal.title|escape}</a> {else} <a href="{$gal.display_url|escape}">{$gal.title|escape}</a> {/if} {if $gal.is_hidden|default:'n' == 'y' || $gal.is_private|default:'n' == 'y' || $gal.access_answer|default:false} - {biticon ipackage="icons" iname="lock" ipackage="icons" iexplain="Restricted"} + {biticon ipackage="icons" iname="lock" iexplain="Restricted"} {/if} {if $gal.data} <br/><small class="text-muted">{$gal.data|truncate:250|escape}</small> @@ -61,7 +61,7 @@ </table> <nav> - {pagination content_id=$smarty.request.content_id} + {pagination gallery_id=$smarty.request.gallery_id} </nav> </section> diff --git a/templates/list_components.tpl b/templates/list_components.tpl index 5495f84..f2de519 100644 --- a/templates/list_components.tpl +++ b/templates/list_components.tpl @@ -13,7 +13,7 @@ <section class="body"> {if $gBitSystem->isFeatureActive('stock_item_list_creator') || $gBitSystem->isFeatureActive('stock_item_list_date') || $gBitSystem->isFeatureActive('stock_item_list_hits')} <ul class="list-inline sortby"> - <li>{biticon ipackage="icons" iname="go-next" ipackage="icons" iexplain="sort by" iforce="icon"}</li> + <li>{biticon ipackage="icons" iname="go-next" iexplain="sort by" iforce="icon"}</li> {if $gBitSystem->isFeatureActive('stock_item_list_creator')} <li>{smartlink ititle="Creator" isort=$gBitSystem->getConfig('users_display_name') icontrol=$listInfo}</li> {/if} diff --git a/templates/list_stock.tpl b/templates/list_stock.tpl index 0afba5e..efbe222 100644 --- a/templates/list_stock.tpl +++ b/templates/list_stock.tpl @@ -1,6 +1,9 @@ {strip} <div class="listing stock"> <header> + <div class="floaticon hidden-print"> + <button type="button" class="btn btn-link" onclick="window.print()">{biticon ipackage="icons" iname="document-print" iexplain="Print"}</button> + </div> <h1>{tr}Stock Levels{/tr}{if $assemblyTitle} — {$assemblyTitle|escape}{/if}</h1> </header> diff --git a/templates/print_bom.tpl b/templates/print_bom.tpl new file mode 100644 index 0000000..e6c28e6 --- /dev/null +++ b/templates/print_bom.tpl @@ -0,0 +1,58 @@ +{strip} +<div class="display stock"> + <header> + <div class="floaticon hidden-print"> + <button type="button" class="btn btn-link" onclick="window.print()">{biticon ipackage="icons" iname="document-print" iexplain="Print"}</button> + </div> + <h1>{$gContent->getTitle()|escape} — {tr}Parts List{/tr}</h1> + </header> + + <section class="body"> + <table class="table table-striped table-condensed"> + <thead> + <tr> + <th style="width:3em">{tr}#{/tr}</th> + <th>{tr}Component{/tr}</th> + <th>{tr}Description{/tr}</th> + <th>{tr}Qty{/tr}</th> + <th>{tr}Ref designators{/tr}</th> + </tr> + </thead> + <tbody> + {assign var=lastGroup value=-1} + {if $gXrefInfo->mGroups.quantity && $gXrefInfo->mGroups.quantity->mXrefs} + {foreach from=$gXrefInfo->mGroups.quantity->mXrefs item=row} + {math equation="floor(x/1000)" x=$row.xorder|default:0 assign=thisGroup} + {math equation="x % 1000" x=$row.xorder|default:0 assign=posInGroup} + {if $thisGroup != $lastGroup} + <tr class="active"> + <th colspan="5">{tr}Group{/tr} {$thisGroup}</th> + </tr> + {assign var=lastGroup value=$thisGroup} + {/if} + <tr> + <td>{$posInGroup}</td> + <td> + {if $row.xref > 0} + <a href="{$smarty.const.STOCK_PKG_URL}view_component.php?content_id={$row.xref|escape}">{$row.xref_title|default:$row.xref|escape}</a> + {else} + + {/if} + </td> + <td>{$row.xref_data|escape}</td> + <td> + {$row.xkey|escape} + {if $row.item eq 'PCK' && $row.pack_size} of {$row.pack_size|escape}{if $row.pack_size_ext} {$row.pack_size_ext|escape}{/if}{/if} + </td> + <td>{$row.xkey_ext|escape}</td> + </tr> + {/foreach} + {else} + <tr class="norecords"><td colspan="5">{tr}No parts list found.{/tr}</td></tr> + {/if} + </tbody> + </table> + </section> +</div> +{/strip} +<script>window.addEventListener('load', function(){ window.print(); });</script> diff --git a/templates/view_assembly.tpl b/templates/view_assembly.tpl index b1ef284..07b7ff9 100755 --- a/templates/view_assembly.tpl +++ b/templates/view_assembly.tpl @@ -1,16 +1,17 @@ {assign var=galLayout value=$gContent->getLayout()} -{if $gContent->hasUpdatePermission()} - <div class="floaticon"> +<div class="floaticon"> + {if $gContent->hasUpdatePermission()} {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='icon' serviceHash=$gContent->mInfo} <a title="{tr}Edit{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_assembly.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="edit" iexplain="Edit Assembly"}</a> <a title="{tr}Component Order{/tr}" href="{$smarty.const.STOCK_PKG_URL}component_order.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="view-sort-ascending" iexplain="Component Order"}</a> - <a title="{tr}View Stock{/tr}" href="{$smarty.const.STOCK_PKG_URL}list_stock.php?assembly_content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="package-x-generic" iexplain="View Stock"}</a> - <a title="{tr}View Movements{/tr}" href="{$smarty.const.STOCK_PKG_URL}list_movements.php?assembly_content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="go-next" iexplain="View Movements"}</a> - {if $gContent->hasAdminPermission()} - <a title="{tr}Delete Assembly{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_assembly.php?content_id={$gContent->mContentId}&delete=1">{biticon ipackage="icons" iname="user-trash" iexplain="Delete Assembly"}</a> - {/if} - </div> -{/if} + {/if} + <a title="{tr}Print Parts List{/tr}" href="{$smarty.const.STOCK_PKG_URL}print_bom.php?content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="document-print" iexplain="Print Parts List"}</a> + <a title="{tr}View Stock{/tr}" href="{$smarty.const.STOCK_PKG_URL}list_stock.php?assembly_content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="package-x-generic" iexplain="View Stock"}</a> + <a title="{tr}View Movements{/tr}" href="{$smarty.const.STOCK_PKG_URL}list_movements.php?assembly_content_id={$gContent->mContentId}">{biticon ipackage="icons" iname="go-next" iexplain="View Movements"}</a> + {if $gContent->hasAdminPermission()} + <a title="{tr}Delete Assembly{/tr}" href="{$smarty.const.STOCK_PKG_URL}edit_assembly.php?content_id={$gContent->mContentId}&delete=1">{biticon ipackage="icons" iname="user-trash" iexplain="Delete Assembly"}</a> + {/if} +</div> {include file="`$smarty.const.STOCK_PKG_PATH`assembly_views/`$galLayout`/stock_`$galLayout`_inc.tpl"} {if $gXrefInfo->mGroups} |
