summaryrefslogtreecommitdiff
path: root/import/ImportAssembly.php
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-31 10:06:48 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-31 10:06:48 +0100
commitcef2bbde0cbaa042a545f432865de11e0bc51d03 (patch)
tree53315ea10db725ec3b99ca31c7c016b0b60f89f6 /import/ImportAssembly.php
parent693acd68d2dcdbfd700a3aab6c49251552cc9be0 (diff)
downloadstock-cef2bbde0cbaa042a545f432865de11e0bc51d03.tar.gz
stock-cef2bbde0cbaa042a545f432865de11e0bc51d03.tar.bz2
stock-cef2bbde0cbaa042a545f432865de11e0bc51d03.zip
Remove stock_component table — use liberty_content directly
stock_component was a pure alias (component_id ↔ content_id with no other data). All queries now target liberty_content WHERE content_type_guid = STOCKCOMPONENT_CONTENT_TYPE_GUID directly. - StockComponent: drop mComponentId, constructor takes content_id only - All component_id URL params changed to content_id - Import files, edit_movement, sitemap updated to match - BOM xref templates updated (xref column migrated from component_id to content_id in live DB — 130 rows) - StockAssembly loadXrefList/enrichXrefDisplay join liberty_content directly; loadComponents drops stock_component LEFT JOIN - StockBase: previous/next keys renamed to _content_id stock_component table left in schema_inc.php pending DB reset. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'import/ImportAssembly.php')
-rw-r--r--import/ImportAssembly.php9
1 files changed, 4 insertions, 5 deletions
diff --git a/import/ImportAssembly.php b/import/ImportAssembly.php
index 44b63f3..001dd8c 100644
--- a/import/ImportAssembly.php
+++ b/import/ImportAssembly.php
@@ -4,7 +4,7 @@
*
* CSV column layout (0-based):
* 0 assembly_title Kit / assembly name
- * 1 component_title Component name (must already exist in stock_component)
+ * 1 component_title Component name (must already exist as a stockcomponent content item)
* 2 quantity_value Numeric quantity in BOM (optional, default 1)
* 3 quantity_item SGL / PCK / SHT / VOL (optional, default SGL)
* 4 item_position Float position (e.g. 1.1, 1.2, 2.1) (optional)
@@ -85,10 +85,9 @@ function StockAssemblyBatchLoad( string $assemblyTitle, array $pRows ): array {
function _stockImportFindComponent( string $title ): ?int {
global $gBitDb;
$contentId = $gBitDb->getOne(
- "SELECT fi.`content_id`
- FROM `".BIT_DB_PREFIX."stock_component` fi
- INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON lc.`content_id` = fi.`content_id`
- WHERE lc.`title` = ?",
+ "SELECT lc.`content_id`
+ FROM `".BIT_DB_PREFIX."liberty_content` lc
+ WHERE lc.`content_type_guid` = '".STOCKCOMPONENT_CONTENT_TYPE_GUID."' AND lc.`title` = ?",
[ $title ]
);
return $contentId ? (int)$contentId : null;