Commit b77649e8 authored by DevPilot's avatar DevPilot

fix(inventory): custody transfer never recorded the new custodian

The transfer form posts new_employee_id / new_location, but
storeTransfer() read to_employee_id / to_location. Both came back
empty, so every transfer wrote NULL over custodian_employee_id and
blanked the location — the asset ended up with no custodian at all,
and asset_custody_history recorded the move with an empty recipient.

Reads the names the form actually sends, keeping the old ones as a
fallback.
parent 8353e628
......@@ -87,8 +87,12 @@ class AssetCustodyController extends Controller
return $this->redirect('/inventory/assets/custody')->withError('الأصل غير موجود');
}
$toEmployeeId = $request->post('to_employee_id') ? (int) $request->post('to_employee_id') : null;
$toLocation = $request->post('to_location', '');
// The form posts new_employee_id / new_location; the older names are kept as a
// fallback. Reading only the old ones meant every transfer wrote NULL over the
// custodian instead of assigning the new one.
$rawEmployee = $request->post('new_employee_id') ?: $request->post('to_employee_id');
$toEmployeeId = $rawEmployee ? (int) $rawEmployee : null;
$toLocation = trim((string) ($request->post('new_location') ?: $request->post('to_location', '')));
$db->beginTransaction();
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment