add accessories and consumables tables
add selectlist api to:
app\Http\Controllers\Api\AccessoriesController.php
app\Http\Controllers\Api\ConsumablesController.php
app\Http\Controllers\Api\LicensesController.php
templates for selectlist
apply kit to user works
This was mis-migrated as boolean.
It’s essentially a duplicate migration, as it is fixed in-place on the existing migration, and then a new migratio was created to handle anyone who already upgraded.
* Fixed missing oauth tables during setup.
* Custom fields of type "CUSTOM REGEX" are always saved as "ANY"
Fixes#5896
* Updated per PR
Fixed spelling
* Fixed logic error
Moved conditional code from view to controller
Added getFromatType function for dropdown
* Add half-year convention in depreciation for Models/Depreciable.php
* Add a setting for the depreciation method
* Integrate half-year convention inside working output
* fix: add more checks at Depreciable.php
* depreciation value rounding
* Codestyle fix
A checkout acceptance gets generated for every item that needs to be checked out. This resource tracks the user user who can accept the item and their signature
* Added option to include model information on asset labels.
Cleaned up label page to fix skewed label alignment on last row per page.
* Changes made per Snipe's direction
changed type from tinyint to boolean in DB
changed labels back to initials
* Added de-norm counter migration for assets
* Renaming counter columns, since Eloquent has a magical *_count helper
* Added artisan command to sync counters (one-off)
* Update API to use de-normed fields
* Increment counters for checkin;/checkout
* Derp.
* Added request increment/decrementer
* Move increment for checkout to the Asset::checkout method
* Added “could take a while” message
* Fixes CustomFieldsetsController::fields() which I think is not used anywhere else and don't think ever worked as you can't call get() on a Collection.
Have tested extensively and doesn't seem to affect anywhere else?
* Adds default value functionality
* Adds built assets
* Fixes assignment to asset_model_id which should have been evaluation and alters route so it sits more in line with existing work
* Updates built assets
* Remove silly docker.env file; fix Dockerfile to preserve Oauth keys (#5377)
* Added department to custom asset export
Updates build assets
* Adds translation support for 'add default values' checkbox label
* WIP - beginning of improved requested assets
- Use Ajax tables for faster loading
- Use new notifications for requesting an asset
TODO:
- Use ajax tables for requestable asset models
- Use new notifications for canceling an asset request
- Expire requests once the asset has been checked out to the requesting user
* Only show asset name in email if it has one
* Refactor requested method to only include non-canceled requests
* Refactored requestable assets to log request and cancelation
* Added softdeletes on checkout requests
* Differentiate between canceling and deleting requests
* Added asset request cancelation notification
* Added timestamps and corrected unique key on requests table
* Improved requests view
* Re-use blade for cancel/request email
* Refactored BS table formatter for requested assets
* Location name min reduced to 2
* Added PAT test as maintenance option
This needs to be refactored into database-driven options with a UI
* Better slack message
* Added getImageUrl method for assets
* Include qty in request notifications
TODO:
- Try to pull requested info from original request for cancelation, otherwise it will default to 1
* Removed old asset request/cancel emails
* Added user profile asset request routes
* Added profile controller requested assets method
* Added blade link to requested assets for profile view
* Sort user history desc
* Added requested assets blade
* Added canceled at to checkoutRequest method
* Include qty in request
* Fixed comment, removed allowed_columns
* Removed Queable methods, since we don’t use a queue
* Fixed return type in method doc
* Fixed version number
* Changed id to user_id for clarity
* Added “show fields in email” to custom fields
* Added “show images in email” to settings
* Added nicer HTML emails
* Break notifications out into their own, instead of trying to mash them all together
* Remove old notification for accessory checkout
* Janky fix for #5076 - “The asset you have attempted to accept was not checked out to you”
* Add method for image url for accessories
* Added accessory checkout email blade
* Make accessory email notification on checkout screen consistent with assets
* Added native consumables notifications
* Fixes for asset notification
* Updated notification blades with correct-er fields
* Updated notifications
* License checkin notification - does not work yet
Need to figure out whether the license seat is assigned to a person or an asset before we can pass the target
* Added alternate “cc” email for admins
* Only try to trigger notifications if the target is a user
* Fix tests
* Fixed consumable URL
* Removed unused notification
* Pass target type in params
* Show slack status
* Pass additional parameters
There is a logic bug in this :( Will send to slack twice, since the admin CC and the user are both using the same notification. Fuckity fuck fuck fuck.
* Pass a variable to the notification to supress the duplicate slack message
* Slack is broken :( Trying to fix
Will try a git bisect
* Put preview back into checkout
* Pulled old archaic mail
* Removed debugging
* Fixed wrong email title
* Fixed slack endpoint not firing
* Poobot, we hardly knew ye.
* Removed old, manual mail from API
* Typo :-/
* Code cleanup
* Use defined formatted date in JSON
* Use static properties for checkin/checkout notifiers for cleaner code
* Removed debugging
* Use date formatter
* Fixed target_type
* Fixed language in consumable email
* Migration - Labels Display Company Name setting
* Add Company Name to Labels
Add company name if it is turned on in settings and asset has a valid company
* Add Company Name checkbox to Label settings
* Add Company Name Lang
* Add display company name to postLabels
* Revert Add Company Name Lang
* Fix display company name in postLabels
* Change tinyInt to boolean for display company name
* Simplify checking for company and getting the name
* Change to square brackets for array notation
* Move divs inside if statements on optional fields
* Locations API support for image
* Added manufacturers API support for image
* Added manufacturers API support for image
* Added image support for locations add/update
* Added manufacturer image upload support to controller
* General image string
* Added blade support for image uploads/delete image
* Added $request support (from Input::)
* Added image support in API transformers
* Added image to Manufacturers presenter for data table
* Migration to create image fields
* Ignore the contents of the new image directories
* Create new image upload directories
* Created components/consumables uploads directory
* Fixed missing textSearch scope from companies
* Added ignore for companies uploads directory
* Added blade support for image upload
* Fixed path to upload directory on edit
* Added company image upport to transformers, controllers
* Added image support for categories
* Added support for images in Departments
* Added support for image in Consumables
* Added image support for components
* Ignore accesories uploads
* API: Allow searching accessories by supplier id
* Adds suppliers and image upload to accessories
* Allow sorting by counts for suppliers
* Validate supplier image uploads
* Remove purchase_date from protected accessory array, it was converting it to datetime in datepicker
For a while, prior to 987536930, we did not null assigned_type on
checkin. This migration manually nulls all assigned_type fields if
assigned_to is unset. Add a test to AssetTest for this as well...kind
of. We need to extract an Asset::checkin() method for 4.1 that mirrors
Asset::checkOut() to really test this.
This also fixes a separate (but related) issue. The Asset importer did
not set assigned_type when importing and creating users. In this
instance, we assume that if assigned_to is set and assigned_type is not,
then the item was checked out to a user and update the DB accordingly.
Also add a check in ImporterTest for this issue.
* Move importer to an inline-template, allows for translations and easier passing of data from laravel to vue.
* Pull the modal out into a dedicated partial, move importer to views/importer.
* Add document of CSV->importer mappings. Reorganize some code.
Progress.
* Add header_row and first_row to imports table, and process upon uploading a file
* Use an expandable table row instead of a modal for import processing. This should allow for field mapping interaction easier.
* Fix import processing after moving method.
* Frontend importer mapping improvements.
Invert display so we show found columns and allow users to select an
importer field to map to. Also implement sample data based on first row
of csv.
* Update select2. Maintain selected items properly.
* Backend support for importing. Only works on the web importer currently. Definitely needs testing and polish.
* We no longer use vue-modal plugin.
* Add a column to track field mappings to the imports table.
* Cleanup/rename methods+refactor
* Save field mappings and import type when attempting an import, and repopulate these values when returning to the page.
* Update debugbar to fix a bug in the debugbar code.
* Fix asset tag detection.
Also rename findMatch to be a bit clearer as to what it does.
Remove logging to file of imports for http imports because
it eats an incredible amouint of memory.
This commit also moves imports out of the hardware namespace and into
their own webcontroller and route prefix, remove dead code from
AssetController as a result.
* Dynamically limit options for select2 based on import type selected, and group them by item type.
* Add user importer.
Still need to implement emailing of passwords to new users, and probably
test a bit more.
This also bumps the memory limit for web imports up as well, I need to
profile memory usage here before too long.
* Query the db to find user matches rather than search the array. Performance is much much better.
* Speed/memory improvements in importers.
Move to querying the db rather than maintaining an array for all
importers. Also only store the id of items when we import, rather than
the full model. It saves a decent amount of memory.
* Remove grouping of items in select2
With the values being set dynamically, the grouping is redundant. It
also caused a regression with automatically guessing/matching field
names. This is starting to get close.
* Remove debug line on every create.
* Switch migration to be text field instead of json field for compatibility with older mysql/mariadb
* Fix asset import regression matching email address.
* Rearrange travis order in attempt to fix null settings.
* Use auth::id instead of fetching it off the user. Fixes a null object reference during seeding.
This is round one of the rethink of checkout-to-everything. A location
now has a manager field, and the manager (by default) be responsible for
assets checked out to the location.
* Begin work on vueifying the importer
* Beginning work on migrating the importer to use a vue/components for future interactivity
Update JS
More importer work. Move to a vue based modal, begin handling of processing. Still need to port error messages.
More importer work. Move to a vue based modal, begin handling of processing. Still need to port error messages.
Update importer. Add error display. Fix modal, update vue-strap to vue2
More progress. Add select2 vue bits.
* Move to querying the db to find importer matches. It scales better on large datasets.
Fix select2 related issues. We were trying to initialize it twice, which led to the custom data being overwritten.
* Better error handling on uploads and deletion of files. Restore progressbar on upload.
* Add support for generic exception reporting if app.debug is enabled.
* Handle Http 500 errors better. Display errors if debug is enabled. Assorted cleanups.
* Fix codacy issues, remove unused methods.
* Only bind vue to the importer for now.
* Load vue for passport as well.
* Make delete routes work. We put a little form in the modal that spoofs the delete field.
* Fix route on creating a user.
* Fix redundant id parameter.
* Port acceptance tests to new urls.
* Initial work on migrating to model based policies instead of global gates. Will allow for much more detailed permissions bits in the future.
* This needs to stay for the dashboard checks.
* Add user states for permissions to build tests.
* Build up unit tests for gates/permissions. Move accessories/consumables/assets to policies instead of in authserviceprovider
* Migrate various locations to new syntax. Update test to be more specific
* Fix functional tests.
Add an artisan command for installing a settings setup on travis-ci
* Try a different id... Need to come up with a better way of passing the id for tests that need an existing one.
* Try to fix travis
* Update urls to use routes and not hardcode old paths. Also fix some migration errors found along the way.:
* Add a environment for travis functional tests.
* Adjust config file to make travis use it.
* Use redirect()->route instead of redirect()-to
* Dump all failures in the output directory if travis fails.
* Cleanups and minor fixes.
* Adjust the supplier modelfactory to comply with new validation restrictions.
* Some test fixes.
* Locales can be longer than 5 characters according to faker... fex gez_ET. Increase lenght in mysql and add a validation
* Update test database dump to latest migrations.
* Extend Supplier phone/fax length.
This catches issues found in testing with a phone number with a five digit extension. fex (356) 654-3024 x36632
Also move away from escaping all values put into eloquent. Eloquent
already uses PDO parameter binding, and this was leading to names like
Mr Ryan O'Malley turning into an html escaped version of that name when
stored. All values should be escaped when using {{}}, we'll just have
to be more cautious when we use {!!, but I think we already are?
* Remove additional escaping here, like we did in suppliers controller.
* No need to eager load all of these relationships when we can call the count on the querybuilder directly
* Work on controller cleanup
* Always start from scrach, catches more issues this way.
* Update sql dump. Remove old code from permissions test.
* Generate a deletable item on demand in the test, rather than relying on one existing. I think we should probably move to mock all the database stuff at some point..
* More travis related fixes
* Break script into multiple functional lines
* Update all controllers to use the new helper, also cleanup syntax and docblocks along the way.
* Make delete routes work. We put a little form in the modal that spoofs the delete field.
* Fix route on creating a user.
* Fix redundant id parameter.
* Port acceptance tests to new urls.
* Initial work on migrating to model based policies instead of global gates. Will allow for much more detailed permissions bits in the future.
* This needs to stay for the dashboard checks.
* Add user states for permissions to build tests.
* Build up unit tests for gates/permissions. Move accessories/consumables/assets to policies instead of in authserviceprovider
* Migrate various locations to new syntax. Update test to be more specific
* Fix functional tests.
Add an artisan command for installing a settings setup on travis-ci
* Try a different id... Need to come up with a better way of passing the id for tests that need an existing one.
* Try to fix travis
* Update urls to use routes and not hardcode old paths. Also fix some migration errors found along the way.:
* Add a environment for travis functional tests.
* Adjust config file to make travis use it.
* Use redirect()->route instead of redirect()-to
* Dump all failures in the output directory if travis fails.
* Cleanups and minor fixes.
* Adjust the supplier modelfactory to comply with new validation restrictions.
* Some test fixes.
* Locales can be longer than 5 characters according to faker... fex gez_ET. Increase lenght in mysql and add a validation
* Update test database dump to latest migrations.
* Make sure we set target_type when creating an accept asset log, and add a migration to fix older ones.
* On a declined log, we don't have an assigned user.
Guard against this conditional (which realistically should never be hit?)
Should fix#2940
* Fix codacy issues with migration.
* Consolidate edit form elements into reusable partials.
This is a large code change that doesn't do much immediately. It
refactors all of the various edit.blade.php files to reference
standardized partials, so that they all reference the same base html
layout. This has the side effect of moving everything to the new fancy
"required" indicators, and making things look consistent.
In addition, I've gone ahead and renamed a few database fields. We had
Assetmodel::modelno and Consumable::model_no, I've renamed both to
model_number. We had items using ::note and ::notes, I've standardized
on ::notes. Component used total_qty where consumables and accessories
used qty, so I've moved everything to qty (And fixed a few bugs in the
helper file in the process.
TODO includes looking at how/where to place the modal javascripts to
allow for on the fly creation from all places, rather than just the
asset page.
Rename assetmodel::modelno to model_number for clarity and consistency
Rename consumable::model_no to model_number for clarity and consistency
Rename assetmodel::note to notes for clarity and consistency
Port asset and assetmodel to new partials layout. Adapt all code to the renamed model_number and notes database changes. Fix some stying.
* Share a settings variable with all views.
* Allow editing the per_page setting. We showed the value, but we never showed it on the edit page..
* use snipeSettings in all views instead of the long ugly path.
* War on partials. Centralize all bootstrap table javascript
* Use model_number instead of modelno in importer
* Codacy fix.
* More unification/deduplication. Create an edit form template layout that we use as the base for all edit forms. This gives the same interface for editing everything and makes the edit.blade.* files much easier to read.
* Use a ViewComposer instead of sharing the variable directly. Fixes artisan optimize trying to hit the db--which ruins new installs
* Fix DB seeder.
* Base sql dump and csv's to import data from for tests.
* Start some functional tests for creating items.
* Add functional tests for all create methods. Still need to do tests for edits, deletes, and lots of other things
* Improvements to functional tests.
Use the built in DB seeding mechanism instead of doing it ourselves.
Break the tests into multiple units, rather than testing everything in
each function.
* Some improvements to acceptance tests.
Make sure we're only looking at the "trs" within the bootstrap table.
Creation of assets is now tested at the functional level (and is faster)
so ignore it here.
I'm testing acceptance tests with the
IMPORT_{ASSETS,ACCESSORIES,CONSUMABLES}.csv in the tests/_data folder
imported.
* A few things to make acceptance tests work. Add a name to the companies table, and make the locations table have the correct name
* Use a .env.tests file for testing functional and unit to allow a separate database.
* Add functional tests for compoents, groups, and licenses.
* Now that the config is in the functional.yml, this just confuses things.
* Start some functional tests for creating items.
* Add functional tests for all create methods. Still need to do tests for edits, deletes, and lots of other things
* Improvements to functional tests.
Use the built in DB seeding mechanism instead of doing it ourselves.
Break the tests into multiple units, rather than testing everything in
each function.
* Some improvements to acceptance tests.
Make sure we're only looking at the "trs" within the bootstrap table.
Creation of assets is now tested at the functional level (and is faster)
so ignore it here.
I'm testing acceptance tests with the
IMPORT_{ASSETS,ACCESSORIES,CONSUMABLES}.csv in the tests/_data folder
imported.
* update db dump
* Update tests to new reality
* env for the test setup
* only load the database at beginning of tests, not between each Functional test.
* Fix a miss from renaming note to notes.
* Set Termination date when creating an asset. It was only set on edit.
* Rename serial_number to serial in components for consistency.
* Update validation rules to match limits in database. Currently we just accepted the values and they were truncated when adding to DB.
* Much more detailed functional testing of creating items. This checks to make sure all values on form have been successfully persisted to database.
This fixes the issue where the filename wasn't migrated when people who upgraded from 3.4 to 3.5.
This only updates the new log's "filename" field where it's missing a value, so no danger of overwriting anything.
Commit 140bac2 already fixed it for new upgraders (see pull #2854) but didn't help anyone who had already upgraded.
* Adds digital signature to asset acceptance
This is still a little broken - the history is displaying “Deleted user”, since there is no item type listed. Saving the item_type as App\Models\User tries to update accepted on the users table, which obviously doesn’t exist.
* Use asset facade for folks in subdirs
* Possible fix for weird accepted/declined display
* Display signature in modal popup if sigs are required
* Wrap that display file in auth middleware, just to be sure.
It shoudl fail if you’re not authorized since you’re not logged in, but better safe than sorry
* Fixed header section of layout
* Removed extra drop from migration rollback
* refactor to clean up LDAP login, and make the login method easier to handle.
* Login refactor cleanup
* Google 2FA package
* Adds Google Authenticator two-factor
* Removed unused blade
* Added optin setting in profile
* Removed dumb comments
* Made lock_passwords check more consistent
* Additional two factor strings
* Lock passwords check
* Display feature disabled text if in demo mode
* Two factor admin reset options
* Translation strings
* Fix the actionlog/companyables problem by adding a company_id to all actionlogs and scoping directly on that. Works around bugs in laravel where trying to hunt down the polymorphic relationship would lead to an infinite loop
* Scope companyables in getactivityreport. Also eager load.
* Improve reportscontroller, work on seeder to test this.
* Only show company users in checkout dialogs
* If no admin associated with log, it might be a request. Leave blank instead of saying deleted admin
* When injecting company_id, use target instead of user if user is a superadmin
* Build up the seeder to generate users, companies, and logs.
* Eager load the log, don't scope the users log because the log should already include things only related to the user.
* Create a new action_log table to replace asset_log. Use Polymorphism to generalize class and targets. Port everything I can find to use it. Add a migration to port the asset_logs table to action_logs.
* Initial work on requestable asset models
* Backend work for polymorphic requests table to store checkout requests.
* Add missing files
* Add a record to the db when requesting items. Build up a testing route for interfacing with this.
* Users can now toggle requests of items on the request page. Reformat page to use the same tab layout we use elsewhere
* Polymorphic request function. Implement requesting of asset models. Need to port mail/slack to notifications still.
* Implement requesting of asset models. Build up emails and notifications to support it. Allow specifying a quantity of model to request.
* Add view to show currently requested assets. Needs some work and cleanup, but it isn't accessible from anywhere yet.
* Save progress
* Create a new action_log table to replace asset_log. Use Polymorphism to generalize class and targets. Port everything I can find to use it. Add a migration to port the asset_logs table to action_logs.
* Allow accepted_id to be nullable.
* Comment out the thread_id migration, because it b0rks on a new database with the move. I'm unsure if the thread_id does anything...It doesn't seem to be used
* Clean up all old methods from Actionlog model. Port everything to use new cleaner interface.
* Port the actionlog factory to fix travis.
* Adjust code to work on php5. Also fix lurking adminlog call.
* Remove weird code
* Port the pave command. Also fix dangling adminlog
* Add manufacturer to licenses. Shows in table and edit. Need to improve manufacturer view to show lists beyond assets still.
* Remove extra closing tags, formatting
* Work on making the manufacturer view show more options. Need to figure out how to change the table dynamically.
* Cleanup formatting and fix a few weirdities in hardware/view.blade.php
* Standardize on two-space tabs in this file, as it seems the most
* common.
* Fix a few places where we call number_format without guaranteeing the
* item is a number and not a string.
* Show a "No Results" message on components page if there are no
* components.
* Show table of licenses on manufacturer view page.
This reworks the ManufacturersController::getDataView method to delegate
the view to a sub method (currently assets or licenses, but plan to
extend to consumables/accessories/components as well). We then put tabs
at the top of the view to show multiple tables. This just duplicates
the table layout from licenses/index.blade, but I wonder if theres a way
to centralize that code, maybe through partials, over time..
The only known missing part of manufacturers for licenses would be adding it
to the importer, but the license importer should probably migrate to
object importer before doing too much more...
* Add manufacturer to accessory.
* Add consumables to the manufacturer view page.