THE LABS GADGET CRM — FULL INVENTORY ACCESS (MANAGER + ACCOUNTS/HR)

PURPOSE
Adds permission to edit product metadata, barcode, category, supplier, grade, compatible models, cost and reorder level for Owner, Manager and Accounts/HR. Accounts/HR also gains stock count adjustment permission. Original system permissions and business data are preserved.

COMPATIBLE WITH PHASE 6.2 INVENTORY & PHASE 10 SETTINGS
- Can be applied before or after Phase 10 activation. For full before/after audit records, install and activate Phase 10 first, then apply this patch. An item_update entry is ALWAYS added to Stock History.
- Phase 10 module permission for Inventory must be enabled for Manager and Accounts/HR. That permission cannot replace existing role checks.

FILES REPLACED (3)
- inventory.php
- crm-inventory.php
- inventory-history.php

INSTALLATION
1) Make a full backup of CRM and export the database via phpMyAdmin.
2) Upload this patch ZIP to CRM Document Root in cPanel and Extract, overwriting ONLY the three files listed above. Do not overwrite config.php or delete data.
3) No database upgrade is needed for this patch.
4) Log in as Accounts/HR and Manager, check Inventory & Barcode access, scan an existing item, test Edit Product Details with a harmless note and confirm Stock History.
5) Use Stock Adjustment (reason mandatory) to correct inventory quantities. Never change quantities inside Product Details.

SECURITY & AUDIT
- Edit functions use role checks on the server, CSRF validation, unique request tokens, database transactions and a row lock.
- Item metadata edits add a 0-quantity item_update record to inventory_movements, including changed field names, actor and reason.
- After Phase 10 activation, full old/new metadata values and reasons are stored in crm_settings_audit as well.
- Physical and non-stock categories cannot be converted between each other. Service Charge/Software never permit physical stock movements.
- Cost is still hidden from ordinary staff. Manager and Accounts/HR can view costs.
- Old barcodes do NOT continue to work after editing; reprint labels if the barcode changes.

After installation verify Owner, Manager and HR inventory access and ensure staff who are not authorized cannot open editing controls.
