diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-29 13:57:43 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-29 13:57:43 +0100 |
| commit | e5f051c2b27424acd773a51d45fd775fbf4c0547 (patch) | |
| tree | 8fd4b3cc106ce992e8f696a0ea3d301bce965c56 /admin | |
| parent | 037372043f22a1fc5949694c0053cdaaa15f460b (diff) | |
| download | stock-e5f051c2b27424acd773a51d45fd775fbf4c0547.tar.gz stock-e5f051c2b27424acd773a51d45fd775fbf4c0547.tar.bz2 stock-e5f051c2b27424acd773a51d45fd775fbf4c0547.zip | |
BOM parts list upload and display via liberty_xref
- StockAssembly: loadXrefList() override sorts quantity rows by xorder and
batch-fetches component title, description and pack size in one JOIN query
- StockComponent: getEditUrl() returns edit_component.php; new components
redirect to edit after save so xrefs can be added immediately
- edit.php: BOM CSV upload handler (ITEM/XORDER/XREF/XKEY/XKEY_EXT format)
writing to liberty_xref via LibertyXref::store(); removed old component
upload and single-add handlers
- edit_component.php: removed spurious assembly/component guard on save
- schema_inc.php: quantity group template='bom' for stockassembly; KLSGL
kitlocker stock item; bom template on stockassembly quantity xref items
- Templates: edit_assembly.tpl and view_assembly.tpl use getXrefListTemplate();
new list_xref_bom.tpl, list_xref_bompck.tpl, view_xref_bom_record.tpl,
edit_xref_bom.tpl for BOM display and editing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'admin')
| -rwxr-xr-x | admin/schema_inc.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/admin/schema_inc.php b/admin/schema_inc.php index 68df2c4..3dcb9b4 100755 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -138,7 +138,8 @@ $xrefItems = []; foreach( [ 'stockcomponent', 'stockassembly' ] as $guid ) { $xrefTypes[] = "INSERT INTO `{$X}liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('supplier','{$guid}','Supplier', 1,3,'')"; - $xrefTypes[] = "INSERT INTO `{$X}liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('quantity','{$guid}','Quantity', 2,3,'')"; + $qtyGrpTpl = ( $guid === 'stockassembly' ) ? 'bom' : ''; + $xrefTypes[] = "INSERT INTO `{$X}liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`,`template`) VALUES ('quantity','{$guid}','Quantity', 2,3,'','{$qtyGrpTpl}')"; $xrefTypes[] = "INSERT INTO `{$X}liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('values', '{$guid}','Values', 3,3,'')"; // Supplier sources — multi=1 (multiple suppliers per item) @@ -149,10 +150,12 @@ foreach( [ 'stockcomponent', 'stockassembly' ] as $guid ) { // Quantity sources — selectable types multi=0, movement multi=1 // entry_date on liberty_xref timestamps each MOV row automatically - $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('SGL','{$guid}','quantity','Single unit', 0,3,'','text',NULL)"; - $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('PCK','{$guid}','quantity','Pack', 0,3,'','text',NULL)"; - $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('SHT','{$guid}','quantity','Sheet (H x W)', 0,3,'','text',NULL)"; - $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('VOL','{$guid}','quantity','Volume', 0,3,'','text',NULL)"; + // stockassembly uses 'bom' template (stock package override); stockcomponent uses 'text' + $qtyTpl = ( $guid === 'stockassembly' ) ? 'bom' : 'text'; + $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('SGL','{$guid}','quantity','Single unit', 0,3,'','{$qtyTpl}',NULL)"; + $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('PCK','{$guid}','quantity','Pack', 0,3,'','{$qtyTpl}',NULL)"; + $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('SHT','{$guid}','quantity','Sheet (H x W)', 0,3,'','{$qtyTpl}',NULL)"; + $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('VOL','{$guid}','quantity','Volume', 0,3,'','{$qtyTpl}',NULL)"; $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('MOV','{$guid}','quantity','Stock movement', 1,3,'','text',NULL)"; // Values sources — starter catalogue, all multi=0, add more via admin @@ -174,6 +177,7 @@ $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`, $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('KLPR', 'stockassembly','kitlocker','Kitlocker Price', 2,3,'','text',NULL)"; $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('KL3M', 'stockassembly','kitlocker','Kitlocker 3 Month Sales', 3,3,'','text',NULL)"; $xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('KLURL','stockassembly','kitlocker','Details URL', 4,3,'','text',NULL)"; +$xrefItems[] = "INSERT INTO `{$X}liberty_xref_item` (`item`,`content_type_guid`,`x_group`,`cross_ref_title`,`multiple`,`role_id`,`cross_ref_href`,`template`,`data`) VALUES ('KLSGL','stockassembly','kitlocker','Kitlocker Stock', 2,3,'','text',NULL)"; // stockmovement xref — requisition reference links $xrefTypes[] = "INSERT INTO `{$X}liberty_xref_group` (`x_group`,`content_type_guid`,`title`,`sort_order`,`role_id`,`type_href`) VALUES ('reference','stockmovement','Reference',1,3,'')"; |
