Skip to content

A free open source IT asset/license management system

Added requestable flag to importer

snipea652b43b6733
diff --git a/app/Importer/ComponentImporter.php b/app/Importer/ComponentImporter.php
index 0b8b9d20b4..57e0d0a125 100644
--- a/app/Importer/ComponentImporter.php
+++ b/app/Importer/ComponentImporter.php
@@ -58,6 +58,12 @@ class ComponentImporter extends ItemImporter
$this->setItemFromCsvIfPresent($row, 'min_amt');
$this->setItemFromCsvIfPresent($row, 'qty', 'quantity');
$this->setItemFromCsvIfPresent($row, 'serial');
+ // Persist the requestable flag on both create + update, matching
+ // the accessory / consumable importers now that Component is a
+ // first-class Requestable. Component::setRequestableAttribute
+ // normalizes "0"/"1"/"true"/"false"/"" so any of the common CSV
+ // shapes lands correctly.
+ $this->setItemFromCsvIfPresent($row, 'requestable');
// asset_tag is not in Component's fillable but is used by the
// checkout-to-asset path in createComponentIfNotExists.
diff --git a/app/Importer/LicenseImporter.php b/app/Importer/LicenseImporter.php
index f0b4203a28..baf199f320 100644
--- a/app/Importer/LicenseImporter.php
+++ b/app/Importer/LicenseImporter.php
@@ -166,6 +166,12 @@ class LicenseImporter extends ItemImporter
$this->setItemFromCsvIfPresent($row, 'reassignable');
$this->setItemFromCsvIfPresent($row, 'min_amt');
$this->setItemFromCsvIfPresent($row, 'seats');
+ // Persist the requestable flag on both create + update, matching
+ // the accessory / consumable / component importers now that
+ // License is a first-class Requestable. License's
+ // setRequestableAttribute normalizes "0"/"1"/"true"/"false"/""
+ // so any of the common CSV shapes lands correctly.
+ $this->setItemFromCsvIfPresent($row, 'requestable');
// Dates need parseOrNullDate after the raw value is in $this->item.
// Empty value stays null (which clears the DB field on update).