Record used material on tasks and suggest workflow steps' default materials
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Inventory\Infrastructure\Adapters;
|
||||
|
||||
use App\Modules\Inventory\Infrastructure\Persistence\Eloquent\StockMovementModel;
|
||||
use App\Modules\Jobs\Application\Contracts\TaskUsage;
|
||||
|
||||
/**
|
||||
* A task with recorded material is kept like one with hours: the stock
|
||||
* movements refer to it.
|
||||
*/
|
||||
class TaskUsageWithStock implements TaskUsage
|
||||
{
|
||||
public function __construct(private TaskUsage $inner) {}
|
||||
|
||||
public function hasTimeEntries(int $taskId): bool
|
||||
{
|
||||
return $this->inner->hasTimeEntries($taskId)
|
||||
|| StockMovementModel::query()->where('task_id', $taskId)->exists();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user