mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -08:00
that's all of 'em
This commit is contained in:
parent
3574ef5bb9
commit
2deba17d91
|
@ -45,10 +45,10 @@ class ConsumableImporter extends ItemImporter
|
||||||
$this->item['item_no'] = trim($this->findCsvMatch($row, 'item_number'));
|
$this->item['item_no'] = trim($this->findCsvMatch($row, 'item_number'));
|
||||||
$this->item['min_amt'] = trim($this->findCsvMatch($row, "min_amt"));
|
$this->item['min_amt'] = trim($this->findCsvMatch($row, "min_amt"));
|
||||||
$consumable->fill($this->sanitizeItemForStoring($consumable));
|
$consumable->fill($this->sanitizeItemForStoring($consumable));
|
||||||
//FIXME: this disables model validation. Need to find a way to avoid double-logs without breaking everything.
|
|
||||||
$consumable->unsetEventDispatcher();
|
// This sets an attribute on the Loggable trait for the action log
|
||||||
|
$consumable->setImported(true);
|
||||||
if ($consumable->save()) {
|
if ($consumable->save()) {
|
||||||
$consumable->logCreate('Imported using CSV Importer');
|
|
||||||
$this->log('Consumable '.$this->item['name'].' was created');
|
$this->log('Consumable '.$this->item['name'].' was created');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -85,10 +85,10 @@ class LicenseImporter extends ItemImporter
|
||||||
} else {
|
} else {
|
||||||
$license->fill($this->sanitizeItemForStoring($license));
|
$license->fill($this->sanitizeItemForStoring($license));
|
||||||
}
|
}
|
||||||
//FIXME: this disables model validation. Need to find a way to avoid double-logs without breaking everything.
|
|
||||||
// $license->unsetEventDispatcher();
|
// This sets an attribute on the Loggable trait for the action log
|
||||||
|
$license->setImported(true);
|
||||||
if ($license->save()) {
|
if ($license->save()) {
|
||||||
$license->logCreate('Imported using csv importer');
|
|
||||||
$this->log('License '.$this->item['name'].' with serial number '.$this->item['serial'].' was created');
|
$this->log('License '.$this->item['name'].' with serial number '.$this->item['serial'].' was created');
|
||||||
|
|
||||||
// Lets try to checkout seats if the fields exist and we have seats.
|
// Lets try to checkout seats if the fields exist and we have seats.
|
||||||
|
|
|
@ -38,6 +38,9 @@ class ConsumableObserver
|
||||||
$logAction->item_id = $consumable->id;
|
$logAction->item_id = $consumable->id;
|
||||||
$logAction->created_at = date('Y-m-d H:i:s');
|
$logAction->created_at = date('Y-m-d H:i:s');
|
||||||
$logAction->user_id = Auth::id();
|
$logAction->user_id = Auth::id();
|
||||||
|
if($consumable->imported) {
|
||||||
|
$logAction->note = trans('general.importer.import_note');
|
||||||
|
}
|
||||||
$logAction->logaction('create');
|
$logAction->logaction('create');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@ class LicenseObserver
|
||||||
$logAction->item_id = $license->id;
|
$logAction->item_id = $license->id;
|
||||||
$logAction->created_at = date('Y-m-d H:i:s');
|
$logAction->created_at = date('Y-m-d H:i:s');
|
||||||
$logAction->user_id = Auth::id();
|
$logAction->user_id = Auth::id();
|
||||||
|
if($license->imported) {
|
||||||
|
$logAction->note = trans('general.importer.import_note');
|
||||||
|
}
|
||||||
$logAction->logaction('create');
|
$logAction->logaction('create');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue