summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-29 15:32:51 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-29 15:32:51 +0100
commitefbe40f744e7c5606cfcd1a3c1670e19510a8b18 (patch)
treed76f45dbb412e58cab56fd0520fe322ab111566c /includes
parentce6c275381aa5d270b3816fc25e833b546d0443a (diff)
downloadstock-efbe40f744e7c5606cfcd1a3c1670e19510a8b18.tar.gz
stock-efbe40f744e7c5606cfcd1a3c1670e19510a8b18.tar.bz2
stock-efbe40f744e7c5606cfcd1a3c1670e19510a8b18.zip
BOM edit templates: component title/desc read-only, pack_size_ext support
- StockAssembly: enrichXrefDisplay() fetches component title, description, pack_size and pack_size_ext in one JOIN query for BOM edit forms - StockAssembly: loadXrefList() batch query also fetches pack_size_ext - edit_xref_bom_item.tpl: component shown as read-only link, only qty and ref designators editable; remove raw component ID field - edit_xref_bompck_item.tpl: new — PCK variant shows "N of pack_size ext" inline, Pieces required label - view_xref_bompck_item.tpl: show pack_size_ext after pack_size in qty cell Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'includes')
-rwxr-xr-xincludes/classes/StockAssembly.php23
1 files changed, 21 insertions, 2 deletions
diff --git a/includes/classes/StockAssembly.php b/includes/classes/StockAssembly.php
index 630f3ca..c3cf0f0 100755
--- a/includes/classes/StockAssembly.php
+++ b/includes/classes/StockAssembly.php
@@ -73,6 +73,24 @@ class StockAssembly extends StockBase {
return @$this->verifyId( $this->mAssemblyId ) || @$this->verifyId( $this->mContentId );
}
+ public function enrichXrefDisplay( array &$pXrefInfo ): void {
+ if( !empty( $pXrefInfo['xref'] ) ) {
+ if( $comp = $this->mDb->getRow(
+ "SELECT lc.`title`, lc.`data`, pck.`xkey` AS `pack_size`, pck.`xkey_ext` AS `pack_size_ext`
+ FROM `".BIT_DB_PREFIX."stock_component` sc
+ INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON lc.`content_id` = sc.`content_id`
+ LEFT JOIN `".BIT_DB_PREFIX."liberty_xref` pck ON pck.`content_id` = sc.`content_id` AND pck.`item` = 'PCK'
+ WHERE sc.`component_id` = ?",
+ [ (int)$pXrefInfo['xref'] ]
+ ) ) {
+ $pXrefInfo['xref_title'] = $comp['title'];
+ $pXrefInfo['xref_data'] = $comp['data'];
+ $pXrefInfo['pack_size'] = $comp['pack_size'];
+ $pXrefInfo['pack_size_ext'] = $comp['pack_size_ext'];
+ }
+ }
+ }
+
public function loadXrefList(): void {
parent::loadXrefList();
if( !empty( $this->mInfo['quantity'] ) ) {
@@ -82,7 +100,7 @@ class StockAssembly extends StockBase {
if( $componentIds ) {
$placeholders = implode( ',', array_fill( 0, count( $componentIds ), '?' ) );
$components = $this->mDb->getAssoc(
- "SELECT sc.`component_id`, lc.`title`, lc.`data`, pck.`xkey` AS `pack_size`
+ "SELECT sc.`component_id`, lc.`title`, lc.`data`, pck.`xkey` AS `pack_size`, pck.`xkey_ext` AS `pack_size_ext`
FROM `".BIT_DB_PREFIX."stock_component` sc
INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON lc.`content_id` = sc.`content_id`
LEFT JOIN `".BIT_DB_PREFIX."liberty_xref` pck ON pck.`content_id` = sc.`content_id` AND pck.`item` = 'PCK'
@@ -93,7 +111,8 @@ class StockAssembly extends StockBase {
if( !empty( $row['xref'] ) && isset( $components[$row['xref']] ) ) {
$row['xref_title'] = $components[$row['xref']]['title'];
$row['xref_data'] = $components[$row['xref']]['data'];
- $row['pack_size'] = $components[$row['xref']]['pack_size'];
+ $row['pack_size'] = $components[$row['xref']]['pack_size'];
+ $row['pack_size_ext'] = $components[$row['xref']]['pack_size_ext'];
}
}
unset( $row );