fix gitlab tests
This commit is contained in:
@@ -9,7 +9,9 @@ use RuntimeException;
|
||||
|
||||
class ReimbursementBatchAssignmentService
|
||||
{
|
||||
public function __construct(private ReimbursementLookupService $lookupService) {}
|
||||
public function __construct(private ReimbursementLookupService $lookupService)
|
||||
{
|
||||
}
|
||||
|
||||
public function updateAssignment(
|
||||
int $expenseId,
|
||||
@@ -33,7 +35,7 @@ class ReimbursementBatchAssignmentService
|
||||
if ($batchId <= 0) {
|
||||
if ($activeItem) {
|
||||
$activeItem->update(['unassigned_at' => $now]);
|
||||
if (! $reimbursementId && ! empty($activeItem->reimbursement_id)) {
|
||||
if (!$reimbursementId && !empty($activeItem->reimbursement_id)) {
|
||||
$reimbursementId = (int) $activeItem->reimbursement_id;
|
||||
}
|
||||
}
|
||||
@@ -46,7 +48,7 @@ class ReimbursementBatchAssignmentService
|
||||
}
|
||||
|
||||
$batch = ReimbursementBatch::query()->find($batchId);
|
||||
if (! $batch || strtolower((string) $batch->status) !== ReimbursementBatch::STATUS_OPEN) {
|
||||
if (!$batch || strtolower((string) $batch->status) !== ReimbursementBatch::STATUS_OPEN) {
|
||||
throw new RuntimeException('Batch not found or already closed.');
|
||||
}
|
||||
|
||||
@@ -61,7 +63,7 @@ class ReimbursementBatchAssignmentService
|
||||
}
|
||||
|
||||
if ($activeSameBatch) {
|
||||
if (! $reimbursementId) {
|
||||
if (!$reimbursementId) {
|
||||
$reimbursementId = $activeItem->reimbursement_id
|
||||
? (int) $activeItem->reimbursement_id
|
||||
: $this->lookupService->findReimbursementIdForExpense($expenseId);
|
||||
@@ -83,12 +85,12 @@ class ReimbursementBatchAssignmentService
|
||||
|
||||
if ($activeItem) {
|
||||
$activeItem->update(['unassigned_at' => $now]);
|
||||
if (! $reimbursementId && ! empty($activeItem->reimbursement_id)) {
|
||||
if (!$reimbursementId && !empty($activeItem->reimbursement_id)) {
|
||||
$reimbursementId = (int) $activeItem->reimbursement_id;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $reimbursementId) {
|
||||
if (!$reimbursementId) {
|
||||
$reimbursementId = $this->lookupService->findReimbursementIdForExpense($expenseId);
|
||||
}
|
||||
|
||||
@@ -103,7 +105,7 @@ class ReimbursementBatchAssignmentService
|
||||
'semester' => $semester,
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Failed to assign expense to batch: '.$e->getMessage(), [
|
||||
Log::error('Failed to assign expense to batch: ' . $e->getMessage(), [
|
||||
'expense_id' => $expenseId,
|
||||
'batch_id' => $batchId,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user