Skip to content

A free open source IT asset/license management system

ENOMNOMNOMs

snipe48db7f6708e6
diff --git a/app/Http/Transformers/ActionlogsTransformer.php b/app/Http/Transformers/ActionlogsTransformer.php
index 116dfb4399..966ed73185 100644
--- a/app/Http/Transformers/ActionlogsTransformer.php
+++ b/app/Http/Transformers/ActionlogsTransformer.php
@@ -61,7 +61,7 @@ class ActionlogsTransformer
// checkouts with a signed acceptance form, etc.) keep their
// semantic icon so the history tab telegraphs what happened, not
// that a file was attached.
- if ($actionlog->action_type === 'uploaded' && $actionlog->filename != '') {
+ if ($actionlog->action_type === ActionType::Uploaded->value && $actionlog->filename != '') {
$icon = Helper::filetype_icon($actionlog->filename);
}
diff --git a/app/Presenters/ActionlogPresenter.php b/app/Presenters/ActionlogPresenter.php
index bc63ab3880..e77567a69c 100644
--- a/app/Presenters/ActionlogPresenter.php
+++ b/app/Presenters/ActionlogPresenter.php
@@ -2,6 +2,8 @@
namespace App\Presenters;
+use App\Enums\ActionType;
+
/**
* Class CompanyPresenter
*/
@@ -110,7 +112,7 @@ class ActionlogPresenter extends Presenter
// quantity" label swap), so it shares the audit icon. Positive
// and negative deltas get plus / minus so the history row's
// icon telegraphs whether qty went up or down at a glance.
- if ($this->action_type == 'adjusted quantity') {
+ if ($this->action_type == ActionType::QuantityAdjust->value) {
$delta = (int) $this->quantity;
if ($delta > 0) {
return 'fa-solid fa-plus';
@@ -126,11 +128,11 @@ class ActionlogPresenter extends Presenter
// adjust-quantity flow) also want +/- icons so the history tab
// reads consistently regardless of which path added / removed
// the seats.
- if ($this->action_type == 'add seats') {
+ if ($this->action_type == ActionType::AddSeats->value) {
return 'fa-solid fa-plus';
}
- if ($this->action_type == 'delete seats') {
+ if ($this->action_type == ActionType::DeleteSeats->value) {
return 'fa-solid fa-minus';
}
@@ -146,7 +148,7 @@ class ActionlogPresenter extends Presenter
// blank change column is confusing. Surface them as "confirmed
// quantity" instead. The underlying action_type value stays
// 'adjusted quantity' so filters and reports keep working.
- if ($this->action_type === 'adjusted quantity' && (int) $this->quantity === 0) {
+ if ($this->action_type === ActionType::QuantityAdjust->value && (int) $this->quantity === 0) {
return mb_strtolower(trans('general.confirmed_quantity'));
}
diff --git a/database/migrations/2026_08_03_144000_reconcile_inventory_qty_from_action_logs.php b/database/migrations/2026_08_03_144000_reconcile_inventory_qty_from_action_logs.php
index ddc83f7a7a..12841bbad4 100644
--- a/database/migrations/2026_08_03_144000_reconcile_inventory_qty_from_action_logs.php
+++ b/database/migrations/2026_08_03_144000_reconcile_inventory_qty_from_action_logs.php
@@ -44,14 +44,15 @@ return new class extends Migration
private function reconcileFor(string $modelClass): void
{
+ $create = ActionType::Create->value;
$qtyAdjust = ActionType::QuantityAdjust->value;
- $modelClass::query()->chunkById(500, function ($rows) use ($modelClass, $qtyAdjust) {
+ $modelClass::query()->chunkById(500, function ($rows) use ($modelClass, $create, $qtyAdjust) {
foreach ($rows as $model) {
$expected = (int) DB::table('action_logs')
->where('item_type', $modelClass)
->where('item_id', $model->id)
- ->whereIn('action_type', ['create', $qtyAdjust])
+ ->whereIn('action_type', [$create, $qtyAdjust])
->whereNull('deleted_at')
->sum('quantity');