Commit graph

230 commits

Author SHA1 Message Date
snipe dc38e575d9 Allow date/time formatting selection in settings 2017-03-03 17:29:41 -08:00
snipe b0f84fa82b Updated migration to fix field names 2017-01-26 04:49:01 -08:00
snipe 19313e4b83 Fixed borked down() method in migration 2017-01-26 04:48:43 -08:00
Daniel Meltzer 5ba2ec881c Vue importer (#3235)
* 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.
2017-01-25 21:29:23 -08:00
snipe dc47a0fad6 Fixes #2551 - use UTF-8 safe slugging for MySQL columns 2017-01-25 18:38:20 -08:00
Daniel Meltzer 0f9e39e4cd Avoid magic numbers in the seeders, instead adjust order of seeding and load relationships directly. (#3224) 2017-01-22 14:57:09 -08:00
Daniel Meltzer a2bf685901 Seeds and tests (#3210)
* Update composer phpcs

* Fix failing model validation in the database seeders.  Should make travis happy.  Also fix a few test issues
2017-01-18 16:50:33 -08:00
Richard Hofman c506f30562 Add support for location-specific LDAP OUs. (#3176)
* Add support for location-specific LDAP OUs.

* Shortened variable names as suggested by Codacy review.
2017-01-11 23:37:14 -08:00
Daniel Meltzer 3a6bbcc615 More improvements (#3116)
* Restore display of deleted items in the logs

* Fix functional tests.
2016-12-30 11:44:47 -08:00
snipe 0581499029 Fixed migration 2016-12-29 17:26:50 -08:00
Daniel Meltzer 165487ac92 Add migration 2016-12-27 22:04:30 -05:00
Daniel Meltzer 323c3807fa Cleanup controller escaping (#3084)
* 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.
2016-12-19 22:00:50 -08:00
Daniel Meltzer cd8c585377 Discussion: Moving to policies for controller based authorization (#3080)
* 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.
2016-12-19 11:04:28 -08:00
snipe ae66bba0f1 Fixes #3015 - increase size of state field in suppliers 2016-12-07 17:50:20 -08:00
Daniel Meltzer b8cbf0022e Log fixes (#2972)
* 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.
2016-11-24 12:48:14 -08:00
Daniel Meltzer ac9fd3b3bb Update LicensesController.php (#2948)
* Update LicensesController.php

Should fix #2939.  Cannot test at the moment, so please check :)

* Add delete tests.  Improve test item generation.

* Add relationship here.

* Fix some issues with seeding.
2016-11-20 19:59:57 -08:00
snipe d8eb68af83 Merge branch 'hotfixes/accessory_model_number' into develop
# Conflicts:
#	resources/views/accessories/edit.blade.php
2016-11-17 20:01:01 -08:00
snipe d0d9d82579 Add model number to accessories 2016-11-17 19:57:53 -08:00
snipe 54848b5edf Added enum conversion 2016-11-17 16:56:08 -08:00
snipe eb4562a28b Add enum conversation
Tho I don’t know why we need this. I don’t see any enums left in the DB structure.
2016-11-17 16:55:22 -08:00
snipe e8f45555ff Make length match validation 2016-11-17 16:18:39 -08:00
snipe 554a6e4fd6 Make length match validation 2016-11-17 16:18:15 -08:00
snipe 7efe3a3207 Merge branch 'hotfixes/state_length' into develop 2016-11-17 16:16:47 -08:00
snipe f77cb3d0f5 Increase DB size of state field in locations 2016-11-17 16:16:33 -08:00
snipe 19592814d9 Merge branch 'hotfixes/purchase_cost_standardized' into develop 2016-11-16 17:35:03 -08:00
snipe 5c70898dbf Derp. Not a string. 2016-11-16 17:32:25 -08:00
snipe 08c7701f17 Make purchase cost longer and more standardized 2016-11-16 17:31:11 -08:00
Daniel Meltzer d722ed3823 Partialize forms (#2884)
* 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.
2016-11-16 16:56:57 -08:00
itsupportcmsukorg 96ad5fb77b Add back forgotten filename to Action Logs with a migration (#2865)
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.
2016-11-02 01:17:42 -07:00
snipe a914dacf8e Adds drawn signature to asset acceptance (#2846)
* 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
2016-10-31 21:00:30 -07:00
itsupportcmsukorg 140bac2b53 Fix missing 'filename' field in asset_log to action_log migration (#2854)
Merging this anyway, to stop the bleeding for new upgraders.
2016-10-31 11:18:48 -07:00
snipe cea255995c Fixes #106 - adds Google Authenticator support (#2842)
* 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
2016-10-29 05:50:55 -07:00
snipe 5a835a5b6e Removed old test DB schema dump 2016-10-27 21:41:27 -07:00
snipe 066d947f1a Fixes #2535 - increased varachar limit to 2048 for serial 2016-10-27 21:39:46 -07:00
snipe a929b635ff Fixes #2809 - adds serial number to components 2016-10-27 15:33:48 -07:00
snipe ccb844acd6 Fixed #2800 - use DBTablePrefix() for raw queries 2016-10-26 11:21:36 -07:00
snipe b839741069 Merge branch 'hotfixes/order_number_numeric' into develop 2016-10-19 15:03:05 -07:00
snipe d7434797ec Change order number to string in components table 2016-10-19 14:59:28 -07:00
snipe 0a0006c68c Fixes #2774 - change order_number to string in components and consumables 2016-10-14 13:12:17 -07:00
Daniel Meltzer 2a95a95e00 Company to logs (#2717)
* 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.
2016-09-29 22:20:49 -07:00
snipe ce1f62b9be Merge branch 'hotfixes/2672' into develop
# Conflicts:
#	app/Http/Controllers/ReportsController.php
2016-09-23 14:12:52 -07:00
snipe 3208522dd1 Fixes #2672 - model_no field updated to be string 2016-09-23 14:10:08 -07:00
snipe 90af734f6b Fix migration from integer to string to handle polymorphic migration 2016-09-20 00:46:14 -07:00
Daniel Meltzer 2d8269ddcd Checkout Improvements, and initial support for requesting an asset model (#2573)
* 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.
2016-09-15 19:58:27 -07:00
snipe 5846f23d8b Fix stupid migration? Maybe? Might be more trouble later 2016-09-14 18:59:14 -07:00
snipe 0a506120b7 Hotfix for dumb enum issue 2016-09-06 20:01:10 -07:00
snipe 0e28f36678 Fixes for weird stupid enum issue 2016-09-06 20:00:37 -07:00
Daniel Meltzer e86adccf19 Actionlog Class: Improvements and polymorphism (#2561)
* 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
2016-09-06 19:39:42 -07:00
snipe 6f89699f1a Make purchase cost default to null
I don’t know why I need to do this?
2016-08-30 08:52:33 -07:00
snipe f04cfb3e7f Allow admins to show status labels in nav 2016-08-23 15:50:52 -07:00
snipe d970daa666 Add new fields to custom fields table 2016-08-23 15:50:43 -07:00
Daniel Meltzer ac63642224 Add manufacturer to licenses (#2436)
* 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.
2016-08-16 18:49:54 -07:00
snipe 1d3255a00b Allow admin to turn LDAP password sync off.
This is added to handle customers/users with a security policy that prohibits third-parties or external databases from storing LDAP passwords.
2016-08-04 14:29:28 -07:00
snipe ca8ca89955 Added custom color to status labels, only show status labels if there are results 2016-08-02 13:25:50 -07:00
snipe 9dda0d02ea Change default zerofill to 5 2016-07-27 21:47:03 -07:00
snipe eb508901c5 Zerofilling for auto-increment 2016-07-27 21:28:00 -07:00
snipe 9a9b214c1d Fixes #2319 2016-07-26 06:07:47 -07:00
snipe b03330aae0 Added TLS option in settings for LDAP 2016-07-22 16:00:37 -07:00
snipe ba25972b49 Add LDAP port number option 2016-07-22 15:09:49 -07:00
snipe a590cc3dd2 One more fix for MAC address weirdness 2016-07-22 05:56:00 -07:00
snipe 094c5ac8df Fixes #2292 2016-07-22 01:16:18 -07:00
snipe 99a42dfc38 More AD fixes 2016-07-14 16:27:32 -07:00
snipe 0cf8ac1d95 Add AD domain to settings 2016-07-14 15:52:52 -07:00
snipe e6b872299d Possible fix for #2246 - needs AD testing 2016-07-13 15:18:29 -07:00
snipe 7a4cbce460 Use trans instead of lang:: 2016-07-10 21:07:59 -07:00
snipe 0cf563ae5b Show admin in maintenances 2016-06-22 17:04:47 -07:00
snipe 57c9d506b8 Fix namespacing for actionlog 2016-06-10 07:57:54 -07:00
snipe 33a35ec7f5 Migration for for email/username format settings 2016-06-01 15:44:37 -07:00
Daniel Meltzer 52b61c9d49 Fix mistake in the settings table kerfuffle. 2016-05-24 17:41:59 -05:00
Daniel Meltzer c52e3b5f9c Check if the column exists before dropping. Also recreate the column in a rollback to make the migrations happy. Also break into two migrations to make sqlite happy. 2016-05-20 10:03:04 -05:00
Daniel Meltzer a6849fc689 Remove stray code from my commit and add a migration to fix the Settings issue the proper way. 2016-05-19 21:52:49 -05:00
snipe 15eb6df1db Add settings for alert interval threshold and inventory threshold 2016-05-19 19:33:53 -07:00
snipe 29e54830e1 Added 2D barcodes to labels 2016-05-19 19:12:42 -07:00
snipe e552c36a0a Add model_no, item_no, and manufacturer to consumables 2016-05-16 17:11:31 -07:00
snipe a726934cde Fixed bulk delete+checkin for users 2016-05-12 21:01:31 -07:00
snipe 7b489ad1ec Ability to suppress users from checkoutable list 2016-04-28 20:19:22 -07:00
snipe 49405b48a3 Reverted name removal for Accessory in factory 2016-04-13 02:19:29 -07:00
snipe e59d19865d Maybe the names are what's breaking it? 2016-04-13 01:58:46 -07:00
snipe 40aac1bf89 Fixed seeds 2016-04-07 17:15:41 -07:00
snipe fe00b0e401 Version 3 - hold onto your butts 2016-03-25 01:18:05 -07:00