# Inventory and Purchase Error Fixes — 5 November 2026

## Changes
1. Corrected the Laravel validation Rule namespace. The invalid `Illuminate\Support\Facades\Rule` references were replaced with `Illuminate\Validation\Rule` in:
   - Inventory StockTakeController
   - Inventory StockController
   - Inventory StockTransferController
   - Purchasing PurchaseOrderController
2. Made stock-transfer history resilient to missing/deleted product, section, store, branch, or user relationships using null-safe rendering.
3. Improved the stock adjustment product picker:
   - Products are limited to active-branch assigned stock-tracked products and ingredients (excluding restaurant menu products unless ingredients).
   - Search results show available quantity in the selected store.
   - The selected product's available quantity updates when the store changes.

## Validation
- PHP lint passed for all 162 PHP files under `app/` and `routes/`.
- ZIP integrity checked after packaging.
- Blade view compilation and live database/browser testing were not available in this environment. Deploy to staging first and test stock take creation/completion, purchase creation, transfer history, and stock adjustment.

## Deployment
Back up the current application and database, upload/extract this package, then run:
`php artisan optimize:clear`

No database migration is included or expected for these fixes.
