Commit graph

35 commits

Author SHA1 Message Date
snipe e4dcd47d6c Fix UTF-8 issues in imports 2016-08-29 22:57:48 -07:00
Daniel Meltzer 276e0a7114 Importer: Implement item update and interface improvments (#2507)
* Add support for updating assets to the importer.

If an asset with a matching asset tag is found, and the --update flag is
passed to the importer, we edit the matching asset with any
asset-specific values, and persist to the database.  Any missing/blank
values are skipped.

TODO: Add to web interface, add support in consumables/accessories

* Allow deleting of files on the import page.

* Extend web interface to allow updating of imported items.

This adds a modal dialog to the import process.  Currently the dialog
allows the choice of update vs ignore, and choosing the item type to
import (Accessory, Asset, Consumable).

Also use Helper::ParseFloat() for purchase_cost processing.  It exists,
and fixes issues on my end at least.

* Implement editing of consumables and accessories.

* Rename getProcessImportFile to postProcessImportFile to reflect how it's now used

* Fix copy-pasta error.
2016-08-29 15:49:32 -07:00
snipe 4cf2d16c7a Temp fix for number import on cost 2016-08-23 19:01:40 -07:00
snipe 6fe639f490 Skip email if no email domain is given 2016-08-02 12:30:02 -07:00
snipe a5467ba25d Slug the username to handle spaces, etc. 2016-08-02 11:12:28 -07:00
snipe 987b969e88 Move bcrypt out of loop for object importer 2016-07-25 22:31:33 -07:00
snipe 52425f62c5 Set default values for status labels in import 2016-07-19 15:49:04 -07:00
Daniel Meltzer 68d8e6a3a9 Importer again (#2260)
* Quote item names when displaying in error table.

* Remove the danger class as well as the warning class when uploading a file.  Fixes a display error if a file is successful after a file fails upload.
2016-07-18 15:46:03 -07:00
snipe 8d71e6b268 Fixed indenting 2016-07-09 18:20:57 -07:00
Daniel Meltzer 25b916afeb Show the name of the item with errors in the table. 2016-06-22 17:09:04 -04:00
snipe 4ed8ff5576 Formatting fixes for coding standards 2016-06-22 12:27:41 -07:00
Daniel Meltzer 43e64a5f8c Store a list of errors associated with each field instead of overwriting the error if multiple occur. Also Adjust the importer to extract the asset tag earlier in the process so all asset related errors are associated with the asset tag rather than some being tied to the name. 2016-06-22 15:13:01 -04:00
snipe 49bf9f8b5b Switch null to lowercase for code style adherence 2016-06-21 11:06:53 -07:00
Daniel Meltzer d6dd449445 Only show importer progress if on command line. It broke error display from web. 2016-06-20 00:09:17 -04:00
Daniel Meltzer 8c00bad6d0 Add a check to ensure custom fields exist before iterating through them 2016-06-20 00:09:17 -04:00
Daniel Meltzer 4715cc6447 Pass user id to importer. This shows items imported through web interface as created by the appropriate user. Also save warranty_months to item, not just read it from csv. Fixes #2175 2016-06-20 00:09:17 -04:00
snipe b4d6842a7c Minor formatting changes, added DB call for custom fields 2016-06-13 21:45:52 -07:00
snipe f3e42384c5 Hardcoded higher PHP execution limits 2016-06-13 21:41:09 -07:00
snipe 6fa4d1252d Fixes purchase date if no purchase date given 2016-06-10 05:00:49 -07:00
Daniel Meltzer da01591ab8 Case insensitive string comparison for items when comparing with existing items. Fixes some false errors. Also remove stray characters from manufacturer logging. 2016-06-01 19:31:24 -05:00
Daniel Meltzer a729038ccd Fix typo. 2016-05-31 19:00:11 -05:00
Daniel Meltzer dab2a50982 Only display errors in import table if things actually prevent the asset from being created. Also some table formatting improvements. 2016-05-31 18:04:01 -05:00
Daniel Meltzer 004c63cd5d Improve web imported. Show a list of all items with that were not imported correctly after import. Modify ObjectImporter and add a web-import parameter that causes it to spit out json errors exclusively. Long term I want to separate the console command and the logic so we aren't calling the console command directly, but rather a class that does everything. This would allow for easier progress reports and ajaxification. 2016-05-26 21:29:29 -05:00
Daniel Meltzer 891c37b2ed Add warranty months. Also fix a merge issue where things reverted back to comment instead of log. 2016-05-25 21:13:26 -05:00
Daniel Meltzer e353df588f Importer improvements. If user real name doesn't exist don't try to create the user. 2016-05-25 20:47:46 -05:00
Daniel Meltzer fd0d04eba4 Import status labels. 2016-05-25 20:46:01 -05:00
Daniel Meltzer 22c6f32e92 Instead of a field in the csv, set whether assets, consumables, or accessories are generated by an option on the command line. Also Adjustconsumables/accessories to function smoother. 2016-05-25 20:37:19 -05:00
Daniel Meltzer 04428d2d07 Replace console output in ObjectImporter with a logging mechanism. Also track all model/validation errors and output them at the end of the import, rather than inline. 2016-05-25 20:37:19 -05:00
Daniel Meltzer 592ce4c2de Readd sample.csv. Also port away from Sentry in the importer to be laravel5 compliant. 2016-05-18 23:33:18 -05:00
Daniel Meltzer 4f70fa88d9 Rename to snipeit:import 2016-05-18 22:40:02 -05:00
Daniel Meltzer 173c3de36a Add the asset to the cache after creating it as well. 2016-05-18 22:40:02 -05:00
Daniel Meltzer 2a56148ec2 Remove extraneuous htmlentities() calls, now that we call it in array_smart_fetch 2016-05-18 22:40:02 -05:00
Daniel Meltzer df749f26f5 Add the company/suppliers to the cache. This fixes some issues with duplicate items existing 2016-05-18 22:40:02 -05:00
Daniel Meltzer 191ae110d0 * Alphabetize the createOrFetch methods
* Move the html escaping to array_smart_fetch to avoid duplication
* Ensure string comparisons have === everywhere
2016-05-18 22:40:02 -05:00
Daniel Meltzer 5821127a79 Update/port ObjectImportComandd to work with v3. Also change to do one big transactional commit instead of writing to db after each item. Went from a 2 minute import to a 5 second import for a 2000 item file. I still need to do some more santization of the input and work on error handling, but this seems to be in decent shape. 2016-05-18 22:40:02 -05:00