Bulk Import Overwrites Model Notes Field
Please confirm you have done the following before posting your bug report:
- [x] I have enabled debug mode
- [X] I have read checked the Common Issues page
Describe the bug When an asset is uploaded using the bulk import feature, the notes field of the asset overwrites the notes field of the model.
To Reproduce Steps to reproduce the behavior:
- Prep CSV for bulk import. Have the "Notes" field populated for at least one asset with a pre-existing model (that is, a model already in the system).
- Go through the normal flow for importing the CSV.
- Navigate to the model entry of an asset with notes.
- The "Notes" field has been overwritten with the asset's notes.
Expected behavior The model isn't affected at all when assets are uploaded.
Server (please complete the following information):
- Snipe-IT Version 4.8.0 - build 4186
- OS: Ubuntu 18.04
- Web Server: Apache
- PHP Version 7.2.24
Additional context We have some info in the "Notes" field for some models, e.g. "Placeholder model", so this getting overwritten is an issue for us.
I'm having the exact same issue.
Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!
Yes, still relevant.
Okay, it looks like this issue or feature request might still be important. We'll re-open it for now. Thank you for letting us know!
I can confirm I also have the exact same issue, every time when I import the assets, the asset's notes value will overwrite to the Asset Model's notes value
I can also confirm, even if the imported model is a new asset model, when the importer create the new asset model, it will also copy the notes value of the last imported notes value of that model.
Snipe-IT 4.9.2 PHP 7.1.33 MySQL 5.6.47 IIS Web Server at Windows Server 2008 R2
I look at the code and found that during the Import, if we checked the "Update Existing Values?" checkbox before Import, the code will go on log the "Matching Model found, updating it." and then try to update the Asset Model
However I think that why we need to do this, since the asset model name and model number already match the database value? I if comment the below codes and do a quick hack, then the import can still successful without touching the existing Asset Model items.
app/Importer/ItemImporter.php: Line 198 if ($asset_model) { if (!$this->updating) { $this->log("A matching model already exists, returning it."); return $asset_model->id; } /* Why we need to update the asset model if found it $this->log("Matching Model found, updating it."); $item = $this->sanitizeItemForStoring($asset_model, $editingModel); $item['name'] = $asset_model_name; $item['model_number'] = $asset_modelNumber; $asset_model->update($item); $asset_model->save(); $this->log("Asset Model Updated"); */ return $asset_model->id; }
Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!
This issue has been automatically closed because it has not had recent activity. If you believe this is still an issue, please confirm that this issue is still happening in the most recent version of Snipe-IT and reply to this thread to re-open it.
Still an issue!
I've noticed this issue also. When bulk updating assets it is adding the last notes field to the model even though the model already exists. It doesn't seem to matter if I have the "Update Existing Values?" checkbox ticked or not.