This commit is contained in:
Dennis Eichhorn 2024-02-04 20:34:12 +00:00
parent ef17a40bbe
commit a60249050e

View File

@ -79,18 +79,12 @@ final class ApiController extends Controller
} }
} }
// Handle private files
// @todo this is another example where it would be useful to have clients and items as models in the bill and bill element
/** @var \Modules\ClientManagement\Models\Client $client */
$client = ClientMapper::get()
->where('account', $request->header->account)
->execute();
// @todo only for sales invoice, currently also for offers // @todo only for sales invoice, currently also for offers
/** @var \Modules\Billing\Models\Bill[] $bills */ /** @var \Modules\Billing\Models\Bill[] $bills */
$bills = BillMapper::getAll() $bills = BillMapper::getAll()
->with('client')
->with('elements') ->with('elements')
->where('client', $client->id) ->where('client/account', $request->header->account)
->where('status', BillStatus::ARCHIVED) ->where('status', BillStatus::ARCHIVED)
->where('elements/item', $request->getDataInt('item')) ->where('elements/item', $request->getDataInt('item'))
->execute(); ->execute();