When a laptop moves from one employee to another, three people want to know: the location manager who owns the stock, the employee who hands it over, and the employee who receives it. Auditors want to know later. In Osol, an asset and custody management system for companies in Saudi Arabia, each transfer runs through a fixed approval chain. This post shows the model.
The chain
A transfer request moves through these steps in order:
- Location manager approves the move.
- Current holder confirms the handover with a one-time code.
- New holder confirms receipt with a one-time code.
- Oversight gives the final check.
- Completed.
Steps 2 and 3 use a one-time code because they are statements by a person: "I gave it" and "I received it". A click on an email link is weaker evidence than a code sent to that person.
The steps live in a workflow definition, not in code. Each step names a role, such as old_owner, and the workflow engine resolves the real user when the request is created. Defaults are a reminder after 24 hours and an automatic rejection after 72 hours. Admins can change both per workflow.
The record keeps the outcome, the engine keeps the steps
The transfer row stores only the final outcome:
enum TransferRequestStatusEnum: int
{
case Started = 0;
case RejectedByOldOwner = 5;
case RejectedByNewOwner = 6;
case RejectedByLocationManager = 8;
case Completed = 10;
case Canceled = 11;
case RejectedByOversight = 12;
}
Step-by-step progress, including when each step was approved, lives in the workflow engine's step records. Keeping the two apart means a change to the chain, such as an extra finance step, needs no new enum values.
Rejection says who rejected
A rejected transfer that only says "rejected" starts an email thread. We map the step that rejected to a specific status:
$status = match (true) {
$step->is('location_manager') => TransferRequestStatusEnum::RejectedByLocationManager,
$step->is('old_owner') => TransferRequestStatusEnum::RejectedByOldOwner,
$step->is('new_owner') => TransferRequestStatusEnum::RejectedByNewOwner,
$step->is('oversight') => TransferRequestStatusEnum::RejectedByOversight,
default => TransferRequestStatusEnum::Canceled,
};
$transfer->update([
'status' => $status,
'rejection_reason' => $notes,
'closed_at' => now(),
]);
Reports can now answer "how many transfers do receivers refuse?" without reading notes.
Completion is one transaction
When the last step passes, the transfer closes and ownership moves in the same database transaction:
DB::transaction(function () use ($asset, $transfer) {
$transfer->update([
'status' => TransferRequestStatusEnum::Completed,
'closed_at' => now(),
]);
if ($asset->owner_id !== $transfer->receiver_id) {
$this->moveOwnership($transfer, $asset);
}
});
moveOwnership closes the old holder's row with returned_at, opens a new row with received_at, and updates the asset's last_transfer_at. Ownership is history, not a single column. Any asset can show who held it and for which dates.
Assets can be linked, such as a laptop with its docking station. The new holder is applied to linked assets in the same step, so they never split between two people.
Details that saved us support tickets
- One open transfer per asset. A new request cancels the pending one, so two people cannot both be "receiving" the same laptop.
- Expiry. A scheduled command closes transfers whose link has expired. Nothing stays pending forever.
- Proxy approval. Someone can approve on behalf of an absent approver when the workflow allows it.
- Notifications go by email and in-app, with a link to approve directly.
ملخص بالعربية: يشرح هذا المقال مسار نقل العهدة بين الموظفين في نظام إدارة الأصول والعهد. يوافق مدير الموقع أولًا، ثم يؤكد الموظف الذي يسلم العهدة والموظف الذي يستلمها برمز تحقق. وبعد ذلك، توافق جهة الرقابة. ويحفظ النظام سجل الحيازة لكل أصل مع تاريخ التسليم والاستلام.
Written by the engineering team at Renewable Systems in Riyadh, the makers of Osol.
Top comments (0)