diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-18 20:32:50 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-18 20:32:50 +0100 |
| commit | 673ac631795c6706671ef80353cb053917626c6d (patch) | |
| tree | dbe2cf63ab1a0d5c75a3bc8348b725596d14f046 /templates | |
| parent | f5e154c8672be3a4ccbde95f06b5901f8b0ebace (diff) | |
| download | stock-673ac631795c6706671ef80353cb053917626c6d.tar.gz stock-673ac631795c6706671ef80353cb053917626c6d.tar.bz2 stock-673ac631795c6706671ef80353cb053917626c6d.zip | |
Add MERG group BOM importer; fix component_order linked_title
load_merg_bom.php reads a group CSV with assembly content_ids in the
header row and creates SGL BOM xrefs for each non-zero quantity cell.
Supports dry=1 preview and clear=1 to wipe existing BOM lines first.
component_order.tpl was using xref_title/xref_data (the item type
label, e.g. "Single Unit-1") instead of linked_title/linked_data
(the actual component title and description from the joined content row).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'templates')
| -rwxr-xr-x | templates/component_order.tpl | 4 | ||||
| -rw-r--r-- | templates/load_merg_bom.tpl | 50 |
2 files changed, 52 insertions, 2 deletions
diff --git a/templates/component_order.tpl b/templates/component_order.tpl index 7ca79f7..2e39dd5 100755 --- a/templates/component_order.tpl +++ b/templates/component_order.tpl @@ -44,12 +44,12 @@ </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> + <a href="{$smarty.const.STOCK_PKG_URL}view_component.php?content_id={$row.xref|escape}">{$row.linked_title|default:$row.xref|escape}</a> {else} {/if} </td> - <td>{$row.xref_data|escape}</td> + <td>{$row.linked_data|escape}</td> <td> {$row.xkey|escape} {if $row.item eq 'PRT' && $row.part_size} of {$row.part_size|escape}{if $row.part_size_ext} {$row.part_size_ext|escape}{/if}{/if} diff --git a/templates/load_merg_bom.tpl b/templates/load_merg_bom.tpl new file mode 100644 index 0000000..81d4742 --- /dev/null +++ b/templates/load_merg_bom.tpl @@ -0,0 +1,50 @@ +{strip} +<div class="display stock"> + <div class="header"> + <h1>MERG BOM Import — Group {$group|upper|escape}{if $dryRun} (dry run){/if}</h1> + </div> + <div class="body"> + <p>File: <code>{$csvFile|escape}</code></p> + + {if $assemblies} + <table class="table table-condensed"> + <thead> + <tr> + <th>Assembly</th> + <th>content_id</th> + {if $doClear}<th>Cleared</th>{/if} + <th>{if $dryRun}Would add{else}Added{/if}</th> + <th>Skipped</th> + </tr> + </thead> + <tbody> + {foreach $assemblies as $asmId => $asm} + <tr> + <td><a href="{$smarty.const.STOCK_PKG_URL}view_assembly.php?content_id={$asmId}">{$asm.title|escape}</a></td> + <td>{$asmId}</td> + {if $doClear}<td>{$asm.cleared}</td>{/if} + <td class="{if $asm.loaded gt 0}success{/if}">{$asm.loaded}</td> + <td>{$asm.skipped}</td> + </tr> + {/foreach} + </tbody> + </table> + {/if} + + {if $dryRun} + <p> + <a href="?group={$group|escape:'url'}">Run for real</a> + | + <a href="?group={$group|escape:'url'}&clear=1">Run with clear first</a> + </p> + {/if} + + {if $errors} + <h3>Errors / warnings</h3> + <ul> + {foreach $errors as $msg}<li>{$msg|escape}</li>{/foreach} + </ul> + {/if} + </div> +</div> +{/strip} |
