A free open source IT asset/license management system
Replace qty with quantity
Marcus Mooreab363596fd8a
diff --git a/app/Console/Commands/MigrateLicenseSeatQuantitiesInActionLogs.php b/app/Console/Commands/MigrateLicenseSeatQuantitiesInActionLogs.phpindex b036d1d075..b649f7ee96 100644--- a/app/Console/Commands/MigrateLicenseSeatQuantitiesInActionLogs.php+++ b/app/Console/Commands/MigrateLicenseSeatQuantitiesInActionLogs.php@@ -35,7 +35,7 @@ class MigrateLicenseSeatQuantitiesInActionLogs extends CommandActionType::AddSeats->value,ActionType::DeleteSeats->value,])- ->where('qty', '=', 1)+ ->where('quantity', '=', 1)->orderBy('id');$count = $query->count();@@ -57,13 +57,13 @@ class MigrateLicenseSeatQuantitiesInActionLogs extends Command$this->error('Could not parse quantity from ID: {id}', ['id' => $log->id]);}- if ($log->qty !== (int) $quantityFromNote) {+ if ($log->quantity !== (int) $quantityFromNote) {$this->info(vsprintf('Updating id: %s to quantity %s', ['id' => $log->id,'new_quantity' => $quantityFromNote,]));- DB::table('action_logs')->where('id', $log->id)->update(['qty' => (int) $quantityFromNote]);+ DB::table('action_logs')->where('id', $log->id)->update(['quantity' => (int) $quantityFromNote]);}});});diff --git a/app/Events/CheckoutableCheckedOut.php b/app/Events/CheckoutableCheckedOut.phpindex 2b8df61997..d82a9a7ad4 100644--- a/app/Events/CheckoutableCheckedOut.php+++ b/app/Events/CheckoutableCheckedOut.php@@ -15,20 +15,20 @@ class CheckoutableCheckedOutpublic $checkedOutBy;public $note;public $originalValues;- public int $qty;+ public int $quantity;/*** Create a new event instance.** @return void*/- public function __construct($checkoutable, $checkedOutTo, User $checkedOutBy, $note, $originalValues = [], $qty = 1)+ public function __construct($checkoutable, $checkedOutTo, User $checkedOutBy, $note, $originalValues = [], $quantity = 1){$this->checkoutable = $checkoutable;$this->checkedOutTo = $checkedOutTo;$this->checkedOutBy = $checkedOutBy;$this->note = $note;$this->originalValues = $originalValues;- $this->qty = $qty;+ $this->quantity = $quantity;}}diff --git a/app/Http/Transformers/ActionlogsTransformer.php b/app/Http/Transformers/ActionlogsTransformer.phpindex ab98598294..b4061cf012 100644--- a/app/Http/Transformers/ActionlogsTransformer.php+++ b/app/Http/Transformers/ActionlogsTransformer.php@@ -185,7 +185,7 @@ class ActionlogsTransformer'name' => e($actionlog->target->display_name) ?? null,'type' => e($actionlog->targetType()),] : null,- 'qty' => $this->getQuantity($actionlog),+ 'quantity' => $this->getQuantity($actionlog),'note' => ($actionlog->note) ? Helper::parseEscapedMarkedownInline($actionlog->note): null,'signature_file' => ($actionlog->accept_signature) ? route('log.signature.view', ['filename' => $actionlog->accept_signature ]) : null,'log_meta' => ((isset($clean_meta)) && (is_array($clean_meta))) ? $clean_meta: null,@@ -338,7 +338,7 @@ class ActionlogsTransformerprivate function getQuantity(Actionlog $actionlog): ?int{- if (!$actionlog->qty) {+ if (!$actionlog->quantity) {return null;}@@ -347,7 +347,7 @@ class ActionlogsTransformerreturn null;}- return (int) $actionlog->qty;+ return (int) $actionlog->quantity;}diff --git a/app/Listeners/LogListener.php b/app/Listeners/LogListener.phpindex 05a20af44f..b41edd50af 100644--- a/app/Listeners/LogListener.php+++ b/app/Listeners/LogListener.php@@ -52,7 +52,7 @@ class LogListener$event->checkedOutTo,$event->checkoutable->last_checkout,$event->originalValues,- $event->qty+ $event->quantity);}@@ -72,7 +72,7 @@ class LogListener$logaction->note = $event->acceptance->note;$logaction->action_type = 'accepted';$logaction->action_date = $event->acceptance->accepted_at;- $logaction->qty = $event->acceptance->qty ?? 1;+ $logaction->quantity = $event->acceptance->qty ?? 1;// TODO: log the actual license seat that was checked outif ($event->acceptance->checkoutable instanceof LicenseSeat) {@@ -91,7 +91,7 @@ class LogListener$logaction->note = $event->acceptance->note;$logaction->action_type = 'declined';$logaction->action_date = $event->acceptance->declined_at;- $logaction->qty = $event->acceptance->qty ?? 1;+ $logaction->quantity = $event->acceptance->qty ?? 1;// TODO: log the actual license seat that was checked outif ($event->acceptance->checkoutable instanceof LicenseSeat) {diff --git a/app/Models/License.php b/app/Models/License.phpindex 1024ebdc90..3dbb73b734 100755--- a/app/Models/License.php+++ b/app/Models/License.php@@ -223,7 +223,7 @@ class License extends Depreciable$logAction->created_by = auth()->id() ?: 1; // We don't have an id while running the importer from CLI.$logAction->note = "deleted {$change} seats";$logAction->target_id = null;- $logAction->qty = $change;+ $logAction->quantity = $change;$logAction->logaction('delete seats');return true;@@ -260,7 +260,7 @@ class License extends Depreciable$logAction->created_by = auth()->id() ?: 1; // Importer.$logAction->note = "added {$change} seats";$logAction->target_id = null;- $logAction->qty = $change;+ $logAction->quantity = $change;$logAction->logaction('add seats');}diff --git a/app/Models/Traits/Loggable.php b/app/Models/Traits/Loggable.phpindex b3a965b3d6..4ea08c1525 100644--- a/app/Models/Traits/Loggable.php+++ b/app/Models/Traits/Loggable.php@@ -40,7 +40,7 @@ trait Loggable* @since [v3.4]* @return \App\Models\Actionlog*/- public function logCheckout($note, $target, $action_date = null, $originalValues = [], $qty = 1)+ public function logCheckout($note, $target, $action_date = null, $originalValues = [], $quantity = 1){$log = new Actionlog;@@ -94,7 +94,7 @@ trait Loggable$log->note = $note;$log->action_date = $action_date;- $log->qty = $qty;+ $log->quantity = $quantity;$changed = [];$array_to_flip = array_keys($fields_array);diff --git a/app/Presenters/HistoryPresenter.php b/app/Presenters/HistoryPresenter.phpindex 9fbd8fbd76..2a2a7bc28a 100644--- a/app/Presenters/HistoryPresenter.php+++ b/app/Presenters/HistoryPresenter.php@@ -118,7 +118,7 @@ class HistoryPresenter extends Presenter'formatter' => 'fileDownloadButtonsFormatter',],[- 'field' => 'qty',+ 'field' => 'quantity','searchable' => false,'sortable' => true,'visible' => true,diff --git a/database/migrations/2025_12_10_211855_add_qty_to_action_logs_table.php b/database/migrations/2025_12_10_211855_add_quantity_to_action_logs_table.phpsimilarity index 80%rename from database/migrations/2025_12_10_211855_add_qty_to_action_logs_table.phprename to database/migrations/2025_12_10_211855_add_quantity_to_action_logs_table.phpindex 3f98d0ecaf..59109b0e2c 100644--- a/database/migrations/2025_12_10_211855_add_qty_to_action_logs_table.php+++ b/database/migrations/2025_12_10_211855_add_quantity_to_action_logs_table.php@@ -12,7 +12,7 @@ return new class extends Migrationpublic function up(): void{Schema::table('action_logs', function (Blueprint $table) {- $table->integer('qty')->default(1)->after('expected_checkin');+ $table->integer('quantity')->default(1)->after('expected_checkin');});}@@ -22,7 +22,7 @@ return new class extends Migrationpublic function down(): void{Schema::table('action_logs', function (Blueprint $table) {- $table->dropColumn('qty');+ $table->dropColumn('quantity');});}};diff --git a/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.phpindex 0d036591d0..ac23dc7259 100644--- a/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php+++ b/tests/Feature/CheckoutAcceptances/Ui/AccessoryAcceptanceTest.php@@ -43,7 +43,7 @@ class AccessoryAcceptanceTest extends TestCase'target_type' => User::class,'item_id' => $accessory->id,'item_type' => Accessory::class,- 'qty' => 2,+ 'quantity' => 2,]);}@@ -76,7 +76,7 @@ class AccessoryAcceptanceTest extends TestCase'target_type' => User::class,'item_id' => $accessory->id,'item_type' => Accessory::class,- 'qty' => 2,+ 'quantity' => 2,]);}diff --git a/tests/Feature/CheckoutAcceptances/Ui/ConsumableAcceptanceTest.php b/tests/Feature/CheckoutAcceptances/Ui/ConsumableAcceptanceTest.phpindex 2877bd4498..9c7c0724b5 100644--- a/tests/Feature/CheckoutAcceptances/Ui/ConsumableAcceptanceTest.php+++ b/tests/Feature/CheckoutAcceptances/Ui/ConsumableAcceptanceTest.php@@ -38,7 +38,7 @@ class ConsumableAcceptanceTest extends TestCase'target_type' => User::class,'item_id' => $consumable->id,'item_type' => Consumable::class,- 'qty' => 2,+ 'quantity' => 2,]);}@@ -71,7 +71,7 @@ class ConsumableAcceptanceTest extends TestCase'target_type' => User::class,'item_id' => $consumable->id,'item_type' => Consumable::class,- 'qty' => 2,+ 'quantity' => 2,]);}}diff --git a/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php b/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.phpindex 06bb1658bf..cdada791fe 100644--- a/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php+++ b/tests/Feature/Checkouts/Api/AccessoryCheckoutTest.php@@ -121,7 +121,7 @@ class AccessoryCheckoutTest extends TestCase implements TestsPermissionsRequirem'target_type' => User::class,'item_id' => $accessory->id,'item_type' => Accessory::class,- 'qty' => 2,+ 'quantity' => 2,'created_by' => $admin->id,]);diff --git a/tests/Feature/Checkouts/Api/ComponentCheckoutTest.php b/tests/Feature/Checkouts/Api/ComponentCheckoutTest.phpindex 8440e2d695..732e43b91e 100644--- a/tests/Feature/Checkouts/Api/ComponentCheckoutTest.php+++ b/tests/Feature/Checkouts/Api/ComponentCheckoutTest.php@@ -120,7 +120,7 @@ class ComponentCheckoutTest extends TestCase implements TestsFullMultipleCompani'location_id' => $location->id,'item_type' => Component::class,'item_id' => $component->id,- 'qty' => 2,+ 'quantity' => 2,]);}diff --git a/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php b/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.phpindex c78fac2251..ba88016d02 100644--- a/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php+++ b/tests/Feature/Checkouts/Api/ConsumableCheckoutTest.php@@ -69,7 +69,7 @@ class ConsumableCheckoutTest extends TestCase'target_type' => User::class,'target_id' => $user->id,'action_type' => 'checkout',- 'qty' => 2,+ 'quantity' => 2,]);}diff --git a/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php b/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.phpindex 0b0d62d03d..b05200cfcc 100644--- a/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php+++ b/tests/Feature/Checkouts/Ui/AccessoryCheckoutTest.php@@ -81,7 +81,7 @@ class AccessoryCheckoutTest extends TestCase'target_type' => User::class,'item_id' => $accessory->id,'item_type' => Accessory::class,- 'qty' => 1,+ 'quantity' => 1,'note' => 'oh hi there',]);$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);@@ -109,7 +109,7 @@ class AccessoryCheckoutTest extends TestCase'target_type' => User::class,'item_id' => $accessory->id,'item_type' => Accessory::class,- 'qty' => 3,+ 'quantity' => 3,'note' => 'oh hi there',]);$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);@@ -137,7 +137,7 @@ class AccessoryCheckoutTest extends TestCase'target_type' => Location::class,'item_id' => $accessory->id,'item_type' => Accessory::class,- 'qty' => 3,+ 'quantity' => 3,'note' => 'oh hi there',]);$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);@@ -165,7 +165,7 @@ class AccessoryCheckoutTest extends TestCase'target_type' => Asset::class,'item_id' => $accessory->id,'item_type' => Accessory::class,- 'qty' => 3,+ 'quantity' => 3,'note' => 'oh hi there',]);$this->assertHasTheseActionLogs($accessory, ['create', 'checkout']);diff --git a/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php b/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.phpindex f29bff589a..d17204447c 100644--- a/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php+++ b/tests/Feature/Checkouts/Ui/ComponentsCheckoutTest.php@@ -119,7 +119,7 @@ class ComponentsCheckoutTest extends TestCase'target_type' => Asset::class,'item_id' => $component->id,'item_type' => Component::class,- 'qty' => 2,+ 'quantity' => 2,'created_by' => $admin->id,]);}diff --git a/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php b/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.phpindex c50184ae77..9ecea11501 100644--- a/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php+++ b/tests/Feature/Checkouts/Ui/ConsumableCheckoutTest.php@@ -171,7 +171,7 @@ class ConsumableCheckoutTest extends TestCase'target_type' => User::class,'item_id' => $consumable->id,'item_type' => Consumable::class,- 'qty' => 2,+ 'quantity' => 2,'created_by' => $admin->id,]);}diff --git a/tests/Unit/Models/LicenseTest.php b/tests/Unit/Models/LicenseTest.phpindex 7a8c1f6f8a..bd1960bc11 100644--- a/tests/Unit/Models/LicenseTest.php+++ b/tests/Unit/Models/LicenseTest.php@@ -25,7 +25,7 @@ class LicenseTest extends TestCase'item_id' => $license->id,'deleted_at' => null,// relevant for this test:- 'qty' => 4,+ 'quantity' => 4,'note' => 'added 4 seats',]);}@@ -46,7 +46,7 @@ class LicenseTest extends TestCase'item_id' => $license->id,'deleted_at' => null,// relevant for this test:- 'qty' => 3,+ 'quantity' => 3,'note' => 'deleted 3 seats',]);}