mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Merge pull request #9856 from inietov/bug/ch15413/model_number_is_not_on_accessory_import_dropdown
Fixes: Model Number is not on the Accessory import dropdown of mappable fields [ch15413]
This commit is contained in:
commit
75d4a46fff
|
@ -14,7 +14,7 @@ class AccessoryImporter extends ItemImporter
|
||||||
protected function handle($row)
|
protected function handle($row)
|
||||||
{
|
{
|
||||||
parent::handle($row); // TODO: Change the autogenerated stub
|
parent::handle($row); // TODO: Change the autogenerated stub
|
||||||
$this->createAccessoryIfNotExists();
|
$this->createAccessoryIfNotExists($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,7 @@ class AccessoryImporter extends ItemImporter
|
||||||
* @author Daniel Melzter
|
* @author Daniel Melzter
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public function createAccessoryIfNotExists()
|
public function createAccessoryIfNotExists($row)
|
||||||
{
|
{
|
||||||
$accessory = Accessory::where('name', $this->item['name'])->first();
|
$accessory = Accessory::where('name', $this->item['name'])->first();
|
||||||
if ($accessory) {
|
if ($accessory) {
|
||||||
|
@ -33,12 +33,14 @@ class AccessoryImporter extends ItemImporter
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->log('Updating Accessory');
|
$this->log('Updating Accessory');
|
||||||
|
$this->item['model_number'] = $this->findCsvMatch($row, "model_number");
|
||||||
$accessory->update($this->sanitizeItemForUpdating($accessory));
|
$accessory->update($this->sanitizeItemForUpdating($accessory));
|
||||||
$accessory->save();
|
$accessory->save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->log("No Matching Accessory, Creating a new one");
|
$this->log("No Matching Accessory, Creating a new one");
|
||||||
$accessory = new Accessory();
|
$accessory = new Accessory();
|
||||||
|
$this->item['model_number'] = $this->findCsvMatch($row, "model_number");
|
||||||
$accessory->fill($this->sanitizeItemForStoring($accessory));
|
$accessory->fill($this->sanitizeItemForStoring($accessory));
|
||||||
|
|
||||||
//FIXME: this disables model validation. Need to find a way to avoid double-logs without breaking everything.
|
//FIXME: this disables model validation. Need to find a way to avoid double-logs without breaking everything.
|
||||||
|
|
|
@ -141,6 +141,9 @@
|
||||||
{id: 'username', text: 'Username' },
|
{id: 'username', text: 'Username' },
|
||||||
{id: 'department', text: 'Department' },
|
{id: 'department', text: 'Department' },
|
||||||
],
|
],
|
||||||
|
accessories:[
|
||||||
|
{id: 'model_number', text: 'Model Number'},
|
||||||
|
],
|
||||||
assets: [
|
assets: [
|
||||||
{id: 'asset_tag', text: 'Asset Tag' },
|
{id: 'asset_tag', text: 'Asset Tag' },
|
||||||
{id: 'asset_model', text: 'Model Name' },
|
{id: 'asset_model', text: 'Model Name' },
|
||||||
|
@ -208,7 +211,10 @@
|
||||||
.concat(this.columnOptions.assets)
|
.concat(this.columnOptions.assets)
|
||||||
.concat(this.columnOptions.customFields)
|
.concat(this.columnOptions.customFields)
|
||||||
.sort(sorter);
|
.sort(sorter);
|
||||||
|
case 'accessory':
|
||||||
|
return this.columnOptions.general
|
||||||
|
.concat(this.columnOptions.accessories)
|
||||||
|
.sort(sorter);
|
||||||
case 'consumable':
|
case 'consumable':
|
||||||
return this.columnOptions.general
|
return this.columnOptions.general
|
||||||
.concat(this.columnOptions.consumables)
|
.concat(this.columnOptions.consumables)
|
||||||
|
|
Loading…
Reference in a new issue