summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2026-06-09stock: remove show-zero filter; extend shortages to main listLester Caine2-18/+25
Zero stock is always relevant when movements are tracked. Shortages filter now applies to the main list (level < 0) as well as BOM view. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09stock: PCK/SHT fractional display, movement qty summing, import qty typeLester Caine10-14/+163
Display fixes: - list_stock, list_movements, view_component: PCK stock divides by pack_size for fractional strip display; SHT shows 2 decimal places - list_movements: pack_size fetched per component for PCK display - All fractional formats use %.2f consistently StockMovement::getList component filter: - Replace INNER JOIN on xcmp with EXISTS subquery to avoid duplicate rows when a component appears multiple times in a movement BOM - cmp_qty now SUMs all matching xref rows so multi-assembly RQs show total quantity rather than silently dropping duplicate rows Movement BOM edit templates: - stockmovement/edit_xref_bom_item.tpl: proper edit form for SGL/SHT/VOL lines linking back to view_component - stockmovement/edit_xref_bompck_item.tpl: same for PCK with pack size hint Import: - ImportSimpleComponent: columns 6/7 (qty_type, qty_value) wired up; PCK/SHT/VOL writes qty xref so movement CSV imports pick up default type Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08stock: requisition system, movement BOM editor, autocomplete dropdownsLester Caine20-154/+848
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>
2026-06-08edit_assembly: remove dead components section, tidy upload layoutLester Caine1-37/+2
Removed the stock_assembly_map components table (always empty since gallery hierarchy was dropped), the Components heading, and the 'No components yet' message. BOM tab already shows component count. Upload BOM form now sits directly below Save with results above it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07Fix xorder lost on xref edit; widen component_order Order columnLester Caine5-2/+6
All edit_xref templates were missing a hidden xorder field, causing LibertyXref::verify() to default it to 0 on every save. Added the hidden field to all four stock edit_xref templates (bom, bompck, pck, sup). component_order.tpl: Order column widened to 7em so 4-digit xorder values are not clipped. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07Stock package: assembly/component model, package-level xref, imports, print BOMLester Caine18-106/+458
- LibertyXrefInfo/LibertyXrefGroup: package-level guid support ('stock') so stgrp, supplier, kitlocker groups are shared across SA and SC - schema_inc.php: stgrp group with KLG01-28, supplier consolidated to 'stock' level, kitlocker moved to 'stock', duplicate #PN/#PR removed - StockAssembly::getList(): non_root_only and show_empty fixes for standalone assemblies (no gallery hierarchy) - StockBase::loadXrefInfo(): instantiates with 'stock' package guid - list_assemblies.php: gallery_id param, show_empty default for flat list - edit_assembly.php: STOCKCOMPONENT_CONTENT_TYPE_GUID → string literal - ImportSimpleComponent: SCREF lookup fixed (xkey not xkey_ext), #SUP row now carries PN/price/URL directly; #PN #PR #URL separate rows removed - ImportKitlockerAssemblies, load_kitlocker_assemblies, load_component_list: new importers for KitlockerAssemblies.csv (A/C split) and Component List.csv - print_bom.php + print_bom.tpl: read-only printable BOM (p_stock_view only) with auto window.print() on load - component_order.tpl: print icon (floaticon), position number for print, hidden-print on form controls - list_stock.tpl: print icon - view_assembly.tpl: print icon → print_bom.php; permission gates tightened - ipackage duplicate attributes removed from templates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06stock: docblock tidy across all four class filesLester Caine4-53/+355
Add/update docblocks for StockBase, StockComponent, StockAssembly, and StockMovement. File-level comments describe the content model; method comments document params, return types, and non-obvious behaviour (BOM enrichment, circular-assembly guard, movement direction inference, CSV import format, recursive CTE tree, xorder appending). Remove stale/empty @package duplicates on class declarations. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06import: save uploaded CSVs to storage/stock/ for audit trailLester Caine2-1/+6
Add STOCK_IMPORT_PATH = STORAGE_PKG_PATH.'stock/' to bit_setup_inc. edit_assembly.php: move_uploaded_file BOM CSV to storage/stock/<origname>_bom_<content_id>.csv before processing. edit_movement.php: copy movement CSV to storage/stock/<origname>_move_<content_id>.csv before calling importCsv(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06import: cull legacy importers; move data to storage/stock/Lester Caine11-687/+7
Remove old ImportAssembly/Component classes, load_stock, load_components, load_assemblies, load_kitlocker_assemblies/groups (one-off imports). Add STOCK_IMPORT_PATH = STORAGE_PKG_PATH.'stock/' to bit_setup_inc. Update load_simple_assemblies/components/components_2 to use STOCK_IMPORT_PATH instead of __DIR__.'/data/'. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06import_results.tpl: show updated record countLester Caine1-0/+3
2026-06-06xref: complete migration from loadXrefList to loadXrefInfoLester Caine8-97/+16
Remove loadXrefList() overrides from StockBase, StockAssembly, StockMovement; remove loadXrefList() calls from all load() methods. StockMovement::load() gains ref_type and ref_from_data correlated subqueries so templates no longer need mInfo.reference[0]. getDirection() reads mInfo.ref_type directly. component_order.php/tpl: switch to loadXrefInfo + gXrefInfo path. edit_assembly.php: remove stale bucket-clearing block. view_movement.tpl: use mInfo.ref_from_data instead of mInfo.reference.0.data. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06xref group templates: remove fixed column widthsLester Caine3-12/+12
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06edit_movement: switch xref tabs to LibertyXrefGroup pathLester Caine2-15/+12
Replace movement_xref_groups/getXrefGroupList() with loadXrefInfo() + gXrefInfo; reference group filtered in template as before. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-06Refactor xref display to LibertyXrefGroup path throughoutLester Caine23-233/+217
- StockBase/StockAssembly/StockMovement: add loadXrefInfo() overrides to enrich supplier group with contact titles and BOM group with component titles, descriptions and pack sizes - display_stock_assembly_inc, view/edit_component, view/edit_assembly, view_movement: replace getXrefGroupList() with loadXrefInfo() + assign gXrefInfo; edit pages pass allow_edit=true - All view/edit templates: switch {section} over stockXxx_types arrays to {foreach $gXrefInfo->mGroups as $xrefGroup} object path - BOM and supplier group templates rewritten: $xrefGroup object, column widths, class="table", conditional colspan - All BOM/supplier item templates: $gContent->mInfo.$source[xref].x -> $xrefInfo.x; $source ne 'history' -> $isHistory - Dead code removed: list_xref_stock.tpl, view_xref_pck_item.tpl Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05Add p_stock_expunge permission; gate movement delete buttonLester Caine2-5/+6
p_stock_expunge at admin level. edit_movement.tpl delete button now requires p_stock_expunge. Xref item delete gating (currently xrefAllowEdit only) is a pending audit — same history-vs-hard-delete question as contact. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05Rationalise stock permissionsLester Caine1-6/+4
p_stock_view: registered; p_stock_create/update: editors; p_stock_admin: admin. Remove p_stock_list_assemblies (unused, covered by p_stock_view) and p_stock_create_public_gal (unused, covered by p_stock_create). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05Add create/edit icons to list pages; use p_stock_update for edit gatesLester Caine3-2/+14
list_assemblies/list_components: add create header icon (p_stock_create), edit icon in row/caption (p_stock_update). list_movements: fix edit gate from p_stock_create → p_stock_update. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05Replace list_movements buttons with iconsLester Caine1-3/+2
Add Movement → view-task-add biticon; row edit → edit biticon Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05Update stock menu icons — placeholder set pending custom iconsLester Caine1-8/+8
view-group/view-list-tree/view-list-details/view-form-table for lists; kt-add-filters/view-list-icons/view-task-add/view-task-child-add for creates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05Switch icons: document-properties → edit, text-x-generic → view-list-textLester Caine16-23/+23
edit used for all edit actions; view-list-text for list links and assembly content-type placeholder (to be fine-tuned separately for add vs list contexts). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05Switch delete icon from edit-delete to user-trash (dustbin)Lester Caine10-10/+10
user-trash updated to a proper dustbin SVG. All templates across all packages updated to use user-trash instead of edit-delete. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04Convert {booticon} to {biticon} — freedesktop/tango icon names throughoutLester Caine25-58/+58
Replace all {booticon iname="icon-*"} and {booticon iname="fa-*"} calls with {biticon ipackage="icons" iname="<freedesktop-name>"} using the tango iconset. Mapping covers ~70 distinct old names to tango equivalents (edit-delete, document-properties, go-next, lock, internet-mail, etc.). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04stock: fix SCREF lookup to use xkey; remove duplicate datalist entriesLester Caine1-1/+1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: movement contact linkage, note field, view/edit tidyLester Caine4-26/+178
- importCsv: look up contact by SCREF xref.data, store content_id in xref.xref - load(): add ref_contact_id, ref_contact_name, ref_type_title subqueries - edit_movement.php: contact lookup URL; save xref.xref from manual picker; fix refRow.edit → refRow.data fallback - edit_movement.tpl: From field with contact autocomplete + hidden id; Note field - view_movement.tpl: supplier above dates, reference tab removed, note shown, Type shows cross_ref_title, contact links to contact record Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: preserve movement type when CSV import updates reference xrefLester Caine1-4/+6
importCsv() was hardcoding item='TRANS' on the reference row, overwriting an ORDER or REQN type already stored by edit_movement.php before the upload. Now fetches the existing item and preserves it; TRANS only used for new rows. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: drop Ref column, sortable Ordered/Received, fix smartlink isortLester Caine2-7/+7
- Remove redundant ref_key column (shown in Reference already) - Add ref_start_date sort to getList() match block (subquery-based, avoids Firebird alias restriction) - Fix isort values: smartlink appends _asc/_desc itself — passing _desc in isort was generating ref_start_date_desc_desc Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: fix markReceived, add ref_start_date to load(), tidy view_movement datesLester Caine2-3/+11
- markReceived() was passing mDb->NOW() string into BIGINT event_time; use time() - load() now includes ref_start_date correlated subquery (same as getList) - view_movement.tpl: Created → Ordered → Received order; Ordered only shown when ref_start_date is set Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: CSV import order date → xref.start_date; add optional received dateLester Caine1-5/+23
Header line now: from, ref, order_date(dd/mm/yy), received_date(dd/mm/yy) - col 3 (order date) stored in liberty_xref.start_date on reference row - col 4 (received date, optional) stored in lc.event_time Existing 3-column CSVs still work unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: add Ordered/Received sort and ref_start_date to list_movementsLester Caine2-6/+16
- StockMovement::getList() adds ref_start_date correlated subquery from liberty_xref.start_date on the reference row - event_time sort handled explicitly (lc. prefix needed for Firebird) - list_movements.tpl: Ordered column, sortable Received column, colspan fix Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: fix pagination on list_movementsLester Caine2-1/+10
StockMovement::getList() was missing a COUNT query so postGetList() defaulted cant to max_records, giving total_pages=1 always. Also pass filter params (ref_type, find, component_content_id, assembly_content_id) through pagination links so filters survive page navigation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: fix KitlockerAssemblies import KLID matchingLester Caine1-23/+53
When col0==col1 and no KLID xref exists yet (first run), fall back to title lookup so the assembly is found and the KLID xref gets stored. Subsequent runs use the KLID xref directly, surviving manual title changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: rework KitlockerAssemblies import for new CSV layoutLester Caine1-48/+79
New columns: Title, KLID, Data, KLSGL, KL3M, Group. Match existing assemblies by KLID xref (not title) so tidier titles are applied on re-run; wipe and replace old kitlocker xrefs each time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: redirect to view_movement after save/mark-receivedLester Caine1-2/+2
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: add BOM component add page with autocompleteLester Caine5-1/+216
- add_component.php: find component by title and store BOM xref; redirect to component_order.php on success, or edit_component.php (title pre-filled) if component not found - add_component.tpl: form with datalist autocomplete via lookup_component.php - includes/lookup_component.php: JSON endpoint for component title search - edit_component.php: pre-fill title from request for new components - view_xref_bom_group.tpl: add button now goes to add_component.php Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: fix blank icons on view_assembly — use colourstrap iconsLester Caine1-2/+2
fa-boxes-stacked and fa-truck don't exist in colourstrap-full.css; replace with icon-box and icon-move which do. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: fix xref group sort_order collision in schema_inc.phpLester Caine1-13/+17
Separated group definitions by content type so sort_orders are explicit and unambiguous. stockcomponent: supplier=1, quantity=2, values=3. stockassembly: kitlocker=1, supplier=2, quantity/BOM=3 (no values group). Values xref items remain stockcomponent-only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: override getEditUrl() on all concrete content classesLester Caine2-0/+14
LibertyContent::getEditUrl() always builds edit.php; StockAssembly and StockMovement now return their correct entry points (edit_assembly.php, edit_movement.php). StockComponent already had this override. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03stock: look up kitlocker parent by title, not hardcoded IDLester Caine1-10/+14
Hardcoded assembly_id=21 breaks on any DB rebuild. Look up the 'kitlocker' assembly by title so re-running the import on any server wires up the parent links correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02Component movement history: filter list_movements by component_content_idLester Caine4-3/+35
StockMovement::getList() joins xcmp when component_content_id is set, adding cmp_qty/cmp_qty_type columns per row. list_movements.php looks up component title; template shows it in the header, adds a Qty column, and provides a back link. view_component Stock tab now links to filtered movement list. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02view_component: add Stock Levels tab showing movement totals per qty typeLester Caine2-4/+53
Query mirrors list_stock.php for a single component. Tab shows level per qty type with danger/warning colouring, plus a link to filtered stock history. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02list_stock: BOM view shows all components regardless of stock historyLester Caine1-47/+67
In BOM mode, use a BOM-first query with correlated subquery for stock so components with no movements appear with level 0. In general list mode keep the existing movement-INNER JOIN with the show_zero filter. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02Move CSV import into StockMovement::importCsv(); fix storeXref by-refLester Caine2-92/+94
Standalone function removed from edit_movement.php; logic lives in the method using \$this->mDb. Named variable used for item storeXref call — literal arrays cause fatal error (passed by reference). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02edit_movement: support CSV upload at create timeLester Caine2-133/+115
Extract CSV processing into stockProcessMovementCsv() used by both fSave (new movement) and upload_csv (existing movement). Template: CSV file input shown on create form; enctype set to multipart. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02Fix CONTENT_TYPE_GUID define placement — movement stays in StockMovementLester Caine2-1/+2
StockMovement extends LibertyContent not StockBase, so STOCKMOVEMENT_CONTENT_TYPE_GUID belongs in StockMovement.php. StockBase correctly holds assembly and component defines only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02ImportSimpleComponent: replace constant with literal — autoload not ↵Lester Caine1-2/+2
triggered in import context Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02Move all stock CONTENT_TYPE_GUID defines to StockBaseLester Caine4-6/+3
StockBase is always loaded first; defining all three constants there avoids files depending on each other's load order. Removed duplicate defines from StockComponent and StockMovement. Reverted spurious use StockComponent from edit_assembly.php. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02edit_assembly: use StockComponent to define STOCKCOMPONENT_CONTENT_TYPE_GUIDLester Caine1-0/+1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02Untrack import/data CSV files; add .gitignore and .gitkeepLester Caine11-662/+2
CSV data files are site-specific and should not be distributed. import/data/ is now gitignored with a .gitkeep to preserve the empty directory for deployments. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02Remove old fisheye-era files superseded by stock rewriteLester Caine75-4064/+0
Removes gallery views, image editing, carousel/gallery liberty plugins, gallery/image templates, and supporting includes that predate the stock package rewrite. None of these exist in the current bitweaver5 working tree. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02Add requisition entry point — template and menu itemLester Caine2-0/+54
add_requisition.tpl: form for RQ number, assembly select, kit count. menu_stock.tpl: add Create Requisition link alongside existing actions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>