diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-08 20:56:56 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-08 20:56:56 +0100 |
| commit | a838a2d3963738b2e9bc496b31e078ead79d4a43 (patch) | |
| tree | bafe061903e4a076b92eb6d00813661f21f64ae8 /includes | |
| parent | 5e0af09c649b90a0963bd4e6b62f24b8cbf8edd9 (diff) | |
| download | stock-a838a2d3963738b2e9bc496b31e078ead79d4a43.tar.gz stock-a838a2d3963738b2e9bc496b31e078ead79d4a43.tar.bz2 stock-a838a2d3963738b2e9bc496b31e078ead79d4a43.zip | |
stock: requisition system, movement BOM editor, autocomplete dropdowns
Requisitions:
- add_requisition.php: create REQN movements linked to assemblies or
kitlocker components; Ordered date stored on REQN xref start_date
- ASSEMBLY xref group registered in schema (sort_order=1, template=assembly);
ASSEMBLY item registered with multiple=1 for future multi-item reqns
- StockMovement::loadXrefInfo() enriches assembly group rows with
linked_title/linked_desc from liberty_content
- view_xref_assembly_group/item templates: Assembly tab with qty, title
link, type; Add item form on edit_movement for REQNs; hidden on I-direction
- view_movement/edit_movement: isReqn flag hides assembly tab and type
selector on ORDER/TRANS; add another assembly from edit_movement
BOM editor:
- stockmovement/view_xref_bom_group: Add component links to new
add_movement_component.php instead of generic liberty/add_xref.php
- add_movement_component.php/.tpl: movement-aware add component page;
uses movement_lookup_inc, STOCKMOVEMENT_CONTENT_TYPE_GUID, sequential
xorder, redirects back to edit_movement
Autocomplete dropdowns (replace <select> everywhere):
- add_requisition: hidden+text+dropdown widget; KLID in JSON for matching
- add_supplier: AJAX contact lookup replaces static supplier list
- list_stock: assembly selector replaced with autocomplete dropdown
- edit_movement: From field proper dropdown replacing datalist;
Movement Type radio fixed (was reading non-existent mInfo[reference])
- view_xref_assembly_group: Add item inline form with same widget
Import:
- ImportKitlockerAssemblies: upsert xrefs on reload; KLID/KLSGL/KL3M
now stored on both assemblies and components (not assembly-only)
- StockComponent::getList: kitlocker_only filter via EXISTS(KLID xref)
list_movements: Add Requisition icon alongside Add Movement in header
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'includes')
| -rwxr-xr-x | includes/classes/StockComponent.php | 4 | ||||
| -rw-r--r-- | includes/classes/StockMovement.php | 17 |
2 files changed, 21 insertions, 0 deletions
diff --git a/includes/classes/StockComponent.php b/includes/classes/StockComponent.php index 6a67318..37d3659 100755 --- a/includes/classes/StockComponent.php +++ b/includes/classes/StockComponent.php @@ -189,6 +189,10 @@ class StockComponent extends StockBase { $bindVars[] = $term; } + if( !empty( $pListHash['kitlocker_only'] ) ) { + $whereSql .= " AND EXISTS (SELECT 1 FROM `".BIT_DB_PREFIX."liberty_xref` kx WHERE kx.`content_id` = lc.`content_id` AND kx.`item` = 'KLID')"; + } + $this->getServicesSql( 'content_list_sql_function', $selectSql, $joinSql, $whereSql, $bindVars ); $orderby = !empty( $pListHash['sort_mode'] ) diff --git a/includes/classes/StockMovement.php b/includes/classes/StockMovement.php index 543c588..d731050 100644 --- a/includes/classes/StockMovement.php +++ b/includes/classes/StockMovement.php @@ -194,6 +194,23 @@ class StockMovement extends LibertyContent { } } unset( $row ); + + $assemblyGroup = $this->mXrefInfo->mGroups['assembly'] ?? null; + if( !$assemblyGroup || empty( $assemblyGroup->mXrefs ) ) return; + $assemblyIds = array_values( array_unique( array_filter( array_column( $assemblyGroup->mXrefs, 'xref' ) ) ) ); + if( !$assemblyIds ) return; + $assemblies = $this->mDb->getAssoc( + "SELECT lc.`content_id`, lc.`title`, lc.`data` FROM `".BIT_DB_PREFIX."liberty_content` lc + WHERE lc.`content_id` IN (".implode( ',', array_fill( 0, count( $assemblyIds ), '?' ) ).")", + $assemblyIds + ); + foreach( $assemblyGroup->mXrefs as &$row ) { + if( !empty( $row['xref'] ) && isset( $assemblies[$row['xref']] ) ) { + $row['linked_title'] = $assemblies[$row['xref']]['title']; + $row['linked_desc'] = $assemblies[$row['xref']]['data']; + } + } + unset( $row ); } /** |
