Skip to content

Commit

Permalink
Merge pull request #3344 from craftcms/bugfix/lineitems-status-unarch…
Browse files Browse the repository at this point in the history
…iving

Line Item Status - unarchiving
  • Loading branch information
lukeholder authored Nov 22, 2023
2 parents 4f22bb0 + 9e592f8 commit 333c0f9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/services/LineItemStatuses.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,10 @@ public function handleChangedLineItemStatus(ConfigEvent $event): void
$statusRecord->sortOrder = $data['sortOrder'] ?? 99;
$statusRecord->default = $data['default'];
$statusRecord->uid = $statusUid;
$statusRecord->isArchived = false;
$statusRecord->dateArchived = null;

// Save the status
if ($wasTrashed = (bool)$statusRecord->dateDeleted) {
$statusRecord->restore();
} else {
$statusRecord->save(false);
}
$statusRecord->save(false);

if ($statusRecord->default) {
LineItemStatusRecord::updateAll(['default' => 0], ['not', ['id' => $statusRecord->id]]);
Expand Down

0 comments on commit 333c0f9

Please sign in to comment.