Compare commits

...

713 Commits

Author SHA1 Message Date
snipe 046ce19dbb Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-06-30 11:46:24 +01:00
snipe ba94f1b920 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2025-06-30 11:45:43 +01:00
snipe edcd46dd67 Updated language strings
Signed-off-by: snipe <snipe@snipe.net>
2025-06-30 11:44:46 +01:00
snipe 5cf6c89dde Merge pull request #17322 from grokability/fixes-#8484-add-supplier-to-license-relationship
Fixed #8484 - added supplier to license relationship
2025-06-30 11:29:07 +01:00
snipe 58676b1f83 Fixed #8484 - added supplier to license relationship
Signed-off-by: snipe <snipe@snipe.net>
2025-06-30 11:27:30 +01:00
snipe 8ff7c30e5a Merge pull request #17315 from grokability/traitify-uploads
Added HasUploads trait and remove uploads method for models
2025-06-27 20:00:28 +01:00
snipe cd989768d4 Added HasUploads trait and remove uploads method for models
Signed-off-by: snipe <snipe@snipe.net>
2025-06-27 19:32:22 +01:00
snipe 33263f5a93 Merge remote-tracking branch 'origin/develop' 2025-06-27 13:52:09 +01:00
snipe 6cbdefe3d9 Small regressions
Signed-off-by: snipe <snipe@snipe.net>
2025-06-27 13:04:02 +01:00
snipe 8ef8e76300 Merge remote-tracking branch 'origin/develop' 2025-06-27 12:48:54 +01:00
snipe c6ecc0d8e8 Merge pull request #17311 from grokability/rwork-bulk-api-to-smaller-pr
Fixed #9413 and rework upload API for bulk and better responses (refactor of #16964)
2025-06-27 12:43:34 +01:00
snipe e0f5663bf4 Requested changes
Signed-off-by: snipe <snipe@snipe.net>
2025-06-27 12:37:11 +01:00
snipe aafc8996c1 phpcbf fixes
Signed-off-by: snipe <snipe@snipe.net>
2025-06-27 12:18:54 +01:00
snipe 128da40cbf Added comments
Signed-off-by: snipe <snipe@snipe.net>
2025-06-27 12:03:12 +01:00
snipe ea0460e97e Remove unused API files controllers
Signed-off-by: snipe <snipe@snipe.net>
2025-06-27 11:51:36 +01:00
snipe d8e7123576 Added uploaded files API controllers and presenters
Signed-off-by: snipe <snipe@snipe.net>
2025-06-27 11:37:31 +01:00
snipe 73cfdae9e7 Merge remote-tracking branch 'origin/develop' 2025-06-25 15:00:46 +01:00
snipe 6f45ec655f Merge pull request #16857 from realchrisolin/generic_tape
Generic tape
2025-06-25 14:59:57 +01:00
snipe 54a3e41281 Merge remote-tracking branch 'origin/develop' 2025-06-25 14:58:46 +01:00
snipe ec17c168ea Merge pull request #17222 from grokability/fixes-#17221-move-table-featueres-into-js
Fixed #17221 - Moved common table elements to partial
2025-06-25 14:52:17 +01:00
snipe 119b097521 More cleanup
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:43:09 +01:00
snipe c731633a84 Fixed weird formatting
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:40:26 +01:00
snipe 6a4d6ade39 Fixed typo
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:39:46 +01:00
snipe b3b4697fc9 More whitespace cleanup
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:38:25 +01:00
snipe 72c706d697 Aaaand one more
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:30:34 +01:00
snipe 8a7af24bd4 More whitespace
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:29:33 +01:00
snipe dd01bd3e5f Cleaned up whitespace
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:29:01 +01:00
snipe 59cade9f82 Cleaned up whitespace
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:28:20 +01:00
snipe 6bb9b79832 Tweaked dashboard
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:11:29 +01:00
snipe f8fe7b5803 Removed whitespace
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:11:19 +01:00
snipe 4d6279d61c Added JS to handle data-dash attribute overrides
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:11:04 +01:00
snipe 5ef581f328 Fixed typo
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 14:10:51 +01:00
snipe d59ba6da84 Merge remote-tracking branch 'origin/develop' 2025-06-25 13:11:39 +01:00
snipe 20a59c343e Merge pull request #17296 from uberbrady/improve_fmcs_locations_test
Fixed #17190 and [FD-49375]: Do FMCS testing 'async' to keep from blowing out the whole settings page
2025-06-25 13:10:54 +01:00
snipe d6feb522b7 Merge pull request #17297 from grokability/fixes-#17259-#15239-external-avatar
Fixed #15239 and #17259 - better handle external avatars
2025-06-25 13:09:33 +01:00
snipe 951aee8292 Fixes #15239 and #17259 - better handle external avatars
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 13:03:51 +01:00
Brady Wetherington 6e2d7912b5 Do the FMCS testing 'async' to keep from blowing out the whole page 2025-06-25 12:59:37 +01:00
snipe 1b28b06934 Merge remote-tracking branch 'origin/develop' 2025-06-25 11:04:15 +01:00
snipe b20925b550 Fixed #17282 - removed erroneous update gate for user-license endpoint
Signed-off-by: snipe <snipe@snipe.net>
2025-06-25 11:03:06 +01:00
snipe 26774b4193 Merge pull request #17287 from uberbrady/limit_license_seat_increments
Fixed [FD-45786] - Limit changing of asset seat count to no more than 10k at a time
2025-06-24 17:43:02 +01:00
Brady Wetherington a7a597d609 Added some tests around license seat changes 2025-06-24 17:35:49 +01:00
snipe 1c12b9278a Merge pull request #17116 from marcusmoore/17065-send-alert-to-assigner-upon-response
Fixed #17065 - allow sending acceptance alert to initiator.
2025-06-24 17:30:47 +01:00
Brady Wetherington de4764bd05 Limit changing of asset seat count to no more than 10k at a time 2025-06-24 13:53:11 +01:00
snipe ff3e69a56c Merge remote-tracking branch 'origin/develop' 2025-06-23 20:51:24 +01:00
snipe c1e7a78d23 Merge pull request #17284 from Godmartinz/fix-depreciation-choice-in-transformer
FIXED: #14869 changes the depreciation method selected for Assets index table
2025-06-23 20:49:25 +01:00
Godfrey M 8894bb91cc fix method choice in asset transformer for depreciations 2025-06-23 12:37:29 -07:00
snipe c955126f01 Merge pull request #17283 from Godmartinz/multiclick_checkout_bug
Fixed #14077: Disables checkout button after submitting
2025-06-23 20:30:38 +01:00
Godfrey M ce53b48d04 disable checkout button after submitting 2025-06-23 12:18:24 -07:00
snipe 6b975a5fb4 Merge remote-tracking branch 'origin/develop' 2025-06-23 16:41:42 +01:00
snipe 6015aeddee Merge pull request #17209 from Godmartinz/saml_xml_update_bug
Fixed #17089: SAML metadata now updating with new XML uploads
2025-06-23 16:40:35 +01:00
snipe 7b04e30964 Merge pull request #17280 from grokability/fixes/#7246-manager-id-in-import
Fixed #7246 - added manager employee/username number to importer
2025-06-23 16:07:14 +01:00
snipe 6794f5e783 Added logging for manager import
Signed-off-by: snipe <snipe@snipe.net>
2025-06-23 15:46:04 +01:00
snipe 6e41ceff39 Fixed parameter order
Signed-off-by: snipe <snipe@snipe.net>
2025-06-23 15:41:56 +01:00
snipe 7ab47ff0de Fixed #7246 - added manager employee number to importer
Signed-off-by: snipe <snipe@snipe.net>
2025-06-23 15:11:57 +01:00
snipe 3a02b15124 Merge remote-tracking branch 'origin/develop' 2025-06-23 12:38:40 +01:00
snipe 92d24d8702 Merge pull request #17277 from grokability/#17264-add-notes-to-bulk
Fixed #17264: add notes to bulk asset edit
2025-06-23 12:36:50 +01:00
snipe bcbfd46682 Update controller
Signed-off-by: snipe <snipe@snipe.net>
2025-06-23 12:32:33 +01:00
snipe bfd96a695f Add notes field and nulling checkbox
Signed-off-by: snipe <snipe@snipe.net>
2025-06-23 12:32:28 +01:00
snipe f27e8534dc Make sure $item exists
Signed-off-by: snipe <snipe@snipe.net>
2025-06-23 12:32:15 +01:00
snipe 040cd7ddbf Updated string to use shorter version
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 20:56:37 +01:00
snipe 5f73d81935 Merge remote-tracking branch 'origin/develop' 2025-06-22 20:14:59 +01:00
snipe 8d6b21a076 Merge pull request #17241 from spencerrlongg/bug/17239-possible-500-when-checking-in-license-assigned-to-a-soft-deleted-user
Fixed #17239 - Add `withTrashed` User Search On License Checkin
2025-06-22 20:14:03 +01:00
snipe 2d36b25017 Merge pull request #17258 from Robert-Azelis/patch-13
Company info - user print assets
2025-06-22 20:13:24 +01:00
snipe 002b5c0f6f Merge remote-tracking branch 'origin/develop' 2025-06-22 20:07:52 +01:00
snipe 1f9e4306ae Fixed #17261 - check for either old or new label engine QR
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 20:07:30 +01:00
snipe 8086842570 Merge remote-tracking branch 'origin/develop' 2025-06-22 19:42:03 +01:00
snipe 5242e0b36e Merge pull request #17270 from grokability/fixes/#17249-order-by-location-in-maintenances
Fixed #17249 - sort by location in asset maintenances
2025-06-22 19:41:14 +01:00
snipe e50505532e Fixes #17249 - sort by location in asset maintenances
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 19:38:39 +01:00
snipe 51f2d5a664 Merge remote-tracking branch 'origin/develop' 2025-06-22 19:30:42 +01:00
snipe f05ef18d55 Merge pull request #17269 from grokability/fixes/#17256-user-eula-view
Fixed #17256: fixed permissions for non-super-admins to view their own EULAs
2025-06-22 19:29:41 +01:00
snipe f6eccd7277 Added profile routes
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 19:25:30 +01:00
snipe 4d1258c64b Fixed downloadformatter
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 19:25:17 +01:00
snipe 103cbfd038 Use profile eula API view
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 19:25:05 +01:00
snipe 47069ad3f4 Added stored eula method on profile
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 19:24:45 +01:00
snipe 317f620992 Added profile controller
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 19:24:19 +01:00
snipe 8f43694582 Added eula download with user check in profile controller
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 19:24:06 +01:00
snipe df30076ffd Update gate for user
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 19:23:50 +01:00
snipe f81750617e Fixed mismatched html header tag
Signed-off-by: snipe <snipe@snipe.net>
2025-06-22 17:30:13 +01:00
Robert-Azelis e4534c4319 Company info - user print assets 2025-06-20 10:33:09 +02:00
snipe d6c09aae6b Updated paveit command to delete by user_id instead of ID
Signed-off-by: snipe <snipe@snipe.net>
2025-06-18 21:15:04 +01:00
spencerrlongg d3d5230d0c add with trashed to user search 2025-06-17 19:15:13 -05:00
Marcus Moore 6f3c5c44a5 Remove assertion 2025-06-17 14:31:14 -07:00
Marcus Moore 67b32ca14d Mail content improvements 2025-06-17 14:22:54 -07:00
Marcus Moore bffaf477ea Method order 2025-06-17 14:22:44 -07:00
Marcus Moore cba45ece12 Add image 2025-06-17 13:57:40 -07:00
Marcus Moore 3290d7f401 Add translations 2025-06-17 13:27:05 -07:00
Marcus Moore ef3827376d Add todo 2025-06-17 13:17:42 -07:00
Marcus Moore 4ae8a91051 Remove unused method 2025-06-17 12:34:43 -07:00
Marcus Moore ff4819ac68 Get licenses working 2025-06-17 12:34:16 -07:00
Marcus Moore 58af133853 Re-add some test cases 2025-06-17 11:51:33 -07:00
Godfrey M 8199cd2118 comment merge methods for now 2025-06-17 10:59:57 -07:00
snipe b74b76de75 Merge remote-tracking branch 'origin/develop' 2025-06-17 18:17:10 +01:00
snipe 9f02b80cf1 Merge pull request #17233 from grokability/fixes-#17232-duplicate-expected-checkin-field
Fixed #17232 - removed duplicate expected_checkin field on asset edit/create
2025-06-17 18:14:36 +01:00
snipe d3e4e81168 Fixed #17232 - removed duplicate expected_checkin field
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 18:08:21 +01:00
snipe a1b1498106 Merge remote-tracking branch 'origin/develop' 2025-06-17 17:51:37 +01:00
snipe 38195c0a8f Merge pull request #17225 from grokability/fixes-ui-issues-in-manager-view
Fixes #17227 and #17228 - UI issues in manager view
2025-06-17 17:28:52 +01:00
snipe 5fa11e4278 Updated language strings
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 16:57:26 +01:00
snipe c39b52fcb5 Move select list closer to the table, removed awkward icon
This makes the view more consistent with the normal layout and removes the CSRF that was being passed in the GET on the form.submit

Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 16:57:17 +01:00
snipe ec65fc1e65 Move manager view option to misc section
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 16:56:56 +01:00
snipe 32d8646d96 Add @lukaskraic as a contributor 2025-06-17 16:26:17 +01:00
snipe e8835fc2b1 Merge pull request #17096 from lukaskraic/feature/manager-view-v2
Manager View Feature
2025-06-17 16:24:40 +01:00
snipe 1158851ea7 Merge remote-tracking branch 'origin/develop' 2025-06-17 15:57:12 +01:00
snipe 054a06c5dc Update resources/lang/en-US/admin/settings/general.php
Co-authored-by: Marcus Moore <contact@marcusmoore.io>
2025-06-17 15:39:26 +01:00
snipe 9c61d2eb22 Removed common elements in tables
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 14:25:02 +01:00
snipe d66b6cfee6 Merge pull request #17220 from grokability/added-advanced-search-to-activity-log
Added advanced search to activity log
2025-06-17 13:24:31 +01:00
snipe 89c0427b2f Added fullscreen option
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 13:24:02 +01:00
snipe 3fec10d447 Added advanced search to activity log
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 13:20:39 +01:00
snipe e1ab9e959e Merge remote-tracking branch 'origin/develop' 2025-06-17 13:03:27 +01:00
snipe f8b4981bfe Merge pull request #17219 from grokability/fixes-#17213-search-by-admin
Fixes #17213:  search by admin (created_by) in activity report
2025-06-17 13:02:51 +01:00
snipe 130669a2f9 Added adminuser relationship in Searchable to concat first name and last name
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 13:01:57 +01:00
snipe c2c79ee231 Make created_by searchable
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 12:56:39 +01:00
snipe 86f10bd702 Added employee number to searchable relation
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 12:56:30 +01:00
snipe 2bbac3ae9d Merge remote-tracking branch 'origin/develop' 2025-06-17 12:38:52 +01:00
snipe b496a06fc0 Merge pull request #17218 from grokability/fixed-#17212-hide-columns-on-print
Fixed #17212 - hide columns from print view
2025-06-17 12:37:43 +01:00
snipe f865a6cb37 Added 'printIgnore' => true, to presenters to hide checkbox and action column from print view
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 12:35:05 +01:00
snipe 89186ea4f8 Merge pull request #17195 from grokability/#17192-fixes-wonky-layout-on-bulk-edit
Fixed #17192 - wonky layout on bulk edit screens
2025-06-17 11:55:31 +01:00
snipe fb19985186 Use the same variable for fieldset closing tag
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 11:52:47 +01:00
snipe e889b1d5e5 Merge remote-tracking branch 'origin/develop' 2025-06-17 11:42:00 +01:00
snipe ebc6e1221a Merge pull request #17198 from akemidx/ghissue-16241
Fixed #16241 - menu items not getting class="active" on click.
2025-06-17 11:40:56 +01:00
snipe 233bf856f4 Merge remote-tracking branch 'origin/develop' 2025-06-17 11:39:12 +01:00
snipe 2b91dcb700 Merge pull request #17216 from grokability/#17215-wrong-logo-check-in-print
Fixed #17215: Check for acceptance logo vs regular logo
2025-06-17 11:38:19 +01:00
snipe 9d2e333fd6 Check for acceptance logo vs regular logo
Signed-off-by: snipe <snipe@snipe.net>
2025-06-17 11:36:10 +01:00
Godfrey M 013ad1069c saving certs sooner in the stack 2025-06-16 16:30:00 -07:00
Godfrey M ec059717f6 adds id to XML textbox, now updates 2025-06-16 16:01:11 -07:00
akemidx 418566db3f fixes the easy ones 2025-06-16 18:41:36 -04:00
snipe bca843e06c Merge remote-tracking branch 'origin/develop' 2025-06-16 20:32:40 +01:00
snipe 7be9463be6 Merge pull request #17180 from grokability/#12653-added-jobtitle-to-asset-listing
Fixed #12653 - added jobtitle to asset listing
2025-06-16 20:29:01 +01:00
snipe 51712bc7d6 Check for whether any of the models have a fieldset
Signed-off-by: snipe <snipe@snipe.net>
2025-06-16 16:40:07 +01:00
snipe 7b889d22d2 Fixed HTML
Signed-off-by: snipe <snipe@snipe.net>
2025-06-16 16:14:01 +01:00
snipe 30a79a1278 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-06-16 14:45:53 +01:00
snipe e8aad989ec Updated translations
Signed-off-by: snipe <snipe@snipe.net>
2025-06-16 14:27:47 +01:00
snipe 4006d64d60 Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2025-06-16 14:25:59 +01:00
snipe d792d99375 Removed stray space for favicon
Signed-off-by: snipe <snipe@snipe.net>
2025-06-15 03:51:50 +01:00
snipe 0f92dee2c4 Merge remote-tracking branch 'origin/develop' 2025-06-15 03:41:23 +01:00
snipe b11036a2e5 Fixed #11977 - changed path in backups language
Signed-off-by: snipe <snipe@snipe.net>
2025-06-15 03:40:54 +01:00
snipe f04efede15 Merge remote-tracking branch 'origin/develop' 2025-06-15 02:59:47 +01:00
snipe 01de69a250 Merge pull request #17181 from grokability/fixed-#14542-missing-fullscreen-in-locations
Fixed #14542 - added fullscreen option for location view tabs
2025-06-15 02:57:51 +01:00
snipe 5e1c2e7feb Fixed #14542 - added fullscreen option for location view tabs
Signed-off-by: snipe <snipe@snipe.net>
2025-06-15 02:56:07 +01:00
snipe b842aa11e5 Remove debugging
Signed-off-by: snipe <snipe@snipe.net>
2025-06-15 02:25:25 +01:00
snipe ff01078b60 Fixed #12653 - adds job title to asset listing
Signed-off-by: snipe <snipe@snipe.net>
2025-06-15 02:23:53 +01:00
snipe f0dfdf6720 Merge remote-tracking branch 'origin/develop' 2025-06-14 23:56:06 +01:00
snipe b1e92293fc Merge pull request #14998 from timoschwarzer/feature/department-manager-in-table
Added #14997: Display department manager in user view and list
2025-06-14 23:51:41 +01:00
snipe 443f69bd82 Merge branch 'develop' into feature/department-manager-in-table 2025-06-14 23:48:52 +01:00
snipe e26d731382 Merge remote-tracking branch 'origin/develop' 2025-06-14 23:08:48 +01:00
snipe f4decbf52e Fixed #15480 - adds location to acceptance email
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 23:08:37 +01:00
snipe d684d3e559 Merge remote-tracking branch 'origin/develop' 2025-06-14 22:22:54 +01:00
snipe bd2c311e4f One more fix to bulk menu
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 22:22:42 +01:00
snipe 2dcab6d0b3 Fixed logic on bulk menu
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 22:21:00 +01:00
snipe c68a97198f Fixes #8212 - force date format for purchase date
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 20:40:15 +01:00
snipe 47c54cb998 Merge remote-tracking branch 'origin/develop' 2025-06-14 17:45:44 +01:00
snipe 2702c3da2b Merge pull request #17178 from grokability/fixes-maintenance-name-on-delete
Fixed #17177 - use maintenance title for delete confirmation
2025-06-14 17:44:21 +01:00
snipe da06e9afd5 Fixes #17177 - undefined title on asset maintenance
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 17:40:14 +01:00
snipe 1623f13539 Merge pull request #17147 from chrisnovakovic/php_upload_limit-hardening
Docker: harden updating of `php.ini` in entrypoint
2025-06-14 17:11:15 +01:00
snipe 592cb2b3ec Merge remote-tracking branch 'origin/develop' 2025-06-14 17:08:11 +01:00
snipe 5910982a4f Merge pull request #17176 from grokability/nicer-bulk-options-for-assets
Add logic around menu options
2025-06-14 17:06:49 +01:00
snipe 74630b36b0 Merge pull request #17175 from grokability/fixes/17172-checkin-date
Fixed #17172 - Better handle checkin date overrides
2025-06-14 17:06:30 +01:00
snipe ace4a5d614 Add logic around menu options
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 17:02:09 +01:00
snipe 0d41947f64 Better handle checkin date overrides
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 16:54:25 +01:00
snipe f5a7871a2e Merge remote-tracking branch 'origin/develop' 2025-06-14 16:44:48 +01:00
snipe 78de3b3591 Merge pull request #17174 from grokability/fixes-17163-permissions-on-maintenances
Fixed #17163 - insufficient permissions on editing an asset maintenance
2025-06-14 16:43:27 +01:00
snipe 0a4a6e7ba3 Removed unusued relationship
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 16:37:44 +01:00
snipe 090399b336 Fixed test
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 16:34:12 +01:00
snipe 47afb15970 Updated HTML
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 16:24:05 +01:00
snipe b1ba3376aa Validation for completion date
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 16:13:57 +01:00
snipe 8c1e19e77c Fixed breadcrumbs
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 15:53:05 +01:00
snipe 0801d1473c Use forem group div
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 14:57:55 +01:00
snipe 6d98878c72 Removed redirect
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 14:31:15 +01:00
snipe 2d404fdadc Fixed breadcrumbs
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 14:30:52 +01:00
snipe b264fde165 Show title if it’s an edit
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 14:30:43 +01:00
snipe 970ff25e5e Added model and company to manufacturer view
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 14:30:27 +01:00
snipe 9dd3eee65c Pull incorrect check for company scoping
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 14:04:09 +01:00
snipe 957faa6651 Fixed datepicker prepopulating with start_date
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 14:03:52 +01:00
snipe cc7dcc6e81 Disallow multiple on editing a maintenance
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 13:39:18 +01:00
snipe ec411fa0db Merge remote-tracking branch 'origin/develop' 2025-06-14 12:17:43 +01:00
snipe f666cba104 Fixed RB-3991 - override route for non-existent fieldset
Signed-off-by: snipe <snipe@snipe.net>
2025-06-14 12:17:31 +01:00
Marcus Moore 7f35498919 Remove some test cases 2025-06-12 15:56:24 -07:00
Marcus Moore 297205ff91 Tests 2025-06-12 15:55:25 -07:00
Marcus Moore 6f99381d13 Handle accessories 2025-06-12 15:49:38 -07:00
Marcus Moore 45a42b00ad Add test 2025-06-12 15:48:48 -07:00
Marcus Moore 6586858284 Scaffold some test cases 2025-06-12 15:31:32 -07:00
Marcus Moore 19cce15e54 Revert "Method signature change"
This reverts commit a60ffc0702.
2025-06-12 13:54:53 -07:00
Marcus Moore 62b8e4c46f Revert "Inline some values"
This reverts commit 74b7d27408.
2025-06-12 13:54:46 -07:00
Marcus Moore 74b7d27408 Inline some values 2025-06-12 13:49:19 -07:00
Marcus Moore a60ffc0702 Method signature change 2025-06-12 13:46:05 -07:00
snipe 9b8524ba27 Merge pull request #17109 from akemidx/bug/sc-28718-2
FIXED: Adding Total to Consumable View Page
2025-06-12 21:44:08 +01:00
Marcus Moore 32526d77b8 Add todo 2025-06-12 13:35:22 -07:00
snipe a850a9bb83 Merge remote-tracking branch 'origin/develop' 2025-06-12 21:34:59 +01:00
snipe ba7db8f7b3 Merge pull request #17092 from Godmartinz/fix-bulk_checkout_undeployable
Adds `hasUndeplyableStatus` check to bulk checkout
2025-06-12 21:29:26 +01:00
snipe 04712ad252 Merge pull request #17151 from Godmartinz/bulk-checkout-add-pending-status
Fixed #17028: Allows bulk editing assets with a status type of pending
2025-06-12 21:27:44 +01:00
Marcus Moore 5711a9e148 Fix test 2025-06-12 13:02:26 -07:00
Marcus Moore a0f40c2dfb Tests 2025-06-12 12:56:24 -07:00
Marcus Moore 34636016eb Improve test 2025-06-12 12:47:03 -07:00
Marcus Moore 95027e329c Formatting 2025-06-12 12:44:29 -07:00
Marcus Moore c9778a73c7 Wire up category controller 2025-06-12 12:32:34 -07:00
Marcus Moore 628d2a0a0a Flesh out mail contents 2025-06-12 12:12:38 -07:00
Marcus Moore cc0ff1ec1f Handle missing recipient 2025-06-12 11:53:30 -07:00
snipe 6543540509 Merge pull request #17166 from Godmartinz/item_name_fix_from_account_eula_table
FIXED: #17136 loads item relation properly in account EULA tab
2025-06-12 11:53:51 +01:00
Marcus Moore cd53fc6318 Scaffold email contents 2025-06-11 16:56:40 -07:00
Godfrey M 4934b6c4da fix query for item relationship to load properly 2025-06-11 11:42:16 -07:00
snipe 479b7a3f94 Merge remote-tracking branch 'origin/develop' 2025-06-11 10:32:49 +01:00
snipe 59db38524b Merge pull request #17094 from spencerrlongg/snipe-it-17051
Fixes #17051 - Nulling Custom Fields In Bulk Asset Updates
2025-06-11 10:31:28 +01:00
snipe 3f5cfc3a4b Merge pull request #17142 from marcusmoore/fixes/present-on-null-in-expected-checkins-notification
Fixed Expected checkin notification erroring on unknown users
2025-06-11 10:27:49 +01:00
snipe 3443f02c0a Merge pull request #17141 from marcusmoore/fixes/undefined-manages_users_count-on-user
Fixed bad method calls in user index api call
2025-06-11 10:26:13 +01:00
snipe 9a012ca01e Merge pull request #17154 from Robert-Azelis/patch-10
Update user print assigned assets
2025-06-11 10:24:50 +01:00
snipe 509ef34cca Merge pull request #17155 from Robert-Azelis/patch-11
Update location print assigned assets
2025-06-11 10:24:29 +01:00
snipe f7cfee77c9 Merge remote-tracking branch 'origin/develop' 2025-06-11 10:20:22 +01:00
snipe 49c289a094 Merge pull request #17158 from grokability/changes-default-history-column-visibility
Changed default visibility on history views
2025-06-11 10:19:33 +01:00
snipe 10e5d88fb6 Changed default visibility on history views
Signed-off-by: snipe <snipe@snipe.net>
2025-06-11 10:16:26 +01:00
snipe ae64fb3fdb Merge pull request #17157 from grokability/fixed-#17138-category-type-case-sensitive
Fixed #17138 - category type was case-sensitive
2025-06-11 10:12:05 +01:00
snipe cac2fde504 Fixed #17138 - category type in category importer is case sensitive
Signed-off-by: snipe <snipe@snipe.net>
2025-06-11 10:08:59 +01:00
snipe bb38a96fd1 Merge pull request #17152 from marcusmoore/fixes/handle-category-missing-upon-checkin
Handle potentially missing category upon checkin
2025-06-11 09:36:50 +01:00
Robert-Azelis 79dbcb10c9 Update location print assigned assets
Lets allow user to select print layout: portrait or landscape
Use dedicated logo for PDF documents: acceptance_pdf_logo
2025-06-11 09:22:13 +02:00
Robert-Azelis 7c80fdea58 Update user print assigned assets
Lets allow user to select print layout: portrait or landscape
Use dedicated logo for PDF documents: acceptance_pdf_logo
2025-06-11 09:19:51 +02:00
Godfrey M 5500a42744 change message from error to warning 2025-06-10 15:10:10 -07:00
Godfrey M ae46264707 removed comment 2025-06-10 15:07:42 -07:00
Godfrey M f2d8665e54 adds tests 2025-06-10 15:07:04 -07:00
Marcus Moore db7110d6b2 Remove test 2025-06-10 10:43:23 -07:00
Marcus Moore 4e06b597fe Handle category missing in Consumable 2025-06-10 10:43:02 -07:00
Godfrey M fe006d05d3 allows to change the status to pending in bulk edit while deployed 2025-06-10 10:41:26 -07:00
Marcus Moore 358b70e280 Handle category missing in Accessory 2025-06-10 10:36:59 -07:00
Marcus Moore a060dde625 Add failing test 2025-06-10 10:34:25 -07:00
Godfrey M 3cfed72af4 removes undeployables from asset_id array 2025-06-10 10:11:00 -07:00
Chris Novakovic 4c59989236 Docker: harden updating of php.ini in entrypoint
The Docker entrypoint scripts set values for the `upload_max_filesize`
and `post_max_size` directives in `php.ini` based on the value of the
`PHP_UPLOAD_LIMIT` environment variable, subject to the following
restrictions:

* Exactly one file matches `/etc/php/*/apache2/php.ini` (on Ubuntu) or
  `/etc/php*/php.ini` (on Alpine) - if, for example, more than one PHP
  package is installed in the base image, `PHP_UPLOAD_LIMIT` will not be
  honoured.
* The `php.ini` file already sets a non-default value for the
  `upload_max_filesize` or `post_max_size` directives - this is
  currently the case for the configurations inherited from upstream, but
  is not guaranteed. If the default values are relied upon,
  `PHP_UPLOAD_LIMIT` will silently not be honoured (although the script
  output will claim that it is).

Iterate over the lines outputted by `file(1)` so `PHP_UPLOAD_LIMIT` is
honoured in all available `php.ini` files, and set `upload_max_filesize`
and `post_max_size` regardless of whether they already have a value set.
2025-06-10 13:39:46 +01:00
Marcus Moore 6c1adff5c8 Extract translation string 2025-06-09 15:33:39 -07:00
Marcus Moore 9293bdca06 Don't render link for Unknown User 2025-06-09 15:32:07 -07:00
Marcus Moore beeccbfb44 Handle unknown users gracefully 2025-06-09 15:30:03 -07:00
Marcus Moore 0d3d2e2e78 Fix keyes 2025-06-09 12:55:38 -07:00
Marcus Moore 2af7605451 Add failing tests 2025-06-09 12:55:09 -07:00
snipe 976cc1c86f Fixed second incorrect string
Signed-off-by: snipe <snipe@snipe.net>
2025-06-09 14:00:47 +01:00
snipe 65a8126a13 Merge remote-tracking branch 'origin/develop' 2025-06-09 13:40:44 +01:00
snipe cbbf3aa6c8 Fixed incorrect translation string
Signed-off-by: snipe <snipe@snipe.net>
2025-06-09 13:40:34 +01:00
snipe a39bc102d5 Merge remote-tracking branch 'origin/develop' 2025-06-08 15:30:32 +01:00
snipe 4f8ff98d5b Merge pull request #17129 from grokability/fixes#17127-added-note-to-eula-api
Fixed #17127 - added note to EULA info
2025-06-08 15:29:47 +01:00
snipe d4fe81c290 Fixed #17127 - added note to EULA info
Signed-off-by: snipe <snipe@snipe.net>
2025-06-08 15:27:50 +01:00
snipe 81d930c4d2 Merge remote-tracking branch 'origin/develop' 2025-06-08 15:19:19 +01:00
snipe cbdf03aa66 Nicer code formatting
Signed-off-by: snipe <snipe@snipe.net>
2025-06-08 15:18:59 +01:00
snipe d756670c56 Check for supplier before trying to show
Signed-off-by: snipe <snipe@snipe.net>
2025-06-08 15:17:24 +01:00
snipe 9ef7b0e64a Fixed missing translation string
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 20:41:36 +01:00
snipe 2d7c0f7e5f Merge pull request #16469 from grokability/fix_action_date
Fixed `action_date` in `action_logs`
2025-06-06 17:18:39 +01:00
snipe ec8ddc197f Merge branch 'develop' into fix_action_date 2025-06-06 17:18:27 +01:00
snipe b48e56bd46 Merge pull request #17110 from Godmartinz/allow-users-to-dl-eula-from-account
Fixed #17084 - Adds Eula table to User account area with download option
2025-06-06 17:07:19 +01:00
snipe 6839623061 Merge remote-tracking branch 'origin/develop' 2025-06-06 17:03:37 +01:00
snipe 753ca93371 Merge pull request #17126 from grokability/fixes-#17023-multi-maintenances
Fixes #17023 - added ability to bulk add maintenances
2025-06-06 17:01:50 +01:00
snipe 04f71e7f6a Shorter syntax
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 16:58:10 +01:00
snipe 5d129dd420 Small form fixes
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 16:56:45 +01:00
snipe 1c37c630aa Fixed test
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 16:26:37 +01:00
snipe d329d6104e Make supplier_id nullable
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 15:55:54 +01:00
snipe 482723f3bc Updated blade to use multiple
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 15:47:07 +01:00
snipe cbc025b1ff Updated save method to save multiple
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 15:46:55 +01:00
snipe bf8ceceabe Add bulk maintenance handler
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 15:42:14 +01:00
snipe fba4bba132 Make supplier not required anymore
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 15:41:41 +01:00
snipe 0ded40c037 Add multiselect to maintenance form
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 15:41:30 +01:00
snipe 6f486a37ff Added maintenance option to bulk menu
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 15:41:02 +01:00
snipe 7de2809d42 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/js/dist/bootstrap-table.js
#	public/mix-manifest.json
2025-06-06 14:05:47 +01:00
snipe 1ef822997b Merge pull request #17125 from grokability/fixed-17117-added-translation
Fixed #17117 - use translation for “site default”
2025-06-06 14:04:08 +01:00
snipe ea66629e98 Fixed #17117 - use translation for “site default”
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 14:03:17 +01:00
snipe 84c9979fe3 Merge pull request #17124 from grokability/add-print-button-to-tables
Added print button to tables
2025-06-06 13:52:22 +01:00
snipe 867a992183 Added print button to tables
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 13:51:12 +01:00
snipe 98ec6b6886 Merge remote-tracking branch 'origin/develop' 2025-06-06 12:48:54 +01:00
snipe c3ad7d649c Merge pull request #17122 from grokability/added_highlighting_to_search
Added highlighting on table search
2025-06-06 12:47:31 +01:00
snipe fc250e228d Added highlighting on table search
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 12:43:47 +01:00
snipe 04827f00cc Merge remote-tracking branch 'origin/develop' 2025-06-06 11:54:10 +01:00
snipe 37e81568ea Merge pull request #17120 from grokability/fixes-11807-datepicker-blade-component
Fixed #11807 - Standardize date-picker
2025-06-06 11:44:54 +01:00
snipe 048d910d5b Use partial
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 11:33:17 +01:00
snipe b162aba445 Added localization for datepicker
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 11:33:02 +01:00
snipe 974627849b Added datepicker partial
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 11:32:47 +01:00
snipe e18e9f699e Use blade component in datepicker partial
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 11:32:37 +01:00
snipe cc9209d2de Removed EOL date and purchase date partials
Signed-off-by: snipe <snipe@snipe.net>
2025-06-06 11:32:13 +01:00
snipe 660bfc6578 Merge remote-tracking branch 'origin/develop' 2025-06-06 08:31:09 +01:00
snipe dd3d264e63 Merge pull request #16675 from Godmartinz/null_location_id_fix
Adds a check for assigned target not being null when creating an asset
2025-06-06 08:30:31 +01:00
snipe 1152cd5537 Merge remote-tracking branch 'origin/develop' 2025-06-06 08:26:52 +01:00
snipe 246f1373a8 Merge pull request #16948 from marcusmoore/bug/sc-29181
Require assigned_x to be integer on asset model
2025-06-06 07:57:20 +01:00
snipe b993f4270e Merge pull request #17114 from grokability/fixes-16934-update-asset-by-id
Fixed #16934 and #17068 - update asset by ID in importer
2025-06-06 07:55:03 +01:00
snipe 6c51ef11b1 Merge pull request #17115 from marcusmoore/17067-limit-cc-if-acceptance-required
Fixed #17067: Allow only sending cc email when acceptance required
2025-06-06 07:41:26 +01:00
Marcus Moore ae98f6276e Replace reject with declined 2025-06-05 17:24:57 -07:00
Marcus Moore 7424a5987b Add subject 2025-06-05 17:22:31 -07:00
Marcus Moore 2d08749207 Improve readability 2025-06-05 16:56:11 -07:00
Marcus Moore db50e98ae3 Populate tests 2025-06-05 16:51:44 -07:00
Marcus Moore 7ec0925c69 Scaffold out tests 2025-06-05 16:44:44 -07:00
Marcus Moore df1361aa43 Scaffold test 2025-06-05 16:42:31 -07:00
akemidx 6db04c86df making fields active. first pass 2025-06-05 18:46:33 -04:00
Marcus Moore bec80b443c WIP: begin to send email 2025-06-05 15:15:22 -07:00
Marcus Moore 333501fe55 WIP: create mail class 2025-06-05 15:07:19 -07:00
Marcus Moore 063553d4f7 Scaffold scenarios 2025-06-05 14:57:15 -07:00
Marcus Moore 19b9e50281 Update livewire component for alert_on_response 2025-06-05 14:40:19 -07:00
Marcus Moore 2a68b4aeff Update test for updating category with alert_on_response 2025-06-05 14:36:06 -07:00
Marcus Moore 5e25150521 Add another test case 2025-06-05 14:26:56 -07:00
Marcus Moore cb183d3645 Store alert_on_response_id on CheckoutAcceptance 2025-06-05 14:06:22 -07:00
Marcus Moore 96bce301a0 Add alert_on_response to Category 2025-06-05 13:43:20 -07:00
Marcus Moore 360f5b7538 Add alert_on_response_id to CheckoutAcceptance 2025-06-05 13:10:18 -07:00
Marcus Moore 77234f6580 Extract translation strings 2025-06-05 12:24:46 -07:00
Marcus Moore 088e6af0b5 Remove admin_cc_email validation for admin_cc_always 2025-06-05 12:07:14 -07:00
Lukas Kraic 16fb1018a2 List users code refactoring 2025-06-05 20:05:38 +02:00
Godfrey M e2e54677ee add auth to api call, gave more specificity to the relationship 2025-06-05 10:59:16 -07:00
Lukas Kraic ad6fe855a9 Fix code style: Change comments 2025-06-05 18:53:36 +02:00
Lukas Kraic c50c97d149 Fix code style: Change comments 2025-06-05 18:18:07 +02:00
Lukas Kraic 8b98ae15f0 Fix code style: Add comment 2025-06-05 18:08:34 +02:00
Lukas Kraic 261f84d5f5 Fix code style: Remove comment 2025-06-05 17:55:46 +02:00
Lukas Kraic 29989ac24e Fix code style: Remove empty line after end comment 2025-06-05 13:50:57 +02:00
snipe 7a93e94fa6 Add ID to field list
Signed-off-by: snipe <snipe@snipe.net>
2025-06-05 12:35:30 +01:00
snipe e33f73fe9f Fixed comment text
Signed-off-by: snipe <snipe@snipe.net>
2025-06-05 11:56:14 +01:00
snipe 6291389df5 Fixed #16934 - update asset by ID in importer
Signed-off-by: snipe <snipe@snipe.net>
2025-06-05 11:53:57 +01:00
snipe ed817dc414 Merge branch 'develop' into snipe-it-17051 2025-06-05 11:37:17 +01:00
Lukas Kraic 7494fa6bc9 Fix code style: Remove unnecessary end comment from short conditional block 2025-06-05 12:03:42 +02:00
Lukas Kraic 62e50dbe52 Fix code style: Add semantically correct end comments 2025-06-05 11:56:13 +02:00
Lukas Kraic 30c090ba2d Fix code style: Add descriptive end comment for conditional block 2025-06-05 11:45:05 +02:00
Lukas Kraic 7ff82e6043 Delete comments 2025-06-05 11:07:42 +02:00
snipe 2950fb1041 Merge pull request #17108 from Godmartinz/clear-buttons-for-custom-fields
Adds a clear button to custom radio buttons in bulk edit
2025-06-05 10:03:27 +01:00
Lukas Kraic 61d3e2fb49 Fix code style: Add required whitespace in end block comments 2025-06-05 09:23:58 +02:00
Lukas Kraic fb18c1a0be Fix code style: Remove whitespace in end block comments 2025-06-05 08:59:07 +02:00
Godfrey M 68c082e0dc fix doc blocks 2025-06-04 15:48:35 -07:00
Godfrey M ee3deb9c63 made eula api route, formatted table, cleaned up code 2025-06-04 15:04:59 -07:00
Marcus Moore c1505de8d6 Update wording 2025-06-04 13:02:04 -07:00
Marcus Moore 10be434c13 Populate tests 2025-06-04 12:58:49 -07:00
Marcus Moore 92e22eead5 Formatting 2025-06-04 12:51:59 -07:00
Marcus Moore 31db86abd3 Simplify test 2025-06-04 12:51:48 -07:00
Marcus Moore 8e70ff135a Scaffold tests 2025-06-04 12:44:55 -07:00
akemidx 5ec52f7471 beginning of everything. tried some stuff but yea. something is up 2025-06-04 15:10:16 -04:00
Marcus Moore 8bc57f98a5 Split test case 2025-06-04 11:51:29 -07:00
Godfrey M 6f4cee6334 adds Eula tab and count to user account 2025-06-04 11:38:50 -07:00
Godfrey M 6beccc5e60 adds clear ability to custom radio buttons 2025-06-04 10:24:45 -07:00
Godfrey M fed8e10644 Merge remote-tracking branch 'upstream/develop' into clear-buttons-for-custom-fields 2025-06-04 10:06:59 -07:00
snipe f30e8497b2 Merge remote-tracking branch 'origin/develop' 2025-06-04 16:17:26 +01:00
snipe 3c0121c1d0 Merge pull request #17107 from grokability/fixes-16218-add-centos
Fixed #16218 - added centos to the switch case
2025-06-04 15:33:23 +01:00
snipe 02021e3fb9 Fixed #16218 - added centos to the switch case
Signed-off-by: snipe <snipe@snipe.net>
2025-06-04 15:27:19 +01:00
Lukas Kraic ea447365fa Fix Codacy warnings II 2025-06-04 15:40:17 +02:00
Lukas Kraic 60989d6766 Fix Codacy warnings 2025-06-04 15:17:55 +02:00
snipe 06495bc45d Merge remote-tracking branch 'origin/develop' 2025-06-04 12:13:30 +01:00
snipe a2960dc653 Merge pull request #17103 from grokability/fixes-17102-add-cc-as-search-string-in-settings
Fixed #17102 - added keywords to admin settings search for notifications
2025-06-04 12:12:17 +01:00
snipe 702499dd79 Fixed #17102 - added keywords to admin settings search for notifications
Signed-off-by: snipe <snipe@snipe.net>
2025-06-04 12:09:57 +01:00
snipe 26067916b3 Merge remote-tracking branch 'origin/develop' 2025-06-04 11:49:03 +01:00
snipe 482c427e34 Merge pull request #17100 from uberbrady/add_deleted_at_index_to_action_logs
Fixed #16205 - Add an index to deleted_at for those with many deleted action_logs
2025-06-04 11:48:45 +01:00
snipe 67910490bd Merge pull request #17101 from grokability/fixes-16157-added-advanced-search-to
Fixed #16157 - Added advanced search to users
2025-06-04 11:48:24 +01:00
snipe fdb5ab2293 Added advanced search to users
Signed-off-by: snipe <snipe@snipe.net>
2025-06-04 11:46:38 +01:00
Brady Wetherington 092d9d1e42 Add deleted_at index to action_logs for people with many deleted action_logs 2025-06-04 11:23:09 +01:00
snipe c36ee4852b Merge remote-tracking branch 'origin/develop' 2025-06-04 10:40:56 +01:00
snipe e657f11531 Merge pull request #17099 from grokability/fixes-16240-localization-strings
Fixed #16240 - made additional strings translatable
2025-06-04 10:40:21 +01:00
snipe 9aac183318 Added aria tag for accessibility
Signed-off-by: snipe <snipe@snipe.net>
2025-06-04 10:40:05 +01:00
snipe c8c2867305 Remove unused translation
Signed-off-by: snipe <snipe@snipe.net>
2025-06-04 10:39:08 +01:00
snipe 3e1f71026c Fixed #16240 - made additional strings translatable
Signed-off-by: snipe <snipe@snipe.net>
2025-06-04 10:37:04 +01:00
snipe 2cb992ad44 Merge remote-tracking branch 'origin/develop' 2025-06-04 08:43:52 +01:00
snipe dc562d8c20 Remove error log
Signed-off-by: snipe <snipe@snipe.net>
2025-06-04 08:43:40 +01:00
Lukas Kraic 84ec5aea26 Manager View Feature 2025-06-04 09:07:26 +02:00
Marcus Moore 444c13c6ea Scaffold template 2025-06-03 17:10:15 -07:00
spencerrlongg 12d5e4f7d2 cleanup and test 2025-06-03 19:07:02 -05:00
spencerrlongg 0fb1639915 this works! 2025-06-03 18:06:41 -05:00
Marcus Moore d01f7cf317 Adhere to admin_cc_always setting 2025-06-03 15:32:11 -07:00
spencerrlongg 03725c8e0c custom field null and filtering 2025-06-03 17:21:07 -05:00
Marcus Moore 3942489d21 Add Test suffix and scaffold test 2025-06-03 14:13:52 -07:00
Marcus Moore 51479c8bbc Scaffold failing test 2025-06-03 13:28:40 -07:00
Marcus Moore ea3364ab68 Split test case 2025-06-03 13:19:44 -07:00
Godfrey M cb608d7fd1 testing buttons out 2025-06-03 11:58:57 -07:00
Godfrey M 7129008428 remove testing changes 2025-06-03 11:44:38 -07:00
Godfrey M 3b832f507f fixes status check for bulk checkout 2025-06-03 11:38:59 -07:00
Godfrey M b5849500f9 add isDeplyable check 2025-06-03 10:49:17 -07:00
snipe 083b7be6c0 Make version number match tagged version :(
Signed-off-by: snipe <snipe@snipe.net>
2025-06-03 11:03:33 +01:00
snipe e24854558f Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-06-03 11:03:05 +01:00
snipe 9eaabf95a0 Make version number match tagged version :(
Signed-off-by: snipe <snipe@snipe.net>
2025-06-03 11:02:41 +01:00
snipe 724f38abc2 Merge pull request #16998 from kovacs-andras/develop
Bumped container image versions
2025-06-03 06:22:08 +01:00
snipe e4314cf426 Merge remote-tracking branch 'origin/develop' 2025-06-03 06:07:20 +01:00
snipe 0dfc083a91 Removed log error
Signed-off-by: snipe <snipe@snipe.net>
2025-06-03 06:07:06 +01:00
snipe 16432f503a Merge pull request #17087 from grokability/#17085-checkin-and-delete-not-nulling-assigned_type
Fixed #17085 - assigned_type not being nulled on asset delete+checkin
2025-06-03 05:53:24 +01:00
snipe 7c9433be5d Added migration to fix existing wonky data
Signed-off-by: snipe <snipe@snipe.net>
2025-06-03 05:37:37 +01:00
snipe e4ce71ff14 Added time on action date
Signed-off-by: snipe <snipe@snipe.net>
2025-06-03 05:30:53 +01:00
snipe 45c6406ff4 Added console command for fixup
Signed-off-by: snipe <snipe@snipe.net>
2025-06-03 05:30:43 +01:00
snipe 550e2b6bb8 Null both assigned to and assigned type on delete
Signed-off-by: snipe <snipe@snipe.net>
2025-06-03 05:30:30 +01:00
snipe a7bb890729 Removed action date from array of things to log
Signed-off-by: snipe <snipe@snipe.net>
2025-06-03 05:29:49 +01:00
snipe 3d8f8faf01 Added action_date
Signed-off-by: snipe <snipe@snipe.net>
2025-06-03 05:28:58 +01:00
snipe 55cf5877c4 Updated tests
Signed-off-by: snipe <snipe@snipe.net>
2025-06-03 05:28:45 +01:00
Marcus Moore dec3c4aff3 Improve wording 2025-06-02 17:45:08 -07:00
Marcus Moore 79e00c1191 Require admin_cc_email if admin_cc_always is true 2025-06-02 17:21:58 -07:00
Marcus Moore 12dc33244d Start storing admin_cc_always 2025-06-02 17:20:01 -07:00
Marcus Moore 6e37f945ac Add test helpers 2025-06-02 17:13:37 -07:00
Marcus Moore d75120000a Add failing tests 2025-06-02 17:11:18 -07:00
Marcus Moore 9e4aab7165 Scaffold tests 2025-06-02 17:05:18 -07:00
Marcus Moore 6bc3209333 Use @checked for inputs 2025-06-02 17:05:00 -07:00
Marcus Moore 054ff42547 Add migration for admin_cc_always 2025-06-02 17:03:14 -07:00
spencerrlongg 11b47b308b front end done, sloppy 2025-06-02 18:39:08 -05:00
Marcus Moore 367ab8ddd5 Add help text 2025-06-02 16:27:04 -07:00
Marcus Moore 4f5d4a0984 Scaffold settings page changes 2025-06-02 16:25:06 -07:00
snipe 4106e4e45c Merge remote-tracking branch 'origin/develop' 2025-06-02 22:29:09 +01:00
snipe 40489c53d6 Merge pull request #17078 from grokability/fixes-#17076-validation-on-bulk-submit
Fixed #17076 - Disable optional status ID form field if value is blank/Do Not Change
2025-06-02 22:28:31 +01:00
snipe 93b760d53b Disable form fields if the value is blank
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 22:16:36 +01:00
snipe 05f143db2b Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-06-02 18:15:54 +01:00
snipe e86996bc7e Bumped version
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 18:15:21 +01:00
snipe 14244f45b6 Duplicates PR #16957
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 18:13:16 +01:00
snipe 1b9d90a322 Added over sixty test
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 17:36:50 +01:00
snipe 64aeaeeeea Merge remote-tracking branch 'origin/develop' 2025-06-02 17:29:52 +01:00
snipe 736f74d083 Merge pull request #17074 from uberbrady/improve_api_rate_limiting
Fix to rate-limiter on higher rate-limits
2025-06-02 17:25:02 +01:00
Brady Wetherington 8194c6efdb Fix to rate-limiter on higher rate-limits 2025-06-02 17:21:14 +01:00
snipe 61db37ab0d Merge remote-tracking branch 'origin/develop' 2025-06-02 15:28:08 +01:00
snipe aae2a17ad1 Add @amedranogil as a contributor 2025-06-02 15:27:55 +01:00
snipe f44150668c Merge pull request #17038 from amedranogil/develop
more robust php.ini update.
2025-06-02 15:27:28 +01:00
snipe 6eed2deb09 Merge pull request #17013 from Robert-Azelis/patch-9
API Models - added requestable for API request
2025-06-02 15:26:08 +01:00
snipe f9c4d921e7 Merge remote-tracking branch 'origin/develop' 2025-06-02 15:07:15 +01:00
snipe 878c6e7031 Merge pull request #17019 from grokability/#15320-status_to_bulk_checkout
Fixed #15320 - added status label to bulk checkout
2025-06-02 15:05:44 +01:00
snipe ca099df573 Merge remote-tracking branch 'origin/develop' 2025-06-02 15:04:00 +01:00
snipe 1f4a73fab6 Merge pull request #17062 from grokability/add_category_importer
Added category importer
2025-06-02 15:03:31 +01:00
snipe 7a315523fe Improved CSV
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 15:01:16 +01:00
snipe 6f082e662b Fixed weird layout
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 14:52:41 +01:00
snipe 018c981c5a Merge pull request #17042 from marcusmoore/chore/replace-customfield-elements-macro-take-two
Replace customfield_elements form macro take two
2025-06-02 10:18:19 +01:00
snipe 0149773a03 Fixed variable name
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 04:14:51 +01:00
snipe 5d46d90725 Added category importer
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 04:11:54 +01:00
snipe 0544e05f32 Merge pull request #17061 from grokability/add_manufacturer_importer
Added manufacturer importer
2025-06-02 03:05:25 +01:00
snipe 80ff42a41f Fixed test
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 03:01:56 +01:00
snipe 90b7df45b9 Added tests and support helper
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 02:55:11 +01:00
snipe 32858b973a Added sample CSV
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 02:55:00 +01:00
snipe 40ba8d0de1 Fixed “send welcome email” detection
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 02:54:34 +01:00
snipe 8ddbb4e64f Added manufacturer factory
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 02:54:21 +01:00
snipe cc40c48aac Added manufacturers import fields
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 02:54:03 +01:00
snipe 522ab9e0f5 Added manufacturer importer
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 02:53:46 +01:00
snipe 97187aa7eb Skip manufacturers on checkout import type
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 02:53:37 +01:00
snipe d93a5aa623 Added redirect after import
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 02:53:09 +01:00
snipe a5b88982bf Added manufacturer icon
Signed-off-by: snipe <snipe@snipe.net>
2025-06-02 02:52:55 +01:00
snipe df71bdcada Merge pull request #17044 from marcusmoore/bug/sc-29302
Handle missing location when rendering labels
2025-06-02 02:21:19 +01:00
snipe 28b584b8bc Merge remote-tracking branch 'origin/develop' 2025-06-02 02:08:19 +01:00
snipe 51bab2dd26 Merge pull request #17045 from grokability/docker-laravel-log-permissions
Docker: Ensure permissions on Laravel log file
2025-05-30 06:52:31 +01:00
Jeremy Price ed8da6ad1b Docker: Ensure permissions on Laravel log file
FIXES: https://github.com/grokability/snipe-it/issues/12725

In some of our Docker startups, it was possible for the Laravel log file
to be created with root permissions, causing future errors when the
non-root webapp tries to write to it.

We'll now always chown (and create, if necessary) the log file to the proper
user after running any artisan commands (as root)

We _could_ run them as the proper user via su, but IMO not doing so keeps the
script easier to read, but I'm not married to the approach. I'd still
want to keep the chown command(s) in, because it will also fix the
permissions for anyone who already has this issue.
2025-05-29 17:45:14 -07:00
Marcus Moore 18d0a04efc Avoid dumping pdf contents to test results 2025-05-29 15:05:08 -07:00
Marcus Moore bb68ed3ad9 Handle asset not having location 2025-05-29 14:49:53 -07:00
Marcus Moore 402ca07aa2 Add failing test 2025-05-29 14:20:15 -07:00
snipe 70449e694d Merge remote-tracking branch 'origin/develop' 2025-05-29 22:18:50 +01:00
snipe 28dc358df1 Merge pull request #17041 from grokability/improve_locations_and_supplier_api
Small refinements for suppliers and locations API and list view
2025-05-29 21:30:54 +01:00
Marcus Moore 3cf1e9d55d Remove customfield_elements macro 2025-05-29 13:30:23 -07:00
Marcus Moore 82b001ab5f Extract translation strings 2025-05-29 13:29:13 -07:00
Marcus Moore 7b272226ce Inline customfield_elements select 2025-05-29 13:29:13 -07:00
snipe 78d26fb7f6 Removed stray character
Typing is hard :(

Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 21:23:50 +01:00
snipe 930842e685 Removed unused method
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 21:18:19 +01:00
snipe b938cb42d8 Merge pull request #17040 from marcusmoore/improve-acceptance-reminder-output
Avoid displaying empty table in `SendAcceptanceReminder` command
2025-05-29 21:14:09 +01:00
snipe 4c7b6d130f Added additional search and display fields for suppliers and locations
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 21:13:08 +01:00
Marcus Moore af57ca4983 Avoid displaying empty table 2025-05-29 11:55:43 -07:00
snipe 40c31a1ad7 Eager load adminuser method
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 17:13:16 +01:00
snipe 7ae4a4177f Added created_by to transformer
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 17:13:05 +01:00
snipe 6efd323fbf Added adminuser method
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 17:12:48 +01:00
snipe ed9dbcc777 Added created_by to location presenter
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 17:12:33 +01:00
snipe c2cf7de41b Use presenter for suppliers
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 17:12:16 +01:00
Alejandro M. Medrano Gil 32bd14bd2d more robust php.ini update.
could solve #10830 when setting PHP_UPLOAD_LIMIT environment variable in docker command and/or docker-compose.
2025-05-29 17:46:23 +02:00
snipe 8395ea552d Merge remote-tracking branch 'origin/develop' 2025-05-29 16:17:58 +01:00
snipe f9cbecdb17 Merge pull request #17037 from grokability/supplier_importer
Added #17036 - suppliers importer
2025-05-29 16:15:59 +01:00
snipe 7bb29a0277 Added sample import CSVs
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 16:08:17 +01:00
snipe d5f7579e9f Added columns to suppliers
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 16:08:01 +01:00
snipe 13fd43c45c Added tests and test support
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 16:07:51 +01:00
snipe c08ce901cc Added strings
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 16:07:19 +01:00
snipe 94bd11d3c9 Added locations and supplier import types
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 16:07:11 +01:00
snipe 59c6e26b29 Fixed mapping
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 16:06:51 +01:00
snipe bf7cc404f8 Set correct redirect
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 15:54:37 +01:00
snipe 12a2c71b90 Added icon
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 14:47:59 +01:00
snipe 6e2eeba0f6 Added supplier importer
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 14:47:54 +01:00
snipe dc66452633 Merge remote-tracking branch 'origin/develop' 2025-05-29 13:32:41 +01:00
snipe 99a739fae3 Merge pull request #17035 from grokability/settings_style_improvements
Fixed #17034 - larger header color box on small views
2025-05-29 13:30:31 +01:00
snipe 0185f61c11 Fixed #17034 - larger header color box on small views
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 13:23:07 +01:00
snipe 783f0c113d Merge pull request #17009 from marcusmoore/chore/replace-user-skin-macro
Replace `skin` and `user_skin` macros with blade component
2025-05-29 13:07:47 +01:00
snipe 75a839cc21 Merge pull request #17010 from marcusmoore/chore/replace-two-factor-select-macro
Replace `two_factor_options` macro
2025-05-29 13:07:23 +01:00
snipe 53ce44ac91 Merge remote-tracking branch 'origin/develop' 2025-05-29 12:38:40 +01:00
snipe 577b5586b4 Merge pull request #17025 from akemidx/clear_button_on_date_picker
FIXED: Clear Button actually Clearing Dates on Date Picker
2025-05-29 12:37:56 +01:00
snipe 1474a16148 Merge pull request #17024 from akemidx/created_at_date_picker
ADDED: Created At date picker on Custom Reports
2025-05-29 12:37:17 +01:00
snipe 9baa2000e1 Merge pull request #17026 from marcusmoore/bug/translate-email-format
Reference correct translation string
2025-05-29 12:36:08 +01:00
snipe c7c3243bbc Merge remote-tracking branch 'origin/develop' 2025-05-29 12:35:21 +01:00
snipe d0624dbefe Merge pull request #17027 from akemidx/bug/sc-29295
FIXED: Translation strings in Username/Email formats
2025-05-29 12:34:47 +01:00
snipe 8bdd77d33d Merge remote-tracking branch 'origin/develop' 2025-05-29 12:24:51 +01:00
snipe ecb6e8d9a9 Fixed route for custom fields index
Signed-off-by: snipe <snipe@snipe.net>
2025-05-29 12:24:22 +01:00
snipe acd7d0db3a Merge remote-tracking branch 'origin/develop' 2025-05-29 12:09:08 +01:00
Robert-Azelis bbb299faf2 Update AssetModelsController.php 2025-05-29 08:42:29 +02:00
snipe ba3b55cab0 Merge pull request #17022 from marcusmoore/bug/sc-29281
Avoid dividing by zero in DefaultLabel
2025-05-29 02:42:41 +01:00
akemidx 67acca7bc8 fixing two translation strings. 2025-05-28 20:21:05 -04:00
Marcus Moore e4b33c3b56 Reference correct translation string 2025-05-28 16:36:39 -07:00
akemidx ed43c73cec clearing the date pickers 2025-05-28 18:48:22 -04:00
akemidx a6fa795b41 clearing the date pickers 2025-05-28 18:48:08 -04:00
akemidx 3a6bac2e63 date picker 2025-05-28 18:43:24 -04:00
akemidx 8e01c05e42 date picker 2025-05-28 18:43:14 -04:00
akemidx fabf9281e9 date picker 2025-05-28 18:35:43 -04:00
Marcus Moore 6588d409b8 Add validation 2025-05-28 14:45:03 -07:00
snipe 92a3421a4e Merge pull request #17020 from akemidx/column_persist_on_assigned_assets
FIXED: Column persist on User's Self View of Assigned Assets
2025-05-28 22:44:36 +01:00
Marcus Moore a42147ff34 Enforce min of .1 for label width and height 2025-05-28 14:05:29 -07:00
Marcus Moore 0df1bc6894 Scaffold test 2025-05-28 14:04:12 -07:00
akemidx 9317076c5e adding cookie for Assigned Assets 2025-05-28 16:39:37 -04:00
snipe 1b5525c51f Added status label to view blade, variable to controller method
Signed-off-by: snipe <snipe@snipe.net>
2025-05-28 20:51:21 +01:00
snipe 6019c80c7b Added blade element
Signed-off-by: snipe <snipe@snipe.net>
2025-05-28 20:50:59 +01:00
Marcus Moore aaa6cb24d4 Scaffold test 2025-05-28 11:28:23 -07:00
snipe 1ef5ad500a Merge pull request #17017 from grokability/localization/translations-2025-05-28
Updated translations
2025-05-28 18:34:15 +01:00
snipe 9468acedfa Updated languages
Signed-off-by: snipe <snipe@snipe.net>
2025-05-28 18:20:02 +01:00
snipe 6a951b6357 Merge pull request #17012 from Robert-Azelis/patch-8
API Locations - added company_id for API request
2025-05-28 15:23:08 +01:00
snipe 2bfadb8a3c Merge remote-tracking branch 'origin/develop' 2025-05-28 15:21:34 +01:00
snipe 95f7742259 Removed extra a href
Signed-off-by: snipe <snipe@snipe.net>
2025-05-28 15:21:23 +01:00
snipe 9f795306e5 Merge pull request #17014 from grokability/fix_breadcrumb_crash
Manually add API headers
2025-05-28 15:19:05 +01:00
snipe 6feaff1e7b Removed blade::render
Signed-off-by: snipe <snipe@snipe.net>
2025-05-28 15:12:14 +01:00
Robert-Azelis 9a168354ae Update AssetModelsController.php - added requestable for API request 2025-05-28 15:50:19 +02:00
Robert-Azelis 309d242c4d Update LocationsController.php - added company_id for API request 2025-05-28 15:45:22 +02:00
snipe 5c174f829e Merge pull request #16986 from grokability/api_throttle_headers
Fixed  #16961 - Manually add API headers
2025-05-28 13:47:16 +01:00
Marcus Moore 3c428f2d7b Inline two_factor_options macro 2025-05-27 16:40:08 -07:00
Marcus Moore 6833716576 Remove skin macro 2025-05-27 16:22:43 -07:00
Marcus Moore bd374d031a Improve component name 2025-05-27 16:22:28 -07:00
Marcus Moore ef26f48f60 Adapt for regular "skin" macro 2025-05-27 16:21:34 -07:00
Marcus Moore b07f8525db Fix swapped yellow/yellow-dark 2025-05-27 16:13:05 -07:00
Marcus Moore 9f062701fa Add semi-colon 2025-05-27 16:03:22 -07:00
Marcus Moore 2c452daddf Replace user_skin macro with blade component 2025-05-27 16:00:47 -07:00
snipe 53a82d3f4d Merge pull request #17007 from marcusmoore/bug/sc-29278
Ensure boolean returned from method with boolean return type
2025-05-27 22:00:04 +02:00
Marcus Moore b5b8816279 Avoid returning null from method that should return a boolean 2025-05-27 11:37:48 -07:00
snipe 7bc4127e8c Removed dupe header
Signed-off-by: snipe <snipe@snipe.net>
2025-05-27 15:01:54 +01:00
snipe 06158cc413 Add timestamp header
Signed-off-by: snipe <snipe@snipe.net>
2025-05-27 14:58:57 +01:00
snipe cb49e7c9a6 Updated comments
Signed-off-by: snipe <snipe@snipe.net>
2025-05-27 14:32:47 +01:00
snipe 1822027a8f Extend the built-in ThrottleRequests middleware from Laravel
Signed-off-by: snipe <snipe@snipe.net>
2025-05-27 14:04:24 +01:00
snipe c8dabc25e3 Added comment
Signed-off-by: snipe <snipe@snipe.net>
2025-05-27 14:03:56 +01:00
snipe f2b10eeee8 Re-do the initial change :(
Signed-off-by: snipe <snipe@snipe.net>
2025-05-27 13:00:32 +01:00
snipe 4b52e1471c Remove unused use statement after refactor
Signed-off-by: snipe <snipe@snipe.net>
2025-05-26 18:45:21 +01:00
snipe f6bba03375 Fixed dupe semicolon
Signed-off-by: snipe <snipe@snipe.net>
2025-05-26 13:50:19 +01:00
snipe b3813a7121 Refactorered limiting headers
Signed-off-by: snipe <snipe@snipe.net>
2025-05-26 13:48:50 +01:00
snipe 0912e4af7b Merge remote-tracking branch 'origin/develop' 2025-05-26 13:17:38 +01:00
snipe eb2a1396ca Merge pull request #16999 from grokability/api_audt_fix
Better messaging when an asset fails validation on quick scan
2025-05-26 14:17:14 +02:00
snipe 0fae18c4ba Better handle missing asset payload because of RMB
Signed-off-by: snipe <snipe@snipe.net>
2025-05-26 13:14:28 +01:00
Andras Kovacs 25ac83e944 Bumped container image versions 2025-05-26 13:07:51 +02:00
snipe a82e65e190 Add @Tinyblargon as a contributor 2025-05-26 11:09:12 +01:00
snipe 187bb90de0 Merge pull request #16993 from Tinyblargon/fix-16992
fix: `PHP_UPLOAD_LIMIT` not set for PHP 8.3
2025-05-26 12:08:36 +02:00
snipe 293648582a Improvements to API headers
Signed-off-by: snipe <snipe@snipe.net>
2025-05-26 10:52:14 +01:00
Tinyblargon 51a306993c fix: PHP_UPLOAD_LIMIT not set for PHP 8.3 2025-05-25 16:23:17 +02:00
snipe 5aa5c48018 Merge remote-tracking branch 'origin/develop' 2025-05-23 19:37:42 +01:00
snipe ec1851fa84 More small carbon fixes
Signed-off-by: snipe <snipe@snipe.net>
2025-05-23 19:27:58 +01:00
snipe bbe748dbd3 Removed noisy log
Signed-off-by: snipe <snipe@snipe.net>
2025-05-23 19:05:39 +01:00
snipe 406e8c5874 Added test
Signed-off-by: snipe <snipe@snipe.net>
2025-05-23 18:25:36 +01:00
snipe a4f71a9f0a Manually add API headers
Signed-off-by: snipe <snipe@snipe.net>
2025-05-23 18:25:29 +01:00
snipe 8cdd998f79 Merge remote-tracking branch 'origin/develop' 2025-05-23 17:35:08 +01:00
snipe 3748498523 Merge pull request #16985 from grokability/move_faker_take_2
Moved faker out of dev reqs for seeding
2025-05-23 18:34:45 +02:00
snipe 49d11103f7 Fixed test namespace
Signed-off-by: snipe <snipe@snipe.net>
2025-05-23 17:28:40 +01:00
snipe dce9060820 Moved faker out of dev reqs for seeding
Signed-off-by: snipe <snipe@snipe.net>
2025-05-23 17:28:00 +01:00
snipe 050d4d6b25 Merge remote-tracking branch 'origin/develop' 2025-05-23 14:51:48 +01:00
snipe 366cd11238 Merge remote-tracking branch 'origin/develop' 2025-05-23 14:31:10 +01:00
snipe 58d6443331 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-05-23 13:27:44 +01:00
snipe 101b8afb56 Merge remote-tracking branch 'origin/develop' 2025-05-23 13:07:47 +01:00
snipe 5df5c47945 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-05-23 10:43:58 +01:00
snipe a04740ba86 Merge remote-tracking branch 'origin/develop' 2025-05-23 10:42:44 +01:00
snipe 425ad93ac5 Merge remote-tracking branch 'origin/develop' 2025-05-23 10:17:10 +01:00
snipe 8a44144c20 Merge pull request #16954 from grokability/develop
Merge dev into master
2025-05-16 11:16:14 +02:00
snipe ee82c70582 Merge remote-tracking branch 'origin/develop' 2025-05-15 18:32:05 +02:00
snipe c87e8e606b Merge remote-tracking branch 'origin/develop' 2025-05-15 18:02:47 +02:00
snipe 37a50dd953 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-05-15 17:51:54 +02:00
snipe a2669a3084 Removed temp code
Signed-off-by: snipe <snipe@snipe.net>
2025-05-15 17:31:16 +02:00
snipe 77da22f4dd Print errors if they exist (temp)
Signed-off-by: snipe <snipe@snipe.net>
2025-05-15 17:26:04 +02:00
snipe 7830ffe202 Temp echo errors
Signed-off-by: snipe <snipe@snipe.net>
2025-05-15 17:24:08 +02:00
snipe 1c9e20d59f Merge remote-tracking branch 'origin/develop' 2025-05-15 17:10:57 +02:00
Marcus Moore 02fa7daa1d Require assigned_x to be integer on asset model 2025-05-14 14:13:07 -07:00
Marcus Moore 2a2acf6d1c Add failing test 2025-05-14 14:09:48 -07:00
snipe 320edac286 Merge remote-tracking branch 'origin/develop' 2025-05-14 17:39:30 +02:00
snipe d49878371d Merge remote-tracking branch 'origin/develop' 2025-05-14 16:23:38 +02:00
snipe d2575a5d9b Add @JassonCordones as a contributor 2025-05-14 15:03:04 +02:00
Marcus Moore ea6cf72580 Formatting 2025-05-14 15:03:04 +02:00
Marcus Moore 2118155b37 Fix bug in getImageUrl method 2025-05-14 15:03:04 +02:00
Marcus Moore ba4f5bb71f Add test for existing functionality 2025-05-14 15:03:04 +02:00
Marcus Moore d5a74a5a8b Remove unneeded div 2025-05-14 15:03:04 +02:00
Marcus Moore 23be1df360 Remove the replaced locales form macro 2025-05-14 15:03:04 +02:00
Marcus Moore b5c1a1da4c Replace Form::locales on user setup 2025-05-14 15:03:04 +02:00
Marcus Moore c11e784f51 Replace Form::locales on bulk edit users page 2025-05-14 15:03:04 +02:00
Marcus Moore 06f51c8f9c Replace Form::locales on user edit page 2025-05-14 15:03:04 +02:00
Marcus Moore 181bcbbda6 Replace Form::locales on localization page 2025-05-14 15:03:04 +02:00
Marcus Moore d008ead6a4 Fix input name 2025-05-14 15:03:04 +02:00
Marcus Moore 75924be958 Introduce locale select component and make replacement on profile page 2025-05-14 15:03:04 +02:00
snipe b1a6e3f8a2 Merge pull request #16930 from JassonCordones/master
fix typo in snipeit.sh
2025-05-14 15:01:41 +02:00
snipe 06712a6041 Merge remote-tracking branch 'origin/develop' 2025-05-14 13:42:51 +02:00
snipe 62b16339a9 Merge remote-tracking branch 'origin/develop' 2025-05-13 20:44:34 +02:00
Jasson 9a2f1a36ba fix typo in snipeit.sh
fix redirect output to stderr
2025-05-13 14:31:37 -04:00
snipe 95cc4d3a73 Merge remote-tracking branch 'origin/develop' 2025-05-09 21:16:58 +01:00
snipe 497eeeb2e0 Merge remote-tracking branch 'origin/develop' 2025-05-09 19:29:01 +01:00
snipe 4be21ca249 Merge remote-tracking branch 'origin/develop' 2025-05-09 18:03:38 +01:00
snipe e8598e214e Merge remote-tracking branch 'origin/develop' 2025-05-09 17:23:22 +01:00
snipe 54b1d65e3c Merge remote-tracking branch 'origin/develop' 2025-05-09 14:46:37 +01:00
snipe f7648496d3 Merge remote-tracking branch 'origin/develop' 2025-05-08 16:26:02 +01:00
snipe 59a57c7197 Merge remote-tracking branch 'origin/develop' 2025-05-08 15:43:53 +01:00
snipe 5659b26827 Merge remote-tracking branch 'origin/develop' 2025-05-08 15:22:43 +01:00
snipe ee4443aaf0 Merge remote-tracking branch 'origin/develop' 2025-05-08 15:09:26 +01:00
snipe 839dcad358 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
#	public/css/dist/skins/_all-skins.css
#	public/css/dist/skins/_all-skins.min.css
#	public/css/dist/skins/skin-black-dark.css
#	public/css/dist/skins/skin-black-dark.min.css
#	public/css/dist/skins/skin-blue-dark.css
#	public/css/dist/skins/skin-blue-dark.min.css
#	public/css/dist/skins/skin-green-dark.css
#	public/css/dist/skins/skin-green-dark.min.css
#	public/css/dist/skins/skin-orange-dark.css
#	public/css/dist/skins/skin-orange-dark.min.css
#	public/css/dist/skins/skin-purple-dark.css
#	public/css/dist/skins/skin-purple-dark.min.css
#	public/css/dist/skins/skin-red-dark.css
#	public/css/dist/skins/skin-red-dark.min.css
#	public/css/dist/skins/skin-yellow-dark.css
#	public/css/dist/skins/skin-yellow-dark.min.css
#	public/mix-manifest.json
2025-05-07 11:41:31 +01:00
snipe d67933ab49 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	.all-contributorsrc
#	CONTRIBUTORS.md
2025-05-06 16:46:41 +01:00
Chris Olin 248a05a916 adds support for continuous 53mm and 0.59in printers 2025-05-06 11:26:52 -04:00
Chris Olin 2c141579dd adds support for GenericTape label printers, includes class for 53mm tape printer 2025-05-06 11:26:40 -04:00
Godfrey M 0eb3f6b952 set max to 5 2025-05-05 14:42:06 +01:00
Godfrey M 68b0f80fce fix input max, and help block position 2025-05-05 14:42:06 +01:00
Godfrey M 93489529a3 adds Field offset option to labels 2025-05-05 14:42:06 +01:00
snipe 511be74e74 Add @chfsx as a contributor 2025-05-05 14:42:06 +01:00
Fabian Schmid bdee067803 [FIX] set upload-limit 2025-05-05 14:42:06 +01:00
snipe 32156cace3 Merge pull request #16847 from realchrisolin/issue16214
add barcode support for Avery 3490
2025-05-05 14:40:54 +01:00
snipe 30688114be Merge remote-tracking branch 'origin/develop' 2025-05-05 14:04:52 +01:00
snipe 34088bcc17 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-05-05 11:17:01 +01:00
Calvin Schwartz 07835766cc adds support for Avery 3490 2025-05-01 21:11:42 -04:00
Brady Wetherington 251851ec6a Try to get Docker images to build for both architectures 2025-04-30 18:00:39 +01:00
snipe 049a669186 Merge remote-tracking branch 'origin/develop' 2025-04-30 16:46:16 +01:00
snipe d29f13bae9 Merge remote-tracking branch 'origin/develop' 2025-04-30 16:26:38 +01:00
snipe c758355df9 Merge remote-tracking branch 'origin/develop' 2025-04-30 16:14:34 +01:00
snipe 79d97a83af Merge remote-tracking branch 'origin/develop' 2025-04-30 15:48:38 +01:00
snipe 85bd47c240 Merge remote-tracking branch 'origin/develop' 2025-04-30 15:35:10 +01:00
snipe 473ead9616 Merge remote-tracking branch 'origin/develop' 2025-04-30 13:57:27 +01:00
snipe cf2850933c Merge remote-tracking branch 'origin/develop' 2025-04-30 10:19:43 +01:00
snipe ff2564c57a Merge remote-tracking branch 'origin/develop' 2025-04-30 10:12:05 +01:00
snipe 91d3848246 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-04-29 23:17:51 +01:00
snipe c031f0b45e Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/dist/skins/_all-skins.css
#	public/css/dist/skins/_all-skins.min.css
#	public/css/dist/skins/skin-blue-dark.css
#	public/css/dist/skins/skin-blue-dark.min.css
#	public/css/dist/skins/skin-green-dark.css
#	public/css/dist/skins/skin-green-dark.min.css
#	public/css/dist/skins/skin-orange-dark.css
#	public/css/dist/skins/skin-orange-dark.min.css
#	public/css/dist/skins/skin-purple-dark.css
#	public/css/dist/skins/skin-purple-dark.min.css
#	public/css/dist/skins/skin-red-dark.css
#	public/css/dist/skins/skin-red-dark.min.css
#	public/css/dist/skins/skin-yellow-dark.css
#	public/css/dist/skins/skin-yellow-dark.min.css
#	public/mix-manifest.json
2025-04-29 20:38:41 +01:00
snipe fdbb9568ae Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
#	public/css/build/app.css
#	public/css/build/overrides.css
#	public/css/dist/all.css
#	public/mix-manifest.json
2025-04-29 12:39:31 +01:00
snipe d817883459 Merge remote-tracking branch 'origin/develop' 2025-04-29 10:25:42 +01:00
snipe 12255979ac Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/build/app.css
#	public/css/dist/all.css
#	public/mix-manifest.json
2025-04-29 10:22:21 +01:00
snipe 366b61850b Merge remote-tracking branch 'origin/develop' 2025-04-26 17:54:02 +01:00
snipe 89be6bd183 Merge remote-tracking branch 'origin/develop' 2025-04-24 14:06:00 +01:00
snipe e120331a2c Merge remote-tracking branch 'origin/develop' 2025-04-24 12:16:53 +01:00
snipe cb8a212d96 Merge remote-tracking branch 'origin/develop' 2025-04-23 21:57:20 +01:00
snipe 7aec431ac5 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>
2025-04-23 21:30:16 +01:00
snipe d19681dea1 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>
2025-04-23 21:05:38 +01:00
snipe bf2299daf8 Merge remote-tracking branch 'origin/develop' 2025-04-22 17:51:48 +01:00
snipe 164930d0dd Merge remote-tracking branch 'origin/develop' 2025-04-22 16:35:23 +01:00
snipe 387dbac809 Merge remote-tracking branch 'origin/develop' 2025-04-22 14:36:14 +01:00
snipe 3b661e5a99 Merge remote-tracking branch 'origin/develop' 2025-04-22 12:39:35 +01:00
snipe 90c1c0e655 Merge remote-tracking branch 'origin/develop' 2025-04-22 11:42:49 +01:00
snipe 21d8e7695b Merge remote-tracking branch 'origin/develop' 2025-04-21 20:19:54 +01:00
snipe 1acc452cfe Merge remote-tracking branch 'origin/develop' 2025-04-21 14:59:26 +01:00
snipe 1375e1feee Merge remote-tracking branch 'origin/develop' 2025-04-21 12:21:08 +01:00
snipe 2187adf59a Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>
2025-04-19 15:34:58 +01:00
snipe 0dcb315d9d Merge remote-tracking branch 'origin/develop' 2025-04-18 00:56:26 +01:00
snipe 327ccbd0c9 Merge remote-tracking branch 'origin/develop' 2025-04-18 00:37:11 +01:00
snipe f571d400e6 Merge remote-tracking branch 'origin/develop' 2025-04-17 23:29:12 +01:00
snipe 293aa52335 Merge remote-tracking branch 'origin/develop' 2025-04-17 23:13:04 +01:00
snipe ca178ae9a7 Merge remote-tracking branch 'origin/develop' 2025-04-17 22:48:35 +01:00
snipe d0c810e418 Merge remote-tracking branch 'origin/develop' 2025-04-17 16:42:37 +01:00
snipe d496d2caeb Merge remote-tracking branch 'origin/develop' 2025-04-17 11:59:24 +01:00
snipe e70b75c350 Merge remote-tracking branch 'origin/develop' 2025-04-17 01:00:34 +01:00
snipe a50befeda5 Merge remote-tracking branch 'origin/develop' 2025-04-16 20:16:18 +01:00
snipe e2616e8039 Merge remote-tracking branch 'origin/develop' 2025-04-16 15:52:18 +01:00
snipe 904266debe Merge remote-tracking branch 'origin/develop' 2025-04-16 09:47:18 +01:00
snipe 72d5783795 Merge remote-tracking branch 'origin/develop' 2025-04-16 09:19:05 +01:00
snipe d699fb1473 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>
2025-04-15 20:46:43 +01:00
snipe fab1a6c33a Merge remote-tracking branch 'origin/develop' 2025-04-15 20:30:02 +01:00
snipe be73c30194 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/build/app.css
#	public/css/build/overrides.css
#	public/css/dist/all.css
#	public/js/dist/bootstrap-table.js
#	public/mix-manifest.json
2025-04-15 20:01:20 +01:00
snipe 451646fe4f Prod assets
Signed-off-by: snipe <snipe@snipe.net>
2025-04-15 19:42:26 +01:00
snipe decc919991 Merge remote-tracking branch 'origin/develop' 2025-04-15 19:33:23 +01:00
snipe e0b4005921 Merge remote-tracking branch 'origin/develop' 2025-04-15 16:48:17 +01:00
snipe 3ef36e7534 Merge remote-tracking branch 'origin/develop' 2025-04-14 11:02:06 +01:00
snipe 1949e1e1e9 Merge remote-tracking branch 'origin/develop' 2025-04-14 09:26:25 +01:00
snipe 3358382358 Comment out location scoping option for now
Signed-off-by: snipe <snipe@snipe.net>
2025-04-09 21:44:38 +01:00
snipe 3eca3ecd75 Merge remote-tracking branch 'origin/develop' 2025-04-09 21:31:41 +01:00
Godfrey M c385b4a082 remove testing lines 2025-04-09 12:11:46 -07:00
Godfrey M 1b961346f0 added withInput to the redirects 2025-04-09 12:11:31 -07:00
Godfrey M 100db23210 add checks that the target is not null, and redirects back with error messages 2025-04-09 11:54:59 -07:00
Godfrey M 3e980a4c57 set location if target is set 2025-04-09 11:11:59 -07:00
Godfrey M 9a3ac41370 add default location as a fallback to asset validation 2025-04-09 11:02:45 -07:00
snipe 140c6b91b0 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/build/app.css
#	public/css/build/overrides.css
#	public/css/dist/all.css
#	public/mix-manifest.json
2025-04-09 02:40:28 +01:00
snipe a5315ec240 Merge remote-tracking branch 'origin/develop' 2025-04-08 08:32:25 +01:00
snipe 93f1656e0b Merge remote-tracking branch 'origin/develop' 2025-04-08 06:51:21 +01:00
snipe f1d006c236 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/build/app.css
#	public/css/build/overrides.css
#	public/css/dist/all.css
#	public/mix-manifest.json
2025-04-08 05:58:51 +01:00
snipe b0b5a96694 Merge remote-tracking branch 'origin/develop' 2025-04-07 13:54:23 +01:00
snipe 7dbe9a85f4 Merge remote-tracking branch 'origin/develop' 2025-04-05 21:02:33 +01:00
snipe d2c39528d5 Merge remote-tracking branch 'origin/develop' 2025-04-05 15:44:22 +01:00
snipe 0420543c94 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/build/app.css
#	public/css/build/overrides.css
#	public/css/dist/all.css
#	public/mix-manifest.json
2025-04-05 14:11:07 +01:00
snipe aae0db902b Merge remote-tracking branch 'origin/develop' 2025-04-03 15:41:08 +01:00
snipe 88dae7cef7 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/build/app.css
#	public/css/build/overrides.css
#	public/css/dist/all.css
#	public/mix-manifest.json
2025-04-03 15:28:10 +01:00
snipe e5cb17e934 Merge remote-tracking branch 'origin/develop' 2025-04-03 10:16:18 +01:00
snipe 9d609805f2 Merge remote-tracking branch 'origin/develop' 2025-04-02 18:33:48 +01:00
snipe e2b9ca8254 Merge remote-tracking branch 'origin/develop' 2025-04-02 14:03:22 +01:00
snipe e16a2fe8af Merge remote-tracking branch 'origin/develop' 2025-04-02 13:51:09 +01:00
snipe 22d61a533d Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-04-02 12:50:35 +01:00
snipe af408bb45f Merge remote-tracking branch 'origin/develop' 2025-04-01 21:33:07 +01:00
snipe 24bfbc06f0 Merge remote-tracking branch 'origin/develop' 2025-04-01 19:40:03 +01:00
snipe 5eb9f353b5 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/dist/all.css
#	public/css/dist/bootstrap-table.css
#	public/js/dist/bootstrap-table.js
#	public/mix-manifest.json
2025-04-01 11:25:33 +01:00
snipe 473ce15f47 Merge pull request #16526 from snipe/develop
Merge #16486  and #16519 into master
2025-03-19 15:31:50 -01:00
snipe eb9cfbaed6 Merge pull request #16498 from snipe/develop
Merge develop into master
2025-03-12 23:23:44 +00:00
snipe faeb037ff9 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/build/app.css
#	public/css/build/overrides.css
#	public/css/dist/all.css
#	public/js/build/app.js
#	public/js/dist/all.js
#	public/mix-manifest.json
2025-03-12 21:26:34 +00:00
snipe 07602f697d Merge remote-tracking branch 'origin/develop' 2025-03-12 18:13:22 +00:00
snipe 11abb0fdb1 Merge remote-tracking branch 'origin/develop' 2025-03-11 22:13:34 +00:00
snipe deeb2fa543 Merge remote-tracking branch 'origin/develop' 2025-03-11 21:14:12 +00:00
snipe 0b48fd1465 Removed extra headers
Signed-off-by: snipe <snipe@snipe.net>
2025-03-10 13:05:31 +00:00
snipe 220537fbfb Updated presenter name
Signed-off-by: snipe <snipe@snipe.net>
2025-03-10 12:59:57 +00:00
snipe df5437647b Add optional serial value in presenter
Signed-off-by: snipe <snipe@snipe.net>
2025-03-10 12:43:38 +00:00
snipe 92b2da9b1b Added history tab to components
Signed-off-by: snipe <snipe@snipe.net>
2025-03-10 11:48:38 +00:00
snipe ef56177372 Use presenter
Signed-off-by: snipe <snipe@snipe.net>
2025-03-10 11:48:31 +00:00
snipe cb7822576f Use new presenters
Signed-off-by: snipe <snipe@snipe.net>
2025-03-10 11:48:19 +00:00
snipe 7ba361b10d Use date formatter for filestable
Signed-off-by: snipe <snipe@snipe.net>
2025-03-10 10:57:54 +00:00
snipe 55694fa2fc Added strings
Signed-off-by: snipe <snipe@snipe.net>
2025-03-10 10:57:40 +00:00
snipe c825878c46 Added history presenter
Signed-off-by: snipe <snipe@snipe.net>
2025-03-10 10:57:33 +00:00
snipe 80a69bfe90 Revert datetime to date
Signed-off-by: snipe <snipe@snipe.net>
2025-03-06 18:09:27 +00:00
snipe d4dc8d2b79 Remove action_date from loggable as a changed field
Signed-off-by: snipe <snipe@snipe.net>
2025-03-06 17:43:07 +00:00
snipe 4e3df93349 Change action_date display to date from datetime
Signed-off-by: snipe <snipe@snipe.net>
2025-03-06 16:16:17 +00:00
snipe 38efc62900 Add index on action_date, copy from created_at
Signed-off-by: snipe <snipe@snipe.net>
2025-03-06 16:01:46 +00:00
snipe ef8d5ff11e Merge remote-tracking branch 'origin/develop' 2025-03-06 12:06:10 +00:00
snipe 91f3e07b83 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-03-05 17:05:28 +00:00
snipe c29bdbdacb Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/dist/skins/_all-skins.css
#	public/css/dist/skins/_all-skins.min.css
#	public/css/dist/skins/skin-blue.css
#	public/css/dist/skins/skin-blue.min.css
#	public/mix-manifest.json
2025-03-05 13:46:29 +00:00
snipe a20d104d2f Merge remote-tracking branch 'origin/develop' 2025-03-05 11:59:47 +00:00
snipe a61dd8ac17 Merge remote-tracking branch 'origin/develop' 2025-03-05 10:52:42 +00:00
snipe 7ee9a690ea Merge remote-tracking branch 'origin/develop' 2025-03-05 01:12:22 +00:00
snipe 5ba94c6c41 Merge remote-tracking branch 'origin/develop' 2025-03-05 00:12:09 +00:00
snipe 9fa855c837 Prod assets
Signed-off-by: snipe <snipe@snipe.net>
2025-03-04 23:30:45 +00:00
snipe 9251007574 Merge remote-tracking branch 'origin/develop' 2025-03-04 23:29:31 +00:00
snipe cc73b984cb Merge remote-tracking branch 'origin/develop' 2025-03-04 21:13:43 +00:00
snipe 548ef97c32 Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-03-04 19:57:33 +00:00
snipe ed8a486726 Merge remote-tracking branch 'origin/develop' 2025-03-04 19:54:08 +00:00
snipe 1ab0911fc8 Merge remote-tracking branch 'origin/develop' 2025-03-04 19:52:16 +00:00
snipe bdbaea7294 Merge remote-tracking branch 'origin/develop' 2025-03-04 19:43:28 +00:00
snipe 5cfd1f6fb2 Merge remote-tracking branch 'origin/develop' 2025-03-04 17:16:26 +00:00
snipe 5eda67381f Merge remote-tracking branch 'origin/develop' 2025-03-04 17:07:13 +00:00
snipe 2c8b8bfaf2 Merge remote-tracking branch 'origin/develop' 2025-03-04 17:05:55 +00:00
snipe 8f3159751a Merge remote-tracking branch 'origin/develop' 2025-03-04 17:01:07 +00:00
snipe 4b05e55b29 Merge remote-tracking branch 'origin/develop' 2025-03-04 15:56:05 +00:00
snipe 3d3c13fcd0 Merge remote-tracking branch 'origin/develop' 2025-03-04 15:38:58 +00:00
snipe 88e1d8a8cf Merge remote-tracking branch 'origin/develop' 2025-03-04 15:28:53 +00:00
snipe e007db34e2 Merge remote-tracking branch 'origin/develop' 2025-03-03 22:12:26 +00:00
snipe f9f06d2c02 Merge remote-tracking branch 'origin/develop' 2025-02-27 19:08:45 +00:00
snipe 234f7d00c8 Merge remote-tracking branch 'origin/develop' 2025-02-27 16:18:18 +00:00
snipe 9924553da5 Merge remote-tracking branch 'origin/develop' 2025-02-27 15:45:57 +00:00
snipe df38d7e3ed Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	config/version.php
2025-02-27 12:22:30 +00:00
snipe 44dd061619 Merge remote-tracking branch 'origin/develop' 2025-02-26 20:55:57 +00:00
snipe 7603a932b1 Merge remote-tracking branch 'origin/develop' 2025-02-26 20:29:42 +00:00
snipe 138e7acc13 Merge remote-tracking branch 'origin/develop' 2025-02-26 12:47:54 +00:00
snipe e863d3e7e5 Merge remote-tracking branch 'origin/develop' 2025-02-26 12:02:00 +00:00
snipe c8e401f5ed Merge remote-tracking branch 'origin/develop' 2025-02-26 11:59:53 +00:00
snipe 3ba20a8e28 Merge remote-tracking branch 'origin/develop' 2025-02-26 11:39:10 +00:00
snipe ebae63752f Merge remote-tracking branch 'origin/develop' 2025-02-26 10:25:18 +00:00
snipe 8bc73901cf Merge remote-tracking branch 'origin/develop' 2025-02-26 08:25:35 +00:00
snipe b4f70d9244 Merge remote-tracking branch 'origin/develop' 2025-02-26 07:16:59 +00:00
snipe 21e9f2bba3 Merge remote-tracking branch 'origin/develop' 2025-02-26 07:11:22 +00:00
snipe 881f4e3d6a Merge remote-tracking branch 'origin/develop' 2025-02-25 14:43:57 +00:00
snipe b141945add Updated branch
Signed-off-by: snipe <snipe@snipe.net>
2025-02-25 12:18:52 +00:00
Timo Schwarzer a2ff8f9609 Add Department Manager to single and multiple user views 2024-07-15 12:27:29 +02:00
1436 changed files with 25018 additions and 280353 deletions
+27
View File
@@ -4162,6 +4162,33 @@
"contributions": [
"code"
]
},
{
"login": "Tinyblargon",
"name": "Okean",
"avatar_url": "https://avatars.githubusercontent.com/u/76069640?v=4",
"profile": "https://github.com/Tinyblargon",
"contributions": [
"code"
]
},
{
"login": "amedranogil",
"name": "Alejandro Medrano",
"avatar_url": "https://avatars.githubusercontent.com/u/6515064?v=4",
"profile": "https://www.lst.tfo.upm.es/alejandro-medrano/",
"contributions": [
"code"
]
},
{
"login": "lukaskraic",
"name": "Lukas Kraic",
"avatar_url": "https://avatars.githubusercontent.com/u/58696401?v=4",
"profile": "https://github.com/lukaskraic",
"contributions": [
"code"
]
}
]
}
+1 -1
View File
@@ -67,7 +67,7 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken
| [<img src="https://avatars.githubusercontent.com/u/80526133?v=4" width="110px;"/><br /><sub>AlexanderWPapyrus</sub>](https://github.com/AlexanderWPapyrus)<br />[💻](https://github.com/snipe/snipe-it/commits?author=AlexanderWPapyrus "Code") | [<img src="https://avatars.githubusercontent.com/u/306231?v=4" width="110px;"/><br /><sub>Alexandr Hacicheant</sub>](https://github.com/disc)<br />[💻](https://github.com/snipe/snipe-it/commits?author=disc "Code") | [<img src="https://avatars.githubusercontent.com/u/3032891?v=4" width="110px;"/><br /><sub>Hex</sub>](https://hex128.io/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=hex128 "Code") | [<img src="https://avatars.githubusercontent.com/u/8697942?v=4" width="110px;"/><br /><sub>Arunas Skirius</sub>](https://github.com/arukompas)<br />[💻](https://github.com/snipe/snipe-it/commits?author=arukompas "Code") | [<img src="https://avatars.githubusercontent.com/u/104396?v=4" width="110px;"/><br /><sub>Ben Periton</sub>](https://github.com/benperiton)<br />[💻](https://github.com/snipe/snipe-it/commits?author=benperiton "Code") | [<img src="https://avatars.githubusercontent.com/u/11906832?v=4" width="110px;"/><br /><sub>Byron Wolfman</sub>](https://wolfman.dev/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=byronwolfman "Code") | [<img src="https://avatars.githubusercontent.com/u/56485508?v=4" width="110px;"/><br /><sub>Calvin</sub>](https://github.com/CalvinSchwartz)<br />[💻](https://github.com/snipe/snipe-it/commits?author=CalvinSchwartz "Code") |
| [<img src="https://avatars.githubusercontent.com/u/181059?v=4" width="110px;"/><br /><sub>Juan Font</sub>](https://github.com/juanfont)<br />[💻](https://github.com/snipe/snipe-it/commits?author=juanfont "Code") | [<img src="https://avatars.githubusercontent.com/u/13137708?v=4" width="110px;"/><br /><sub>Juho Taipale</sub>](https://github.com/juhotaipale)<br />[💻](https://github.com/snipe/snipe-it/commits?author=juhotaipale "Code") | [<img src="https://avatars.githubusercontent.com/u/1007419?v=4" width="110px;"/><br /><sub>Korvin Szanto</sub>](https://github.com/KorvinSzanto)<br />[💻](https://github.com/snipe/snipe-it/commits?author=KorvinSzanto "Code") | [<img src="https://avatars.githubusercontent.com/u/8513053?v=4" width="110px;"/><br /><sub>Lewis Foster</sub>](https://lewisfoster.foo/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=sniff122 "Code") | [<img src="https://avatars.githubusercontent.com/u/33877541?v=4" width="110px;"/><br /><sub>Logan Swartzendruber</sub>](https://github.com/loganswartz)<br />[💻](https://github.com/snipe/snipe-it/commits?author=loganswartz "Code") | [<img src="https://avatars.githubusercontent.com/u/1156208?v=4" width="110px;"/><br /><sub>Lorenzo P.</sub>](https://github.com/lopezio)<br />[💻](https://github.com/snipe/snipe-it/commits?author=lopezio "Code") | [<img src="https://avatars.githubusercontent.com/u/33946590?v=4" width="110px;"/><br /><sub>Lukas Jung</sub>](https://github.com/m4us1ne)<br />[💻](https://github.com/snipe/snipe-it/commits?author=m4us1ne "Code") |
| [<img src="https://avatars.githubusercontent.com/u/10965027?v=4" width="110px;"/><br /><sub>Ellie</sub>](https://leafedfox.xyz/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=LeafedFox "Code") | [<img src="https://avatars.githubusercontent.com/u/20960555?v=4" width="110px;"/><br /><sub>GA Stamper</sub>](https://github.com/gastamper)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gastamper "Code") | [<img src="https://avatars.githubusercontent.com/u/206553556?v=4" width="110px;"/><br /><sub>Guillaume Lefranc</sub>](https://github.com/gl-pup)<br />[💻](https://github.com/snipe/snipe-it/commits?author=gl-pup "Code") | [<img src="https://avatars.githubusercontent.com/u/733892?v=4" width="110px;"/><br /><sub>Hajo Möller</sub>](https://github.com/dasjoe)<br />[💻](https://github.com/snipe/snipe-it/commits?author=dasjoe "Code") | [<img src="https://avatars.githubusercontent.com/u/3420063?v=4" width="110px;"/><br /><sub>Istvan Basa</sub>](https://github.com/pottom)<br />[💻](https://github.com/snipe/snipe-it/commits?author=pottom "Code") | [<img src="https://avatars.githubusercontent.com/u/810824?v=4" width="110px;"/><br /><sub>JJ Asghar</sub>](https://jjasghar.github.io/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jjasghar "Code") | [<img src="https://avatars.githubusercontent.com/u/40404495?v=4" width="110px;"/><br /><sub>James E. Msenga</sub>](https://github.com/JemCdo)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JemCdo "Code") |
| [<img src="https://avatars.githubusercontent.com/u/6865786?v=4" width="110px;"/><br /><sub>Jan Felix Wiebe</sub>](https://github.com/jfwiebe)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jfwiebe "Code") | [<img src="https://avatars.githubusercontent.com/u/43412008?v=4" width="110px;"/><br /><sub>Jo Drexl</sub>](https://www.nfon.com/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=drexljo "Code") | [<img src="https://avatars.githubusercontent.com/u/4807843?v=4" width="110px;"/><br /><sub>Austin Sasko</sub>](https://github.com/austinsasko)<br />[💻](https://github.com/snipe/snipe-it/commits?author=austinsasko "Code") | [<img src="https://avatars.githubusercontent.com/u/4875039?v=4" width="110px;"/><br /><sub>Jasson</sub>](http://jassoncordones.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JassonCordones "Code") |
| [<img src="https://avatars.githubusercontent.com/u/6865786?v=4" width="110px;"/><br /><sub>Jan Felix Wiebe</sub>](https://github.com/jfwiebe)<br />[💻](https://github.com/snipe/snipe-it/commits?author=jfwiebe "Code") | [<img src="https://avatars.githubusercontent.com/u/43412008?v=4" width="110px;"/><br /><sub>Jo Drexl</sub>](https://www.nfon.com/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=drexljo "Code") | [<img src="https://avatars.githubusercontent.com/u/4807843?v=4" width="110px;"/><br /><sub>Austin Sasko</sub>](https://github.com/austinsasko)<br />[💻](https://github.com/snipe/snipe-it/commits?author=austinsasko "Code") | [<img src="https://avatars.githubusercontent.com/u/4875039?v=4" width="110px;"/><br /><sub>Jasson</sub>](http://jassoncordones.github.io)<br />[💻](https://github.com/snipe/snipe-it/commits?author=JassonCordones "Code") | [<img src="https://avatars.githubusercontent.com/u/76069640?v=4" width="110px;"/><br /><sub>Okean</sub>](https://github.com/Tinyblargon)<br />[💻](https://github.com/snipe/snipe-it/commits?author=Tinyblargon "Code") | [<img src="https://avatars.githubusercontent.com/u/6515064?v=4" width="110px;"/><br /><sub>Alejandro Medrano</sub>](https://www.lst.tfo.upm.es/alejandro-medrano/)<br />[💻](https://github.com/snipe/snipe-it/commits?author=amedranogil "Code") | [<img src="https://avatars.githubusercontent.com/u/58696401?v=4" width="110px;"/><br /><sub>Lukas Kraic</sub>](https://github.com/lukaskraic)<br />[💻](https://github.com/snipe/snipe-it/commits?author=lukaskraic "Code") |
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
@@ -0,0 +1,32 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class FixUpAssignedTypeWithoutAssignedTo extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'snipeit:assigned-type-fixup';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Fixes up assets that have an assigned_type but no assigned_to';
/**
* Execute the console command.
*/
public function handle()
{
DB::table('assets')->whereNotNull('assigned_type')->whereNull('assigned_to')->update(['assigned_type' => null]);
$this->info("Assets with an assigned_type but no assigned_to are fixed");
}
}
+5 -5
View File
@@ -4,7 +4,7 @@ namespace App\Console\Commands;
use App\Models\Asset;
use App\Models\CustomField;
use Schema;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use Illuminate\Console\Command;
@@ -66,8 +66,8 @@ class PaveIt extends Command
foreach ($custom_fields as $custom_field) {
$this->info('DROP the '.$custom_field->db_column.' column from assets as well.');
if (\Schema::hasColumn('assets', $custom_field->db_column)) {
\Schema::table('assets', function ($table) use ($custom_field) {
if (Schema::hasColumn('assets', $custom_field->db_column)) {
Schema::table('assets', function ($table) use ($custom_field) {
$table->dropColumn($custom_field->db_column);
});
}
@@ -84,8 +84,8 @@ class PaveIt extends Command
}
// Leave in the demo oauth keys so we don't have to reset them every day in the demos
\DB::statement('delete from oauth_clients WHERE id > 2');
\DB::statement('delete from oauth_access_tokens WHERE id > 2');
DB::statement('delete from oauth_clients WHERE id > 2');
DB::statement('delete from oauth_access_tokens WHERE user_id > 2');
}
}
@@ -99,8 +99,11 @@ class SendAcceptanceReminder extends Command
foreach ($no_email_list as $user) {
$rows[] = [$user['id'], $user['name']];
}
$this->info("The following users do not have an email address:");
$this->table($headers, $rows);
if (!empty($rows)) {
$this->info("The following users do not have an email address:");
$this->table($headers, $rows);
}
return 0;
}
+1 -1
View File
@@ -28,7 +28,7 @@ class CheckoutableCheckedIn
$this->checkedOutTo = $checkedOutTo;
$this->checkedInBy = $checkedInBy;
$this->note = $note;
$this->action_date = $action_date ?? date('Y-m-d');
$this->action_date = $action_date ?? date('Y-m-d H:i:s');
$this->originalValues = $originalValues;
}
}
+16 -3
View File
@@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Log;
use Throwable;
use JsonException;
use Carbon\Exceptions\InvalidFormatException;
use Illuminate\Http\Exceptions\ThrottleRequestsException;
class Handler extends ExceptionHandler
{
@@ -107,18 +108,25 @@ class Handler extends ExceptionHandler
$statusCode = $e->getStatusCode();
// API throttle requests are handled in the RouteServiceProvider configureRateLimiting() method, so we don't need to handle them here
switch ($e->getStatusCode()) {
case '404':
return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode . ' endpoint not found'), 404);
case '429':
return response()->json(Helper::formatStandardApiResponse('error', null, 'Too many requests'), 429);
case '405':
return response()->json(Helper::formatStandardApiResponse('error', null, 'Method not allowed'), 405);
default:
return response()->json(Helper::formatStandardApiResponse('error', null, $statusCode), $statusCode);
}
}
// This handles API validation exceptions that happen at the Form Request level, so they
// never even get to the controller where we normally nicely format JSON responses
if ($e instanceof ValidationException) {
$response = $this->invalidJson($request, $e);
return response()->json(Helper::formatStandardApiResponse('error', null, $e->errors()), 200);
}
}
@@ -143,6 +151,10 @@ class Handler extends ExceptionHandler
$route = 'maintenances.index';
} elseif ($route === 'licenseseats.index') {
$route = 'licenses.index';
} elseif ($route === 'customfields.index') {
$route = 'fields.index';
} elseif ($route === 'customfieldsets.index') {
$route = 'fields.index';
}
return redirect()
@@ -201,6 +213,7 @@ class Handler extends ExceptionHandler
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
+6 -7
View File
@@ -1313,25 +1313,24 @@ class Helper
switch ($item) {
case 'asset':
return 'fas fa-barcode';
break;
case 'accessory':
return 'fas fa-keyboard';
break;
case 'component':
return 'fas fa-hdd';
break;
case 'consumable':
return 'fas fa-tint';
break;
case 'license':
return 'far fa-save';
break;
case 'location':
return 'fas fa-map-marker-alt';
break;
case 'user':
return 'fas fa-user';
break;
case 'supplier':
return 'fa-solid fa-store';
case 'manufacturer':
return 'fa-solid fa-building';
case 'category':
return 'fa-solid fa-table-columns';
}
}
+26 -10
View File
@@ -16,14 +16,14 @@ class StorageHelper
$disk = config('filesystems.default');
}
switch (config("filesystems.disks.$disk.driver")) {
case 'local':
return response()->download(Storage::disk($disk)->path($filename)); //works for PRIVATE or public?!
case 'local':
return response()->download(Storage::disk($disk)->path($filename)); //works for PRIVATE or public?!
case 's3':
return redirect()->away(Storage::disk($disk)->temporaryUrl($filename, now()->addMinutes(5))); //works for private or public, I guess?
case 's3':
return redirect()->away(Storage::disk($disk)->temporaryUrl($filename, now()->addMinutes(5))); //works for private or public, I guess?
default:
return Storage::disk($disk)->download($filename);
default:
return Storage::disk($disk)->download($filename);
}
}
@@ -33,11 +33,12 @@ class StorageHelper
* to determine that they are safe to display inline.
*
* @author <A. Gianotto> [<snipe@snipe.net]>
* @since v7.0.14
* @param $file_with_path
* @since v7.0.14
* @param $file_with_path
* @return bool
*/
public static function allowSafeInline($file_with_path) {
public static function allowSafeInline($file_with_path)
{
$allowed_inline = [
'pdf',
@@ -48,6 +49,7 @@ class StorageHelper
'avif',
'webp',
'png',
'gif',
];
@@ -59,10 +61,24 @@ class StorageHelper
}
public static function getFiletype($file_with_path)
{
// The file exists and is allowed to be displayed inline
if (Storage::exists($file_with_path)) {
return pathinfo($file_with_path, PATHINFO_EXTENSION);
}
return null;
}
/**
* Decide whether to show the file inline or download it.
*/
public static function showOrDownloadFile($file, $filename) {
public static function showOrDownloadFile($file, $filename)
{
$headers = [];
@@ -7,6 +7,7 @@ use App\Events\CheckoutDeclined;
use App\Events\ItemAccepted;
use App\Events\ItemDeclined;
use App\Http\Controllers\Controller;
use App\Mail\CheckoutAcceptanceResponseMail;
use App\Models\Actionlog;
use App\Models\Asset;
use App\Models\CheckoutAcceptance;
@@ -21,8 +22,10 @@ use App\Models\Component;
use App\Models\Consumable;
use App\Notifications\AcceptanceAssetAcceptedNotification;
use App\Notifications\AcceptanceAssetDeclinedNotification;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use App\Http\Controllers\SettingsController;
@@ -337,6 +340,21 @@ class AcceptanceController extends Controller
$return_msg = trans('admin/users/message.declined');
}
if ($acceptance->alert_on_response_id) {
try {
$recipient = User::find($acceptance->alert_on_response_id);
if ($recipient) {
Mail::to($recipient)->send(new CheckoutAcceptanceResponseMail(
$acceptance,
$recipient,
$request->input('asset_acceptance') === 'accepted',
));
}
} catch (Exception $e) {
Log::warning($e);
}
}
return redirect()->to('account/accept')->with('success', $return_msg);
@@ -1,200 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Helpers\StorageHelper;
use App\Http\Transformers\UploadedFilesTransformer;
use Illuminate\Support\Facades\Storage;
use App\Helpers\Helper;
use App\Http\Controllers\Controller;
use App\Models\Asset;
use App\Models\Actionlog;
use App\Http\Requests\UploadFileRequest;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Illuminate\Http\Request;
/**
* This class controls file related actions related
* to assets for the Snipe-IT Asset Management application.
*
* Based on the Assets/AssetFilesController by A. Gianotto <snipe@snipe.net>
*
* @version v1.0
* @author [T. Scarsbrook] [<snipe@scarzybrook.co.uk>]
*/
class AssetFilesController extends Controller
{
/**
* Accepts a POST to upload a file to the server.
*
* @param \App\Http\Requests\UploadFileRequest $request
* @param int $assetId
* @since [v6.0]
* @author [T. Scarsbrook] [<snipe@scarzybrook.co.uk>]
*/
public function store(UploadFileRequest $request, $assetId = null) : JsonResponse
{
// Start by checking if the asset being acted upon exists
if (! $asset = Asset::find($assetId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.does_not_exist')), 404);
}
// Make sure we are allowed to update this asset
$this->authorize('update', $asset);
if ($request->hasFile('file')) {
// If the file storage directory doesn't exist; create it
if (! Storage::exists('private_uploads/assets')) {
Storage::makeDirectory('private_uploads/assets', 775);
}
// Loop over the attached files and add them to the asset
foreach ($request->file('file') as $file) {
$file_name = $request->handleFile('private_uploads/assets/','hardware-'.$asset->id, $file);
$asset->logUpload($file_name, e($request->get('notes')));
}
// All done - report success
return response()->json(Helper::formatStandardApiResponse('success', $asset, trans('admin/hardware/message.upload.success')));
}
// We only reach here if no files were included in the POST, so tell the user this
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.upload.nofiles')), 500);
}
/**
* List the files for an asset.
*
* @param int $assetId
* @since [v6.0]
* @author [T. Scarsbrook] [<snipe@scarzybrook.co.uk>]
*/
public function list(Asset $asset, Request $request) : JsonResponse | array
{
$this->authorize('view', $asset);
$allowed_columns =
[
'id',
'filename',
'eol',
'notes',
'created_at',
'updated_at',
];
$files = Actionlog::select('action_logs.*')->where('action_type', '=', 'uploaded')->where('item_type', '=', Asset::class)->where('item_id', '=', $asset->id);
if ($request->filled('search')) {
$files = $files->TextSearch($request->input('search'));
}
// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $files->count()) ? $files->count() : abs($request->input('offset'));
$limit = app('api_limit_value');
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';
$files = $files->orderBy($sort, $order);
$files = $files->skip($offset)->take($limit)->get();
return (new UploadedFilesTransformer())->transformFiles($files, $files->count());
}
/**
* Check for permissions and display the file.
*
* @param int $assetId
* @param int $fileId
* @return \Illuminate\Http\JsonResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
* @since [v6.0]
* @author [T. Scarsbrook] [<snipe@scarzybrook.co.uk>]
*/
public function show(Asset $asset, $fileId = null) : JsonResponse | StreamedResponse | Storage | StorageHelper | BinaryFileResponse
{
// the asset is valid
if (isset($asset->id)) {
$this->authorize('view', $asset);
// Check that the file being requested exists for the asset
if (! $log = Actionlog::whereNotNull('filename')->where('item_id', $asset->id)->find($fileId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.download.no_match', ['id' => $fileId])), 404);
}
// Form the full filename with path
$file = 'private_uploads/assets/'.$log->filename;
Log::debug('Checking for '.$file);
if ($log->action_type == 'audit') {
$file = 'private_uploads/audits/'.$log->filename;
}
// Check the file actually exists on the filesystem
if (! Storage::exists($file)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.download.does_not_exist', ['id' => $fileId])), 404);
}
if (request('inline') == 'true') {
$headers = [
'Content-Disposition' => 'inline',
];
return Storage::download($file, $log->filename, $headers);
}
return StorageHelper::downloader($file);
}
// Send back an error message
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.download.error', ['id' => $fileId])), 500);
}
/**
* Delete the associated file
*
* @param int $assetId
* @param int $fileId
* @since [v6.0]
* @author [T. Scarsbrook] [<snipe@scarzybrook.co.uk>]
*/
public function destroy(Asset $asset, $fileId = null) : JsonResponse
{
$rel_path = 'private_uploads/assets';
// the asset is valid
if (isset($asset->id)) {
$this->authorize('update', $asset);
// Check for the file
$log = Actionlog::find($fileId);
if ($log) {
// Check the file actually exists, and delete it
if (Storage::exists($rel_path.'/'.$log->filename)) {
Storage::delete($rel_path.'/'.$log->filename);
}
// Delete the record of the file
$log->delete();
// All deleting done - notify the user of success
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/hardware/message.deletefile.success')), 200);
}
// The file doesn't seem to really exist, so report an error
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.deletefile.error')), 500);
}
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/hardware/message.deletefile.error')), 500);
}
}
@@ -75,6 +75,7 @@ class AssetMaintenancesController extends Controller
'serial',
'created_by',
'supplier',
'location',
'is_warranty',
'status_label',
];
@@ -98,6 +99,9 @@ class AssetMaintenancesController extends Controller
case 'serial':
$maintenances = $maintenances->OrderByAssetSerial($order);
break;
case 'location':
$maintenances = $maintenances->OrderLocationName($order);
break;
case 'status_label':
$maintenances = $maintenances->OrderStatusName($order);
break;
@@ -1,184 +0,0 @@
<?php
namespace App\Http\Controllers\Api;
use App\Helpers\StorageHelper;
use Illuminate\Support\Facades\Storage;
use App\Helpers\Helper;
use App\Http\Controllers\Controller;
use App\Models\AssetModel;
use App\Models\Actionlog;
use App\Http\Requests\UploadFileRequest;
use App\Http\Transformers\AssetModelsTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* This class controls file related actions related
* to assets for the Snipe-IT Asset Management application.
*
* Based on the Assets/AssetFilesController by A. Gianotto <snipe@snipe.net>
*
* @version v1.0
* @author [T. Scarsbrook] [<snipe@scarzybrook.co.uk>]
*/
class AssetModelFilesController extends Controller
{
/**
* Accepts a POST to upload a file to the server.
*
* @param \App\Http\Requests\UploadFileRequest $request
* @param int $assetModelId
* @since [v7.0.12]
* @author [r-xyz]
*/
public function store(UploadFileRequest $request, $assetModelId = null) : JsonResponse
{
// Start by checking if the asset being acted upon exists
if (! $assetModel = AssetModel::find($assetModelId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.does_not_exist')), 404);
}
// Make sure we are allowed to update this asset
$this->authorize('update', $assetModel);
if ($request->hasFile('file')) {
// If the file storage directory doesn't exist; create it
if (! Storage::exists('private_uploads/assetmodels')) {
Storage::makeDirectory('private_uploads/assetmodels', 775);
}
// Loop over the attached files and add them to the asset
foreach ($request->file('file') as $file) {
$file_name = $request->handleFile('private_uploads/assetmodels/','model-'.$assetModel->id, $file);
$assetModel->logUpload($file_name, e($request->get('notes')));
}
// All done - report success
return response()->json(Helper::formatStandardApiResponse('success', $assetModel, trans('admin/models/message.upload.success')));
}
// We only reach here if no files were included in the POST, so tell the user this
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.upload.nofiles')), 500);
}
/**
* List the files for an asset.
*
* @param int $assetmodel
* @since [v7.0.12]
* @author [r-xyz]
*/
public function list($assetmodel_id) : JsonResponse | array
{
// Start by checking if the asset being acted upon exists
if (! $assetModel = AssetModel::find($assetmodel_id)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.does_not_exist')), 404);
}
$assetmodel = AssetModel::with('uploads')->find($assetmodel_id);
$this->authorize('view', $assetmodel);
return (new AssetModelsTransformer)->transformAssetModelFiles($assetmodel, $assetmodel->uploads()->count());
}
/**
* Check for permissions and display the file.
*
* @param int $assetModelId
* @param int $fileId
* @return \Illuminate\Http\JsonResponse
* @throws \Illuminate\Auth\Access\AuthorizationException
* @since [v7.0.12]
* @author [r-xyz]
*/
public function show($assetModelId = null, $fileId = null) : JsonResponse | StreamedResponse | Storage | StorageHelper | BinaryFileResponse
{
// Start by checking if the asset being acted upon exists
if (! $assetModel = AssetModel::find($assetModelId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.does_not_exist')), 404);
}
// the asset is valid
if (isset($assetModel->id)) {
$this->authorize('view', $assetModel);
// Check that the file being requested exists for the asset
if (! $log = Actionlog::whereNotNull('filename')->where('item_id', $assetModel->id)->find($fileId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.download.no_match', ['id' => $fileId])), 404);
}
// Form the full filename with path
$file = 'private_uploads/assetmodels/'.$log->filename;
Log::debug('Checking for '.$file);
if ($log->action_type == 'audit') {
$file = 'private_uploads/audits/'.$log->filename;
}
// Check the file actually exists on the filesystem
if (! Storage::exists($file)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.download.does_not_exist', ['id' => $fileId])), 404);
}
if (request('inline') == 'true') {
$headers = [
'Content-Disposition' => 'inline',
];
return Storage::download($file, $log->filename, $headers);
}
return StorageHelper::downloader($file);
}
// Send back an error message
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.download.error', ['id' => $fileId])), 500);
}
/**
* Delete the associated file
*
* @param int $assetModelId
* @param int $fileId
* @since [v7.0.12]
* @author [r-xyz]
*/
public function destroy($assetModelId = null, $fileId = null) : JsonResponse
{
// Start by checking if the asset being acted upon exists
if (! $assetModel = AssetModel::find($assetModelId)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.does_not_exist')), 404);
}
$rel_path = 'private_uploads/assetmodels';
// the asset is valid
if (isset($assetModel->id)) {
$this->authorize('update', $assetModel);
// Check for the file
$log = Actionlog::find($fileId);
if ($log) {
// Check the file actually exists, and delete it
if (Storage::exists($rel_path.'/'.$log->filename)) {
Storage::delete($rel_path.'/'.$log->filename);
}
// Delete the record of the file
$log->delete();
// All deleting done - notify the user of success
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/models/message.deletefile.success')), 200);
}
// The file doesn't seem to really exist, so report an error
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.deletefile.error')), 500);
}
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.deletefile.error')), 500);
}
}
@@ -85,6 +85,12 @@ class AssetModelsController extends Controller
$assetmodels = $assetmodels->where('models.model_number', '=', $request->input('model_number'));
}
if ($request->input('requestable') == 'true') {
$assetmodels = $assetmodels->where('models.requestable', '=', '1');
} elseif ($request->input('requestable') == 'false') {
$assetmodels = $assetmodels->where('models.requestable', '=', '0');
}
if ($request->filled('notes')) {
$assetmodels = $assetmodels->where('models.notes', '=', $request->input('notes'));
}
@@ -114,6 +114,7 @@ class AssetsController extends Controller
'byod',
'asset_eol_date',
'requestable',
'jobtitle',
];
$filter = [];
@@ -395,6 +396,9 @@ class AssetsController extends Controller
case 'assigned_to':
$assets->OrderAssigned($order);
break;
case 'jobtitle':
$assets->OrderByJobTitle($order);
break;
case 'created_by':
$assets->OrderByCreatedByName($order);
break;
@@ -1146,7 +1150,7 @@ class AssetsController extends Controller
// Validate the rest of the data before we turn off the event dispatcher
if ($asset->isInvalid()) {
return response()->json(Helper::formatStandardApiResponse('error', null, $asset->getErrors()));
return response()->json(Helper::formatStandardApiResponse('error', ['asset_tag' => $asset->asset_tag], $asset->getErrors()));
}
@@ -234,6 +234,15 @@ class ImportController extends Controller
case 'location':
$redirectTo = 'locations.index';
break;
case 'supplier':
$redirectTo = 'suppliers.index';
break;
case 'manufacturer':
$redirectTo = 'manufacturers.index';
break;
case 'category':
$redirectTo = 'categories.index';
break;
}
if ($errors) { //Failure
@@ -87,7 +87,8 @@ class LocationsController extends Controller
->withCount('accessories as accessories_count')
->withCount('rtd_assets as rtd_assets_count')
->withCount('children as children_count')
->withCount('users as users_count');
->withCount('users as users_count')
->with('adminuser');
// Only scope locations if the setting is enabled
if (Setting::getSettings()->scope_locations_fmcs) {
@@ -218,6 +219,7 @@ class LocationsController extends Controller
'locations.updated_at',
'locations.image',
'locations.currency',
'locations.company_id',
'locations.notes',
])
->withCount('assignedAssets as assigned_assets_count')
@@ -4,15 +4,19 @@ namespace App\Http\Controllers\Api;
use App\Helpers\Helper;
use App\Http\Controllers\Controller;
use App\Http\Transformers\ProfileTransformer;
use App\Models\CheckoutRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Response;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Laravel\Passport\TokenRepository;
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
use Illuminate\Support\Facades\Gate;
use App\Models\CustomField;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\JsonResponse;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
class ProfileController extends Controller
{
@@ -167,6 +171,22 @@ class ProfileController extends Controller
}
/**
* Display the EULAs accepted by the user.
*
* @param \App\Http\Transformers\ActionlogsTransformer $transformer
* @return \Illuminate\Http\JsonResponse
*@since [v8.1.16]
* @author [Godfrey Martinez] [<gmartinez@grokability.com>]
*/
public function eulas(ProfileTransformer $transformer)
{
// Only return this user's EULAs
$eulas = auth()->user()->eulas;
return response()->json(
$transformer->transformFiles($eulas, $eulas->count())
);
}
}
@@ -24,10 +24,15 @@ class SuppliersController extends Controller
public function index(Request $request): array
{
$this->authorize('view', Supplier::class);
$allowed_columns = ['
id',
$allowed_columns = [
'id',
'name',
'address',
'address2',
'city',
'state',
'country',
'zip',
'phone',
'contact',
'fax',
@@ -39,21 +44,24 @@ class SuppliersController extends Controller
'components_count',
'consumables_count',
'url',
'notes',
];
$suppliers = Supplier::select(
['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'updated_at', 'deleted_at', 'image', 'notes', 'url'])
['id', 'name', 'address', 'address2', 'city', 'state', 'country', 'fax', 'phone', 'email', 'contact', 'created_at', 'created_by', 'updated_at', 'deleted_at', 'image', 'notes', 'url', 'zip'])
->withCount('assets as assets_count')
->withCount('licenses as licenses_count')
->withCount('accessories as accessories_count')
->withCount('components as components_count')
->withCount('consumables as consumables_count');
->withCount('consumables as consumables_count')
->with('adminuser');
if ($request->filled('search')) {
$suppliers = $suppliers->TextSearch($request->input('search'));
$suppliers->TextSearch($request->input('search'));
}
if ($request->filled('name')) {
$suppliers->where('name', '=', $request->input('name'));
}
@@ -100,7 +108,15 @@ class SuppliersController extends Controller
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at';
$suppliers->orderBy($sort, $order);
switch ($request->input('sort')) {
case 'created_by':
$suppliers->OrderByCreatedByName($order);
break;
default:
$suppliers->orderBy($sort, $order);
break;
}
$total = $suppliers->count();
$suppliers = $suppliers->skip($offset)->take($limit)->get();
@@ -0,0 +1,255 @@
<?php
namespace App\Http\Controllers\Api;
use App\Helpers\Helper;
use App\Helpers\StorageHelper;
use App\Http\Controllers\Controller;
use App\Http\Requests\UploadFileRequest;
use App\Http\Transformers\UploadedFilesTransformer;
use App\Models\Accessory;
use App\Models\Actionlog;
use App\Models\Asset;
use App\Models\AssetModel;
use App\Models\Component;
use App\Models\Consumable;
use App\Models\License;
use App\Models\Location;
use App\Models\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\StreamedResponse;
class UploadedFilesController extends Controller
{
static $map_object_type = [
'accessories' => Accessory::class,
'assets' => Asset::class,
'components' => Component::class,
'consumables' => Consumable::class,
'licenses' => License::class,
'locations' => Location::class,
'models' => AssetModel::class,
'users' => User::class,
];
static $map_storage_path = [
'accessories' => 'private_uploads/accessories/',
'assets' => 'private_uploads/assets/',
'components' => 'private_uploads/components/',
'consumables' => 'private_uploads/consumables/',
'licenses' => 'private_uploads/licenses/',
'locations' => 'private_uploads/locations/',
'models' => 'private_uploads/assetmodels/',
'users' => 'private_uploads/users/',
];
static $map_file_prefix= [
'accessories' => 'accessory',
'assets' => 'asset',
'components' => 'component',
'consumables' => 'consumable',
'licenses' => 'license',
'locations' => 'location',
'models' => 'model',
'users' => 'user',
];
/**
* List files for an object
*
* @param \App\Http\Requests\UploadFileRequest $request
* @param string $object_type the type of object to upload the file to
* @param int $id the ID of the object to list files for
* @since [v8.1.17]
* @author [A. Gianotto <snipe@snipe.net>]
*/
public function index(Request $request, $object_type, $id) : JsonResponse | array
{
// Check the permissions to make sure the user can view the object
$object = self::$map_object_type[$object_type]::find($id);
$this->authorize('view', $object);
if (!$object) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_upload_status.invalid_object')));
}
// Columns allowed for sorting
$allowed_columns =
[
'id',
'filename',
'action_type',
'note',
'created_at',
];
$uploads = $object->uploads();
$offset = ($request->input('offset') > $object->count()) ? $object->count() : abs($request->input('offset'));
$limit = app('api_limit_value');
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'action_logs.created_at';
// Text search on action_logs fields
// We could use the normal Actionlogs text scope, but it's a very heavy query since it's searcghing across all relations
// And we generally won't need that here
if ($request->filled('search')) {
$uploads->where(
function ($query) use ($request) {
$query->where('filename', 'LIKE', '%' . $request->input('search') . '%')
->orWhere('note', 'LIKE', '%' . $request->input('search') . '%');
}
);
}
$uploads = $uploads->skip($offset)->take($limit)->orderBy($sort, $order)->get();
return (new UploadedFilesTransformer())->transformFiles($uploads, $uploads->count());
}
/**
* Accepts a POST to upload a file to the server.
*
* @param \App\Http\Requests\UploadFileRequest $request
* @param string $object_type the type of object to upload the file to
* @param int $id the ID of the object to store so we can check permisisons
* @since [v8.1.17]
* @author [A. Gianotto <snipe@snipe.net>]
*/
public function store(UploadFileRequest $request, $object_type, $id) : JsonResponse
{
// Check the permissions to make sure the user can view the object
$object = self::$map_object_type[$object_type]::find($id);
$this->authorize('view', $object);
if (!$object) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_upload_status.invalid_object')));
}
// If the file storage directory doesn't exist, create it
if (! Storage::exists(self::$map_storage_path[$object_type])) {
Storage::makeDirectory(self::$map_storage_path[$object_type], 775);
}
if ($request->hasFile('file')) {
// Loop over the attached files and add them to the object
foreach ($request->file('file') as $file) {
$file_name = $request->handleFile(self::$map_storage_path[$object_type], self::$map_file_prefix[$object_type].'-'.$object->id, $file);
$files[] = $file_name;
$object->logUpload($file_name, $request->get('notes'));
}
$files = Actionlog::select('action_logs.*')->where('action_type', '=', 'uploaded')
->where('item_type', '=', self::$map_object_type[$object_type])
->where('item_id', '=', $id)->whereIn('filename', $files)
->get();
return response()->json(Helper::formatStandardApiResponse('success', (new UploadedFilesTransformer())->transformFiles($files, count($files)), trans_choice('general.file_upload_status.upload.success', count($files))));
}
// No files were submitted
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_upload_status.nofiles')));
}
/**
* Check for permissions and display the file.
*
* @param \App\Http\Requests\UploadFileRequest $request
* @param string $object_type the type of object to upload the file to
* @param int $id the ID of the object to delete from so we can check permisisons
* @param $file_id the ID of the file to delete from the action_logs table
* @since [v8.1.17]
* @author [A. Gianotto <snipe@snipe.net>]
*/
public function show($object_type, $id, $file_id) : JsonResponse | StreamedResponse | Storage | StorageHelper | BinaryFileResponse
{
// Check the permissions to make sure the user can view the object
$object = self::$map_object_type[$object_type]::find($id);
$this->authorize('view', $object);
if (!$object) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_upload_status.invalid_object')));
}
// Check that the file being requested exists for the object
if (! $log = Actionlog::whereNotNull('filename')->where('item_type', self::$map_object_type[$object_type])->where('item_id', $object->id)->find($file_id)
) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_upload_status.invalid_id')), 200);
}
if (! Storage::exists(self::$map_storage_path[$object_type].'/'.$log->filename)) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_upload_status.file_not_found'), 200));
}
if (request('inline') == 'true') {
$headers = [
'Content-Disposition' => 'inline',
];
return Storage::download(self::$map_storage_path[$object_type].'/'.$log->filename, $log->filename, $headers);
}
return StorageHelper::downloader(self::$map_storage_path[$object_type].'/'.$log->filename);
}
/**
* Delete the associated file
*
* @param \App\Http\Requests\UploadFileRequest $request
* @param string $object_type the type of object to upload the file to
* @param int $id the ID of the object to delete from so we can check permisisons
* @param $file_id the ID of the file to delete from the action_logs table
* @since [v8.1.17]
* @author [A. Gianotto <snipe@snipe.net>]
*/
public function destroy($object_type, $id, $file_id) : JsonResponse
{
// Check the permissions to make sure the user can view the object
$object = self::$map_object_type[$object_type]::find($id);
$this->authorize('update', self::$map_object_type[$object_type]);
if (!$object) {
return response()->json(Helper::formatStandardApiResponse('error', null, trans('general.file_upload_status.invalid_object')));
}
// Check for the file
$log = Actionlog::find($file_id)->where('item_type', self::$map_object_type[$object_type])
->where('item_id', $object->id)->first();
if ($log) {
// Check the file actually exists, and delete it
if (Storage::exists(self::$map_storage_path[$object_type].'/'.$log->filename)) {
Storage::delete(self::$map_storage_path[$object_type].'/'.$log->filename);
}
// Delete the record of the file
if ($log->delete()) {
return response()->json(Helper::formatStandardApiResponse('success', null, trans_choice('general.file_upload_status.delete.success', 1)), 200);
}
}
// The file doesn't seem to really exist, so report an error
return response()->json(Helper::formatStandardApiResponse('error', null, trans_choice('general.file_upload_status.delete.error', 1)), 500);
}
}
+23 -4
View File
@@ -6,6 +6,7 @@ use App\Helpers\Helper;
use App\Http\Controllers\Controller;
use App\Http\Requests\SaveUserRequest;
use App\Http\Transformers\AccessoriesTransformer;
use App\Http\Transformers\ActionlogsTransformer;
use App\Http\Transformers\AssetsTransformer;
use App\Http\Transformers\ConsumablesTransformer;
use App\Http\Transformers\LicensesTransformer;
@@ -80,7 +81,7 @@ class UsersController extends Controller
'users.autoassign_licenses',
'users.website',
])->with('manager', 'groups', 'userloc', 'company', 'department', 'assets', 'licenses', 'accessories', 'consumables', 'createdBy', 'managesUsers', 'managedLocations')
])->with('manager', 'groups', 'userloc', 'company', 'department', 'assets', 'licenses', 'accessories', 'consumables', 'createdBy', 'managesUsers', 'managedLocations', 'eulas')
->withCount([
'assets as assets_count' => function(Builder $query) {
$query->withoutTrashed();
@@ -206,11 +207,11 @@ class UsersController extends Controller
}
if ($request->filled('manages_users_count')) {
$users->has('manages_users_count', '=', $request->input('manages_users_count'));
$users->has('managesUsers', '=', $request->input('manages_users_count'));
}
if ($request->filled('manages_locations_count')) {
$users->has('manages_locations_count', '=', $request->input('manages_locations_count'));
$users->has('managedLocations', '=', $request->input('manages_locations_count'));
}
if ($request->filled('autoassign_licenses')) {
@@ -676,7 +677,6 @@ class UsersController extends Controller
$this->authorize('view', License::class);
if ($user = User::where('id', $id)->withTrashed()->first()) {
$this->authorize('update', $user);
$licenses = $user->licenses()->get();
return (new LicensesTransformer())->transformLicenses($licenses, $licenses->count());
}
@@ -736,6 +736,25 @@ class UsersController extends Controller
return (new UsersTransformer)->transformUser($request->user());
}
/**
* Display the EULAs accepted by the user.
*
* @param \App\Models\User $user
* @param \App\Http\Transformers\ActionlogsTransformer $transformer
* @return \Illuminate\Http\JsonResponse
*@since [v8.1.16]
* @author [Godfrey Martinez] [<gmartinez@grokability.com>]
*/
public function eulas(User $user, ActionlogsTransformer $transformer)
{
$this->authorize('view', User::class);
$eulas = $user->eulas;
return response()->json(
$transformer->transformActionlogs($eulas, $eulas->count())
);
}
/**
* Restore a soft-deleted user.
*
@@ -19,19 +19,6 @@ use \Illuminate\Http\RedirectResponse;
*/
class AssetMaintenancesController extends Controller
{
/**
* Checks for permissions for this action.
*
* @todo This should be replaced with middleware and/or policies
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @version v1.0
* @since [v1.8]
*/
private static function getInsufficientPermissionsRedirect(): RedirectResponse
{
return redirect()->route('maintenances.index')
->with('error', trans('general.insufficient_permissions'));
}
/**
* Returns a view that invokes the ajax tables which actually contains
@@ -67,16 +54,10 @@ class AssetMaintenancesController extends Controller
// We have to set this so that the correct property is set in the select2 ajax dropdown
$asset->asset_id = $asset->id;
}
// Prepare Asset Maintenance Type List
$assetMaintenanceType = [
'' => 'Select an asset maintenance type',
] + AssetMaintenance::getImprovementOptions();
// Mark the selected asset, if it came in
return view('asset_maintenances/edit')
->with('assetMaintenanceType', AssetMaintenance::getImprovementOptions())
->with('asset', $asset)
->with('assetMaintenanceType', $assetMaintenanceType)
->with('item', new AssetMaintenance);
}
@@ -91,43 +72,45 @@ class AssetMaintenancesController extends Controller
public function store(Request $request) : RedirectResponse
{
$this->authorize('update', Asset::class);
// create a new model instance
$assetMaintenance = new AssetMaintenance();
$assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = $request->input('cost');
$assetMaintenance->notes = $request->input('notes');
$asset = Asset::find($request->input('asset_id'));
if ((! Company::isCurrentUserHasAccess($asset)) && ($asset != null)) {
return static::getInsufficientPermissionsRedirect();
$assets = Asset::whereIn('id', $request->input('selected_assets'))->get();
// Loop through the selected assets
foreach ($assets as $asset) {
$assetMaintenance = new AssetMaintenance();
$assetMaintenance->supplier_id = $request->input('supplier_id');
$assetMaintenance->is_warranty = $request->input('is_warranty');
$assetMaintenance->cost = $request->input('cost');
$assetMaintenance->notes = $request->input('notes');
// Save the asset maintenance data
$assetMaintenance->asset_id = $asset->id;
$assetMaintenance->asset_maintenance_type = $request->input('asset_maintenance_type');
$assetMaintenance->title = $request->input('title');
$assetMaintenance->start_date = $request->input('start_date');
$assetMaintenance->completion_date = $request->input('completion_date');
$assetMaintenance->created_by = auth()->id();
if (($assetMaintenance->completion_date !== null)
&& ($assetMaintenance->start_date !== '')
&& ($assetMaintenance->start_date !== '0000-00-00')
) {
$startDate = Carbon::parse($assetMaintenance->start_date);
$completionDate = Carbon::parse($assetMaintenance->completion_date);
$assetMaintenance->asset_maintenance_time = (int) $completionDate->diffInDays($startDate, true);
}
// Was the asset maintenance created?
if (!$assetMaintenance->save()) {
return redirect()->back()->withInput()->withErrors($assetMaintenance->getErrors());
}
}
// Save the asset maintenance data
$assetMaintenance->asset_id = $request->input('asset_id');
$assetMaintenance->asset_maintenance_type = $request->input('asset_maintenance_type');
$assetMaintenance->title = $request->input('title');
$assetMaintenance->start_date = $request->input('start_date');
$assetMaintenance->completion_date = $request->input('completion_date');
$assetMaintenance->created_by = auth()->id();
return redirect()->route('maintenances.index')
->with('success', trans('admin/asset_maintenances/message.create.success'));
if (($assetMaintenance->completion_date !== null)
&& ($assetMaintenance->start_date !== '')
&& ($assetMaintenance->start_date !== '0000-00-00')
) {
$startDate = Carbon::parse($assetMaintenance->start_date);
$completionDate = Carbon::parse($assetMaintenance->completion_date);
$assetMaintenance->asset_maintenance_time = (int) $completionDate->diffInDays($startDate, true);
}
// Was the asset maintenance created?
if ($assetMaintenance->save()) {
// Redirect to the new asset maintenance page
return redirect()->route('maintenances.index')
->with('success', trans('admin/asset_maintenances/message.create.success'));
}
return redirect()->back()->withInput()->withErrors($assetMaintenance->getErrors());
}
/**
@@ -135,26 +118,19 @@ class AssetMaintenancesController extends Controller
*
* @see AssetMaintenancesController::postEdit() method that stores the data
* @author Vincent Sposato <vincent.sposato@gmail.com>
* @param int $assetMaintenanceId
* @version v1.0
* @since [v1.8]
*/
public function edit(AssetMaintenance $maintenance) : View | RedirectResponse
{
$this->authorize('update', Asset::class);
if ((!$maintenance->asset) || ($maintenance->asset->deleted_at!='')) {
return redirect()->route('maintenances.index')->with('error', 'asset does not exist');
} elseif (! Company::isCurrentUserHasAccess($maintenance->asset)) {
return static::getInsufficientPermissionsRedirect();
}
// Prepare Improvement Type List
$assetMaintenanceType = ['' => 'Select an improvement type'] + AssetMaintenance::getImprovementOptions();
$this->authorize('update', $maintenance->asset);
return view('asset_maintenances/edit')
->with('selectedAsset', null)
->with('assetMaintenanceType', $assetMaintenanceType)
->with('item', $maintenance);
->with('selected_assets', $maintenance->asset->pluck('id')->toArray())
->with('asset_ids', request()->input('asset_ids', []))
->with('assetMaintenanceType', AssetMaintenance::getImprovementOptions())
->with('item', $maintenance);
}
/**
@@ -170,33 +146,21 @@ class AssetMaintenancesController extends Controller
public function update(Request $request, AssetMaintenance $maintenance) : View | RedirectResponse
{
$this->authorize('update', Asset::class);
if ((!$maintenance->asset) || ($maintenance->asset->deleted_at!='')) {
return redirect()->route('maintenances.index')->with('error', 'asset does not exist');
} elseif (! Company::isCurrentUserHasAccess($maintenance->asset)) {
return static::getInsufficientPermissionsRedirect();
}
$this->authorize('update', $maintenance->asset);
$maintenance->supplier_id = $request->input('supplier_id');
$maintenance->is_warranty = $request->input('is_warranty');
$maintenance->is_warranty = $request->input('is_warranty', 0);
$maintenance->cost = $request->input('cost');
$maintenance->notes = $request->input('notes');
$asset = Asset::find(request('asset_id'));
if (! Company::isCurrentUserHasAccess($asset)) {
return static::getInsufficientPermissionsRedirect();
}
// Save the asset maintenance data
$maintenance->asset_id = $request->input('asset_id');
$maintenance->asset_maintenance_type = $request->input('asset_maintenance_type');
$maintenance->title = $request->input('title');
$maintenance->start_date = $request->input('start_date');
$maintenance->completion_date = $request->input('completion_date');
if (($maintenance->completion_date == null)
) {
// Todo - put this in a getter/setter?
if (($maintenance->completion_date == null))
{
if (($maintenance->asset_maintenance_time !== 0)
|| (! is_null($maintenance->asset_maintenance_time))
) {
@@ -213,10 +177,7 @@ class AssetMaintenancesController extends Controller
$maintenance->asset_maintenance_time = (int) $completionDate->diffInDays($startDate, true);
}
// Was the asset maintenance created?
if ($maintenance->save()) {
// Redirect to the new asset maintenance page
return redirect()->route('maintenances.index')
->with('success', trans('admin/asset_maintenances/message.edit.success'));
}
@@ -232,21 +193,12 @@ class AssetMaintenancesController extends Controller
* @version v1.0
* @since [v1.8]
*/
public function destroy($assetMaintenanceId) : RedirectResponse
public function destroy(AssetMaintenance $maintenance) : RedirectResponse
{
$this->authorize('update', Asset::class);
// Check if the asset maintenance exists
if (is_null($assetMaintenance = AssetMaintenance::find($assetMaintenanceId))) {
// Redirect to the asset maintenance management page
return redirect()->route('maintenances.index')
->with('error', trans('admin/asset_maintenances/message.not_found'));
} elseif (! Company::isCurrentUserHasAccess($assetMaintenance->asset)) {
return static::getInsufficientPermissionsRedirect();
}
$this->authorize('update', $maintenance->asset);
// Delete the asset maintenance
$assetMaintenance->delete();
$maintenance->delete();
// Redirect to the asset_maintenance management page
return redirect()->route('maintenances.index')
->with('success', trans('admin/asset_maintenances/message.delete.success'));
@@ -262,11 +214,6 @@ class AssetMaintenancesController extends Controller
*/
public function show(AssetMaintenance $maintenance) : View | RedirectResponse
{
$this->authorize('view', Asset::class);
if (! Company::isCurrentUserHasAccess($maintenance->asset)) {
return static::getInsufficientPermissionsRedirect();
}
return view('asset_maintenances/view')->with('assetMaintenance', $maintenance);
}
}
@@ -96,7 +96,6 @@ class AssetCheckinController extends Controller
});
$asset->expected_checkin = null;
$asset->last_checkin = now();
$asset->assignedTo()->disassociate($asset);
$asset->accepted = null;
$asset->name = $request->get('name');
@@ -123,11 +122,14 @@ class AssetCheckinController extends Controller
$originalValues = $asset->getRawOriginal();
// Handle last checkin date
$checkin_at = date('Y-m-d H:i:s');
if (($request->filled('checkin_at')) && ($request->get('checkin_at') != date('Y-m-d'))) {
$originalValues['action_date'] = $checkin_at;
$checkin_at = $request->get('checkin_at');
}
$asset->last_checkin = $checkin_at;
$asset->licenseseats->each(function (LicenseSeat $seat) {
$seat->update(['assigned_to' => null]);
@@ -149,7 +149,7 @@ class AssetsController extends Controller
$asset->byod = request('byod', 0);
if (! empty($settings->audit_interval)) {
$asset->next_audit_date = Carbon::now()->addMonths($settings->audit_interval)->toDateString();
$asset->next_audit_date = Carbon::now()->addMonths((int) $settings->audit_interval)->toDateString();
}
// Set location_id to rtd_location_id ONLY if the asset isn't being checked out
@@ -188,14 +188,31 @@ class AssetsController extends Controller
// Validate the asset before saving
if ($asset->isValid() && $asset->save()) {
if (request('assigned_user')) {
$target = User::find(request('assigned_user'));
$target = null;
$location = null;
if ($userId = request('assigned_user')) {
$target = User::find($userId);
if (!$target) {
return redirect()->back()->withInput()->with('error', trans('admin/hardware/message.create.target_not_found.user'));
}
$location = $target->location_id;
} elseif (request('assigned_asset')) {
$target = Asset::find(request('assigned_asset'));
} elseif ($assetId = request('assigned_asset')) {
$target = Asset::find($assetId);
if (!$target) {
return redirect()->back()->withInput()->with('error', trans('admin/hardware/message.create.target_not_found.asset'));
}
$location = $target->location_id;
} elseif (request('assigned_location')) {
$target = Location::find(request('assigned_location'));
} elseif ($locationId = request('assigned_location')) {
$target = Location::find($locationId);
if (!$target) {
return redirect()->back()->withInput()->with('error', trans('admin/hardware/message.create.target_not_found.location'));
}
$location = $target->id;
}
@@ -446,7 +463,7 @@ class AssetsController extends Controller
event(new CheckoutableCheckedIn($asset, $target, auth()->user(), 'Checkin on delete', $checkin_at, $originalValues));
DB::table('assets')
->where('id', $asset->id)
->update(['assigned_to' => null]);
->update(['assigned_to' => null, 'assigned_type' => null]);
}
@@ -458,6 +475,7 @@ class AssetsController extends Controller
}
}
$asset->delete();
return redirect()->route('hardware.index')->with('success', trans('admin/hardware/message.delete.success'));
@@ -890,7 +908,7 @@ class AssetsController extends Controller
return redirect()->route('hardware.edit', $asset)->withErrors($asset->getErrors());
}
$dt = Carbon::now()->addMonths($settings->audit_interval)->toDateString();
$dt = Carbon::now()->addMonths( (int) $settings->audit_interval)->toDateString();
return view('hardware/audit')->with('asset', $asset)->with('item', $asset)->with('next_audit_date', $dt)->with('locations_list');
}
@@ -52,11 +52,26 @@ class BulkAssetsController extends Controller
}
$asset_ids = $request->input('ids');
if ($request->input('bulk_actions') === 'checkout') {
$status_check =$this->hasUndeployableStatus($asset_ids);
if($status_check && $status_check['status'] === true){
$asset_tags = implode(', ', array_column($status_check['tags'], 'asset_tag'));
$asset_ids = $status_check['asset_ids'];
session()->flash('warning', trans('admin/hardware/message.undeployable', ['asset_tags' => $asset_tags]));
}
$request->session()->flashInput(['selected_assets' => $asset_ids]);
return redirect()->route('hardware.bulkcheckout.show');
}
if ($request->input('bulk_actions') === 'maintenance') {
$request->session()->flashInput(['selected_assets' => $asset_ids]);
return redirect()->route('maintenances.create');
}
// Figure out where we need to send the user after the update is complete, and store that in the session
$bulk_back_url = request()->headers->get('referer');
session(['bulk_back_url' => $bulk_back_url]);
@@ -214,6 +229,21 @@ class BulkAssetsController extends Controller
$custom_field_columns = CustomField::all()->pluck('db_column')->toArray();
// find custom field input attributes that start with 'null_'
$null_custom_fields_inputs = array_filter($request->all(), function ($key) {
// filter out all keys that start with 'null_'
return (strpos($key, 'null_') === 0);
}, ARRAY_FILTER_USE_KEY);;
// remove 'null' from the keys
$custom_fields_to_null = [];
foreach ($null_custom_fields_inputs as $key => $value) {
$custom_fields_to_null[str_replace('null', '', $key)] = $value;
}
if (! $request->filled('ids') || count($request->input('ids')) == 0) {
return redirect($bulk_back_url)->with('error', trans('admin/hardware/message.update.no_assets_selected'));
@@ -251,7 +281,9 @@ class BulkAssetsController extends Controller
|| ($request->filled('null_expected_checkin_date'))
|| ($request->filled('null_next_audit_date'))
|| ($request->filled('null_asset_eol_date'))
|| ($request->filled('null_notes'))
|| ($request->anyFilled($custom_field_columns))
|| ($request->anyFilled(array_keys($null_custom_fields_inputs)))
) {
// Let's loop through those assets and build an update array
@@ -274,10 +306,14 @@ class BulkAssetsController extends Controller
->conditionallyAddItem('supplier_id')
->conditionallyAddItem('warranty_months')
->conditionallyAddItem('next_audit_date')
->conditionallyAddItem('asset_eol_date');
->conditionallyAddItem('asset_eol_date')
->conditionallyAddItem('notes');
foreach ($custom_field_columns as $key => $custom_field_column) {
$this->conditionallyAddItem($custom_field_column);
}
foreach ($custom_fields_to_null as $key => $custom_field_to_null) {
$this->conditionallyAddItem($key);
}
if (!($asset->eol_explicit)) {
if ($request->filled('model_id')) {
@@ -328,6 +364,10 @@ class BulkAssetsController extends Controller
}
}
if ($request->input('null_notes')=='1') {
$this->update_array['notes'] = null;
}
if ($request->filled('purchase_cost')) {
@@ -368,10 +408,12 @@ class BulkAssetsController extends Controller
// This could probably be added to a form request.
// If the asset isn't assigned, we don't care what the status is.
// Otherwise we need to make sure the status type is still a deployable one.
if (
($asset->assigned_to == '')
|| ($updated_status->deployable == '1') && ($asset->assetstatus?->deployable == '1')
) {
$unassigned = $asset->assigned_to == '';
$deployable = $updated_status->deployable == '1' && $asset->assetstatus?->deployable == '1';
$pending = $updated_status->pending === 1;
if ($unassigned || $deployable || $pending) {
$this->update_array['status_id'] = $updated_status->id;
}
@@ -423,6 +465,7 @@ class BulkAssetsController extends Controller
}
/**
*
* Start all the custom fields shenanigans
*/
@@ -430,6 +473,15 @@ class BulkAssetsController extends Controller
if ($asset->model->fieldset) {
foreach ($asset->model->fieldset->fields as $field) {
// null custom fields
if ($custom_fields_to_null) {
foreach ($custom_fields_to_null as $key => $custom_field_to_null) {
if ($field->db_column == $key) {
$this->update_array[$field->db_column] = null;
}
}
}
if ((array_key_exists($field->db_column, $this->update_array)) && ($field->field_encrypted == '1')) {
if (Gate::allows('admin')) {
$decrypted_old = Helper::gracefulDecrypt($field, $asset->{$field->db_column});
@@ -562,7 +614,10 @@ class BulkAssetsController extends Controller
public function showCheckout() : View
{
$this->authorize('checkout', Asset::class);
return view('hardware/bulk-checkout');
$do_not_change = ['' => trans('general.do_not_change')];
$status_label_list = $do_not_change + Helper::deployableStatusLabelList();
return view('hardware/bulk-checkout')->with('statusLabel_list', $status_label_list);
}
/**
@@ -594,13 +649,13 @@ class BulkAssetsController extends Controller
}
$checkout_at = date('Y-m-d H:i:s');
if (($request->filled('checkout_at')) && ($request->get('checkout_at') != date('Y-m-d'))) {
$checkout_at = e($request->get('checkout_at'));
$checkout_at = $request->get('checkout_at');
}
$expected_checkin = '';
if ($request->filled('expected_checkin')) {
$expected_checkin = e($request->get('expected_checkin'));
$expected_checkin = $request->get('expected_checkin');
}
$errors = [];
@@ -608,6 +663,11 @@ class BulkAssetsController extends Controller
foreach ($assets as $asset) {
$this->authorize('checkout', $asset);
// See if there is a status label passed
if ($request->filled('status_id')) {
$asset->status_id = $request->get('status_id');
}
$checkout_success = $asset->checkOut($target, $admin, $checkout_at, $expected_checkin, e($request->get('note')), $asset->name, null);
//TODO - I think this logic is duplicated in the checkOut method?
@@ -651,4 +711,25 @@ class BulkAssetsController extends Controller
return redirect()->route('hardware.index')->with('success', trans('admin/hardware/message.restore.success'));
}
}
public function hasUndeployableStatus (array $asset_ids)
{
$undeployable = Asset::whereIn('id', $asset_ids)
->undeployable()
->get();
$undeployableTags = $undeployable->map(function ($asset) {
return [
'id' => $asset->id,
'asset_tag' => $asset->asset_tag,
];
})->toArray();
$undeployableIds = array_column($undeployableTags, 'id');
$filtered_ids = array_diff($asset_ids, $undeployableIds);
if($undeployable->isNotEmpty()) {
return ['status' => true, 'tags' => $undeployableTags, 'asset_ids' => $filtered_ids];
}
return false;
}
}
@@ -68,6 +68,7 @@ class CategoriesController extends Controller
$category->eula_text = $request->input('eula_text');
$category->use_default_eula = $request->input('use_default_eula', '0');
$category->require_acceptance = $request->input('require_acceptance', '0');
$category->alert_on_response = $request->input('alert_on_response', '0');
$category->checkin_email = $request->input('checkin_email', '0');
$category->notes = $request->input('notes');
$category->created_by = auth()->id();
@@ -121,6 +122,7 @@ class CategoriesController extends Controller
$category->eula_text = $request->input('eula_text');
$category->use_default_eula = $request->input('use_default_eula', '0');
$category->require_acceptance = $request->input('require_acceptance', '0');
$category->alert_on_response = $request->input('alert_on_response', '0');
$category->checkin_email = $request->input('checkin_email', '0');
$category->notes = $request->input('notes');
@@ -86,7 +86,7 @@ class LicenseCheckinController extends Controller
}
if($licenseSeat->assigned_to != null){
$return_to = User::find($licenseSeat->assigned_to);
$return_to = User::withTrashed()->find($licenseSeat->assigned_to);
session()->put('checkedInFrom', $return_to->id);
} else {
$return_to = Asset::find($licenseSeat->asset_id);
+31 -1
View File
@@ -3,15 +3,21 @@
namespace App\Http\Controllers;
use App\Http\Requests\ImageUploadRequest;
use App\Http\Transformers\ProfileTransformer;
use App\Models\Actionlog;
use App\Models\Setting;
use App\Models\User;
use App\Notifications\CurrentInventory;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Http\RedirectResponse;
use \Illuminate\Contracts\View\View;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
/**
* This controller handles all actions related to User Profiles for
* the Snipe-IT Asset Management application.
@@ -220,7 +226,7 @@ class ProfileController extends Controller
if (!$user = User::find(auth()->id())) {
return redirect()->back()
->with('error', trans('admin/users/message.user_not_found', ['id' => $id]));
->with('error', trans('admin/users/message.user_not_found', ['id' => auth()->id()]));
}
if (empty($user->email)) {
return redirect()->back()->with('error', trans('admin/users/message.user_has_no_email'));
@@ -234,4 +240,28 @@ class ProfileController extends Controller
return redirect()->back()->with('success', trans('admin/users/general.user_notified'));
}
public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse
{
$logentry = Actionlog::where('filename', $filename)->first();
// Make sure the user has permission to view this file
if (auth()->id() != $logentry->target_id) {
return redirect()->route('account')->with('error', trans('general.generic_model_not_found', ['model' => 'file']));
}
if (config('filesystems.default') == 's3_private') {
return redirect()->away(Storage::disk('s3_private')->temporaryUrl('private_uploads/eula-pdfs/'.$filename, now()->addMinutes(5)));
}
if (Storage::exists('private_uploads/eula-pdfs/'.$filename)) {
return response()->download(config('app.private_uploads').'/eula-pdfs/'.$filename);
}
return redirect()->back()->with('error', trans('general.file_does_not_exist'));
}
}
+1 -1
View File
@@ -184,7 +184,7 @@ class ReportsController extends Controller
$currency = e(Setting::getSettings()->default_currency);
}
$row[] = $asset->purchase_date;
$row[] = Helper::getFormattedDateObject($asset->purchase_date, 'date', false);
$row[] = $currency.Helper::formatCurrencyOutput($asset->purchase_cost);
$row[] = $currency.Helper::formatCurrencyOutput($asset->getDepreciatedValue());
$row[] = $currency.Helper::formatCurrencyOutput(($asset->purchase_cost - $asset->getDepreciatedValue()));
+3 -1
View File
@@ -352,6 +352,7 @@ class SettingsController extends Controller
$setting->dash_chart_type = $request->input('dash_chart_type');
$setting->profile_edit = $request->input('profile_edit', 0);
$setting->require_checkinout_notes = $request->input('require_checkinout_notes', 0);
$setting->manager_view_enabled = $request->input('manager_view_enabled', 0);
if ($request->input('per_page') != '') {
@@ -650,6 +651,7 @@ class SettingsController extends Controller
$setting->alert_email = $alert_email;
$setting->admin_cc_email = $admin_cc_email;
$setting->admin_cc_always = $request->validated('admin_cc_always');
$setting->alerts_enabled = $request->input('alerts_enabled', '0');
$setting->alert_interval = $request->input('alert_interval');
$setting->alert_threshold = $request->input('alert_threshold');
@@ -922,7 +924,7 @@ class SettingsController extends Controller
* @since v5.0.0
*/
public function postSamlSettings(SettingsSamlRequest $request) : RedirectResponse
{
{
if (is_null($setting = Setting::getSettings())) {
return redirect()->to('admin')->with('error', trans('admin/settings/message.update.error'));
}
+108 -32
View File
@@ -27,50 +27,126 @@ use Exception;
class ViewAssetsController extends Controller
{
/**
* Redirect to the profile page.
* Extract custom fields that should be displayed in user view.
*
* @param User $user
* @return array
*/
private function extractCustomFields(User $user): array
{
$fieldArray = [];
foreach ($user->assets as $asset) {
if ($asset->model && $asset->model->fieldset) {
foreach ($asset->model->fieldset->fields as $field) {
if ($field->display_in_user_view == '1') {
$fieldArray[$field->db_column] = $field->name;
}
}
}
}
return array_unique($fieldArray);
}
/**
* Get list of users viewable by the current user.
*
* @param User $authUser
* @return \Illuminate\Support\Collection
*/
private function getViewableUsers(User $authUser): \Illuminate\Support\Collection
{
// SuperAdmin sees all users
if ($authUser->isSuperUser()) {
return User::select('id', 'first_name', 'last_name', 'username')
->where('activated', 1)
->orderBy('last_name')
->orderBy('first_name')
->get();
}
// Regular manager sees only their subordinates + self
$managedUsers = $authUser->getAllSubordinates();
// If user has subordinates, show them with self at beginning
if ($managedUsers->count() > 0) {
return collect([$authUser])->merge($managedUsers)
->sortBy('last_name')
->sortBy('first_name');
}
// User has no subordinates, only sees themselves
return collect([$authUser]);
}
/**
* Get the selected user ID from request or default to current user.
*
* @param Request $request
* @param \Illuminate\Support\Collection $subordinates
* @param int $defaultUserId
* @return int
*/
private function getSelectedUserId(Request $request, \Illuminate\Support\Collection $subordinates, int $defaultUserId): int
{
// If no subordinates or no user_id in request, return default
if ($subordinates->count() <= 1 || !$request->filled('user_id')) {
return $defaultUserId;
}
$requestedUserId = (int) $request->input('user_id');
// Validate if the requested user is allowed
if ($subordinates->contains('id', $requestedUserId)) {
return $requestedUserId;
}
// If invalid ID or not authorized, return default
return $defaultUserId;
}
/**
* Show user's assigned assets with optional manager view functionality.
*
*/
public function getIndex() : View | RedirectResponse
public function getIndex(Request $request) : View | RedirectResponse
{
$user = User::with(
$authUser = auth()->user();
$settings = Setting::getSettings();
$subordinates = collect();
$selectedUserId = $authUser->id;
// Process manager view if enabled
if ($settings->manager_view_enabled) {
$subordinates = $this->getViewableUsers($authUser);
$selectedUserId = $this->getSelectedUserId($request, $subordinates, $authUser->id);
}
// Load the data for the user to be viewed (either auth user or selected subordinate)
$userToView = User::with([
'assets',
'assets.model',
'assets.model.fieldset.fields',
'consumables',
'accessories',
'licenses',
)->find(auth()->id());
$field_array = array();
// Loop through all the custom fields that are applied to any model the user has assigned
foreach ($user->assets as $asset) {
// Make sure the model has a custom fieldset before trying to loop through the associated fields
if ($asset->model->fieldset) {
foreach ($asset->model->fieldset->fields as $field) {
// check and make sure they're allowed to see the value of the custom field
if ($field->display_in_user_view == '1') {
$field_array[$field->db_column] = $field->name;
}
}
}
'licenses'
])->find($selectedUserId);
// If the user to view couldn't be found (shouldn't happen with proper logic), redirect with error
if (!$userToView) {
return redirect()->route('view-assets')->with('error', trans('admin/users/message.user_not_found'));
}
// Since some models may re-use the same fieldsets/fields, let's make the array unique so we don't repeat columns
array_unique($field_array);
// Process custom fields for the user being viewed
$fieldArray = $this->extractCustomFields($userToView);
if (isset($user->id)) {
return view('account/view-assets', compact('user', 'field_array' ))
->with('settings', Setting::getSettings());
}
// Redirect to the user management page
return redirect()->route('users.index')
->with('error', trans('admin/users/message.user_not_found', $user->id));
// Pass the necessary data to the view
return view('account/view-assets', [
'user' => $userToView, // Use 'user' for compatibility with the existing view
'field_array' => $fieldArray,
'settings' => $settings,
'subordinates' => $subordinates,
'selectedUserId' => $selectedUserId
]);
}
/**
+1
View File
@@ -73,6 +73,7 @@ class Kernel extends HttpKernel
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'api-throttle' => \App\Http\Middleware\SetAPIResponseHeaders::class,
'health' => null,
];
}
@@ -0,0 +1,82 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Symfony\Component\HttpFoundation\Response;
class SetAPIResponseHeaders extends ThrottleRequests
{
/**
* Add the rate limit headers to the response.
*
* This extends the original ThrottleRequests middleware to add the 'X-RateLimit-Reset' and 'Retry-After' headers, even
* if the rate limit is not exceeded.
* @param $maxAttempts
* @param $remainingAttempts
* @param $retryAfter
* @param Response|null $response
* @return array|int[]
*/
protected function getHeaders($maxAttempts, $remainingAttempts, $retryAfter = null, ?Response $response = null)
{
if ($response &&
! is_null($response->headers->get('X-RateLimit-Remaining')) &&
(int) $response->headers->get('X-RateLimit-Remaining') <= (int) $remainingAttempts) {
$headers = [];
$headers['Retry-After'] = $retryAfter; // this is the only line we changed
$headers['X-RateLimit-Reset'] = $retryAfter; // this is the only line we changed
$headers['X-RateLimit-Reset-Timestamp'] = $this->availableAt($retryAfter); // this is the only line we changed
return $headers;
}
$headers = [
'X-RateLimit-Limit' => $maxAttempts,
'X-RateLimit-Remaining' => $remainingAttempts,
];
if (! is_null($retryAfter)) {
$headers['Retry-After'] = $retryAfter;
$headers['X-RateLimit-Reset'] = $retryAfter; // this is the only line we changed
$headers['X-RateLimit-Reset-Timestamp'] = $this->availableAt($retryAfter); // this is the only line we changed
}
return $headers;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
protected function handleRequest($request, Closure $next, array $limits)
{
foreach ($limits as $limit) {
if ($this->limiter->tooManyAttempts($limit->key, $limit->maxAttempts)) {
throw $this->buildException($request, $limit->key, $limit->maxAttempts, $limit->responseCallback);
}
$this->limiter->hit($limit->key, $limit->decaySeconds);
}
$response = $next($request);
foreach ($limits as $limit) {
$response = $this->addHeaders(
$response,
$limit->maxAttempts,
$this->calculateRemainingAttempts($limit->key, $limit->maxAttempts),
$this->getTimeUntilNextRetry($limit->key) // this is the only line we changed
);
}
return $response;
}
}
+22 -11
View File
@@ -41,6 +41,7 @@ class SettingsSamlRequest extends FormRequest
public function withValidator($validator)
{
$validator->after(function ($validator) {
$setting = Setting::getSettings();
if ($this->input('saml_enabled') == '1') {
$idpMetadata = $this->input('saml_idp_metadata');
if (! empty($idpMetadata)) {
@@ -56,7 +57,7 @@ class SettingsSamlRequest extends FormRequest
}
}
$was_custom_x509cert = strpos(Setting::getSettings()->saml_custom_settings, 'sp_x509cert') !== false;
$was_custom_x509cert = strpos($setting->saml_custom_settings, 'sp_x509cert') !== false;
$custom_x509cert = '';
$custom_privateKey = '';
@@ -126,10 +127,14 @@ class SettingsSamlRequest extends FormRequest
}
if (! (empty($x509cert) && empty($privateKey))) {
$this->merge([
'saml_sp_x509cert' => $x509cert,
'saml_sp_privatekey' => $privateKey,
]);
// $this->merge([
// 'saml_sp_x509cert' => $x509cert,
// 'saml_sp_privatekey' => $privateKey,
// ]);
$setting->saml_sp_x509cert = $x509cert;
$setting->saml_sp_privatekey = $privateKey;
$setting->save();
}
} else {
$validator->errors()->add('saml_integration', 'openssl.cnf is missing/invalid');
@@ -145,15 +150,21 @@ class SettingsSamlRequest extends FormRequest
}
if (! empty($x509certNew)) {
$this->merge([
'saml_sp_x509certNew' => $x509certNew,
]);
// $this->merge([
// 'saml_sp_x509certNew' => $x509certNew,
// ]);
$setting->saml_sp_x509certNew = $x509certNew;
$setting->save();
}
} else {
$this->merge([
'saml_sp_x509certNew' => '',
]);
// $this->merge([
// 'saml_sp_x509certNew' => '',
// ]);
$setting->saml_sp_x509certNew = '';
$setting->save();
}
});
}
}
+2 -2
View File
@@ -37,8 +37,8 @@ class StoreLabelSettings extends FormRequest
return [
'labels_per_page' => 'numeric',
'labels_width' => 'numeric',
'labels_height' => 'numeric',
'labels_width' => 'numeric|min:0.1',
'labels_height' => 'numeric|min:0.1',
'labels_pmargin_left' => 'numeric|nullable',
'labels_pmargin_right' => 'numeric|nullable',
'labels_pmargin_top' => 'numeric|nullable',
@@ -5,6 +5,7 @@ namespace App\Http\Requests;
use App\Models\Accessory;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\Rule;
class StoreNotificationSettings extends FormRequest
{
@@ -26,6 +27,9 @@ class StoreNotificationSettings extends FormRequest
return [
'alert_email' => 'email_array|nullable',
'admin_cc_email' => 'email_array|nullable',
'admin_cc_always' => [
Rule::in('0', '1'),
],
'alert_threshold' => 'numeric|nullable',
'alert_interval' => 'numeric|nullable|gt:0',
'audit_warning_days' => 'numeric|nullable',
+43 -21
View File
@@ -6,6 +6,7 @@ use App\Http\Traits\ConvertsBase64ToFiles;
use enshrined\svgSanitize\Sanitizer;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Log;
use \App\Helpers\Helper;
class UploadFileRequest extends Request
{
@@ -27,44 +28,65 @@ class UploadFileRequest extends Request
*/
public function rules()
{
$max_file_size = \App\Helpers\Helper::file_upload_max_size();
$max_file_size = Helper::file_upload_max_size();
return [
'file.*' => 'required|mimes:png,gif,jpg,svg,jpeg,doc,docx,pdf,txt,zip,rar,xls,xlsx,lic,xml,rtf,json,webp,avif|max:'.$max_file_size,
'file.*' => 'required|mimes:png,gif,jpg,svg,jpeg,doc,docx,pdf,txt,zip,rar,xls,xlsx,lic,xml,rtf,json,webp,avif|max:'.$max_file_size,
];
}
/**
* Sanitizes (if needed) and Saves a file to the appropriate location
* Returns the 'short' (storage-relative) filename
*
* TODO - this has a lot of similarities to UploadImageRequest's handleImage; is there
* a way to merge them or extend one into the other?
*/
public function handleFile(string $dirname, string $name_prefix, $file): string
{
$extension = $file->getClientOriginalExtension();
$file_name = $name_prefix.'-'.str_random(8).'-'.str_slug(basename($file->getClientOriginalName(), '.'.$extension)).'.'.$file->guessExtension();
// Check for SVG and sanitize it
if ($file->getMimeType() === 'image/svg+xml') {
Log::debug('This is an SVG');
Log::debug($file_name);
$sanitizer = new Sanitizer();
$dirtySVG = file_get_contents($file->getRealPath());
$cleanSVG = $sanitizer->sanitize($dirtySVG);
try {
Storage::put($dirname.$file_name, $cleanSVG);
} catch (\Exception $e) {
Log::debug('Upload no workie :( ');
Log::debug($e);
}
$uploaded_file = $this->handleSVG($file);
} else {
$put_results = Storage::put($dirname.$file_name, file_get_contents($file));
$uploaded_file = file_get_contents($file);
}
try {
Storage::put($dirname.$file_name, $uploaded_file);
} catch (\Exception $e) {
Log::debug($e);
}
return $file_name;
}
}
public function handleSVG($file)
{
$sanitizer = new Sanitizer();
$dirtySVG = file_get_contents($file->getRealPath());
return $sanitizer->sanitize($dirtySVG);
}
/**
* Get the validation error messages that apply to the request, but
* replace the attribute name with the name of the file that was attempted and failed
* to make it clearer to the user which file is the bad one.
*
* @return array
*/
public function attributes(): array
{
$attributes = [];
if ($this->file) {
for ($i = 0; $i < count($this->file); $i++) {
$attributes['file.'.$i] = $this->file[$i]->getClientOriginalName();
}
}
return $attributes;
}
}
@@ -59,7 +59,10 @@ class AssetMaintenancesTransformer
'name'=> e($assetmaintenance->asset->defaultLoc->name),
] : null,
'notes' => ($assetmaintenance->notes) ? Helper::parseEscapedMarkedownInline($assetmaintenance->notes) : null,
'supplier' => ($assetmaintenance->supplier) ? ['id' => $assetmaintenance->supplier->id, 'name'=> e($assetmaintenance->supplier->name)] : null,
'supplier' => ($assetmaintenance->supplier) ? [
'id' => $assetmaintenance->supplier->id,
'name'=> e($assetmaintenance->supplier->name)
] : null,
'cost' => Helper::formatCurrencyOutput($assetmaintenance->cost),
'asset_maintenance_type' => e($assetmaintenance->asset_maintenance_type),
'start_date' => Helper::getFormattedDateObject($assetmaintenance->start_date, 'date'),
+2 -1
View File
@@ -80,6 +80,7 @@ class AssetsTransformer
'qr' => ($setting->qr_code=='1') ? config('app.url').'/uploads/barcodes/qr-'.str_slug($asset->asset_tag).'-'.str_slug($asset->id).'.png' : null,
'alt_barcode' => ($setting->alt_barcode_enabled=='1') ? config('app.url').'/uploads/barcodes/'.str_slug($setting->alt_barcode).'-'.str_slug($asset->asset_tag).'.png' : null,
'assigned_to' => $this->transformAssignedTo($asset),
'jobtitle' => $asset->assigned ? e($asset->assigned->jobtitle) : null,
'warranty_months' => ($asset->warranty_months > 0) ? e($asset->warranty_months.' '.trans('admin/hardware/form.months')) : null,
'warranty_expires' => ($asset->warranty_months > 0) ? Helper::getFormattedDateObject($asset->warranty_expires, 'date') : null,
'created_by' => ($asset->adminuser) ? [
@@ -101,7 +102,7 @@ class AssetsTransformer
'checkout_counter' => (int) $asset->checkout_counter,
'requests_counter' => (int) $asset->requests_counter,
'user_can_checkout' => (bool) $asset->availableForCheckout(),
'book_value' => Helper::formatCurrencyOutput($asset->getLinearDepreciatedValue()),
'book_value' => Helper::formatCurrencyOutput($asset->getDepreciatedValue()),
];
@@ -4,6 +4,10 @@ namespace App\Http\Transformers;
class DatatablesTransformer
{
/**
* Transform data for bootstrap tables and API responses for lists of things
**/
public function transformDatatables($objects, $total = null)
{
(isset($total)) ? $objects_array['total'] = $total : $objects_array['total'] = count($objects);
@@ -11,4 +15,15 @@ class DatatablesTransformer
return $objects_array;
}
}
/**
* Transform data for returning the status of items within a bulk action
**/
public function transformBulkResponseWithStatusAndObjects($objects, $total)
{
(isset($total)) ? $objects_array['total'] = $total : $objects_array['total'] = count($objects);
$objects_array['rows'] = $objects;
return $objects_array;
}
}
@@ -57,6 +57,10 @@ class LocationsTransformer
'ldap_ou' => ($location->ldap_ou) ? e($location->ldap_ou) : null,
'notes' => Helper::parseEscapedMarkedownInline($location->notes),
'created_at' => Helper::getFormattedDateObject($location->created_at, 'datetime'),
'created_by' => $location->adminuser ? [
'id' => (int) $location->adminuser->id,
'name'=> e($location->adminuser->present()->fullName),
]: null,
'updated_at' => Helper::getFormattedDateObject($location->updated_at, 'datetime'),
'parent' => ($location->parent) ? [
'id' => (int) $location->parent->id,
@@ -0,0 +1,43 @@
<?php
namespace App\Http\Transformers;
use App\Helpers\Helper;
use App\Models\Actionlog;
use App\Models\Asset;
use Illuminate\Database\Eloquent\Collection;
class ProfileTransformer
{
public function transformFiles(Collection $files, $total)
{
$array = [];
foreach ($files as $file) {
$array[] = self::transformFile($file);
}
return (new DatatablesTransformer)->transformDatatables($array, $total);
}
public function transformFile(Actionlog $file)
{
$array = [
'id' => (int) $file->id,
'icon' => Helper::filetype_icon($file->filename),
'item' => ($file->item) ? [
'name' => ($file->itemType()=='user') ? e($file->item->getFullNameAttribute()) : e($file->item->getDisplayNameAttribute()),
'type' => e($file->itemType()),
] : null,
'filename' => e($file->filename),
'signature_file' => ($file->accept_signature) ? route('profile.signature.view', ['filename' => $file->accept_signature ]) : null,
'note' => e($file->note),
'url' => route('profile.storedeula.download', ['filename' => $file->filename]),
'file' => route('profile.storedeula.download', ['filename' => $file->filename]),
'created_at' => Helper::getFormattedDateObject($file->created_at, 'datetime'),
];
return $array;
}
}
@@ -45,6 +45,10 @@ class SuppliersTransformer
'components_count' => (int) $supplier->components_count,
'notes' => ($supplier->notes) ? Helper::parseEscapedMarkedownInline($supplier->notes) : null,
'created_at' => Helper::getFormattedDateObject($supplier->created_at, 'datetime'),
'created_by' => $supplier->adminuser ? [
'id' => (int) $supplier->adminuser->id,
'name'=> e($supplier->adminuser->present()->fullName),
]: null,
'updated_at' => Helper::getFormattedDateObject($supplier->updated_at, 'datetime'),
];
@@ -3,10 +3,10 @@
namespace App\Http\Transformers;
use App\Helpers\Helper;
use App\Helpers\StorageHelper;
use App\Models\Actionlog;
use App\Models\Asset;
use Illuminate\Support\Facades\Gate;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Storage;
class UploadedFilesTransformer
@@ -26,23 +26,26 @@ class UploadedFilesTransformer
{
$snipeModel = $file->item_type;
// This will be used later as we extend out this transformer to handle more types of uploads
if ($file->item_type == Asset::class) {
$file_url = route('show/assetfile', [$file->item_id, $file->id]);
}
$array = [
'id' => (int) $file->id,
'icon' => Helper::filetype_icon($file->filename),
'name' => e($file->filename),
'item' => ($file->item_type) ? [
'id' => (int) $file->item_id,
'type' => strtolower(class_basename($file->item_type)),
] : null,
'filename' => e($file->filename),
'url' => $file_url,
'filetype' => StorageHelper::getFiletype($file->uploads_file_path()),
'url' => $file->uploads_file_url(),
'note' => ($file->note) ? e($file->note) : null,
'created_by' => ($file->adminuser) ? [
'id' => (int) $file->adminuser->id,
'name'=> e($file->adminuser->present()->fullName),
] : null,
'created_at' => Helper::getFormattedDateObject($file->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($file->updated_at, 'datetime'),
'deleted_at' => Helper::getFormattedDateObject($file->deleted_at, 'datetime'),
'inline' => StorageHelper::allowSafeInline($file->uploads_file_path()),
'exists_on_disk' => (Storage::exists($file->uploads_file_path()) ? true : false),
];
$permissions_array['available_actions'] = [
@@ -53,4 +56,5 @@ class UploadedFilesTransformer
return $array;
}
}
}
@@ -50,6 +50,10 @@ class UsersTransformer
'id' => (int) $user->department->id,
'name'=> e($user->department->name),
] : null,
'department_manager' => ($user->department?->manager) ? [
'id' => (int) $user->department->manager->id,
'name'=> e($user->department->manager->full_name),
] : null,
'location' => ($user->userloc) ? [
'id' => (int) $user->userloc->id,
'name'=> e($user->userloc->name),
+10 -1
View File
@@ -80,7 +80,16 @@ class AssetImporter extends ItemImporter
$asset_tag = Asset::autoincrement_asset();
}
$asset = Asset::where(['asset_tag'=> (string) $asset_tag])->first();
if ($this->findCsvMatch($row, 'id')!='') {
// Override asset if an ID was given
\Log::debug('Finding asset by ID: '.$this->findCsvMatch($row, 'id'));
$asset = Asset::find($this->findCsvMatch($row, 'id'));
} else {
$asset = Asset::where(['asset_tag'=> (string) $asset_tag])->first();
}
if ($asset) {
if (! $this->updating) {
$exists_error = trans('general.import_asset_tag_exists', ['asset_tag' => $asset_tag]);
+99
View File
@@ -0,0 +1,99 @@
<?php
namespace App\Importer;
use App\Models\Category;
use Illuminate\Support\Facades\Log;
/**
* When we are importing users via an Asset/etc import, we use createOrFetchUser() in
* Importer\Importer.php. [ALG]
*
* Class CategoryImporter
*/
class CategoryImporter extends ItemImporter
{
protected $categories;
public function __construct($filename)
{
parent::__construct($filename);
}
protected function handle($row)
{
parent::handle($row);
$this->createCategoryIfNotExists($row);
}
/**
* Create a category if a duplicate does not exist.
* @todo Investigate how this should interact with Importer::createCategoryIfNotExists
*
* @author A. Gianotto
* @since 6.1.0
* @param array $row
*/
public function createCategoryIfNotExists(array $row)
{
$editingCategory = false;
$category = Category::where('name', '=', $this->findCsvMatch($row, 'name'))->first();
if ($this->findCsvMatch($row, 'id')!='') {
// Override category if an ID was given
\Log::debug('Finding category by ID: '.$this->findCsvMatch($row, 'id'));
$category = Category::find($this->findCsvMatch($row, 'id'));
}
if ($category) {
if (! $this->updating) {
$this->log('A matching Category '.$this->item['name'].' already exists');
return;
}
$this->log('Updating Category');
$editingCategory = true;
} else {
$this->log('No Matching Category, Create a new one');
$category = new Category;
$category->created_by = auth()->id();
}
// Pull the records from the CSV to determine their values
$this->item['name'] = trim($this->findCsvMatch($row, 'name'));
$this->item['notes'] = trim($this->findCsvMatch($row, 'notes'));
$this->item['eula_text'] = trim($this->findCsvMatch($row, 'eula_text'));
$this->item['category_type'] = trim(strtolower($this->findCsvMatch($row, 'category_type')));
$this->item['use_default_eula'] = trim(($this->fetchHumanBoolean($this->findCsvMatch($row, 'use_default_eula'))) == 1) ? 1 : 0;
$this->item['require_acceptance'] = trim(($this->fetchHumanBoolean($this->findCsvMatch($row, 'require_acceptance'))) == 1) ? 1 : 0;
$this->item['checkin_email'] = trim(($this->fetchHumanBoolean($this->findCsvMatch($row, 'checkin_email'))) == 1) ? 1 : 0;
Log::debug('Item array is: ');
Log::debug(print_r($this->item, true));
if ($editingCategory) {
Log::debug('Updating existing category');
$category->update($this->sanitizeItemForUpdating($category));
} else {
Log::debug('Creating category');
$category->fill($this->sanitizeItemForStoring($category));
}
if ($category->save()) {
$this->log('Category '.$category->name.' created or updated from CSV import');
return $category;
} else {
Log::debug($category->getErrors());
$this->logError($category, 'Category "'.$this->item['name'].'"');
return $category->errors;
}
}
}
+1
View File
@@ -88,6 +88,7 @@ abstract class Importer
'department' => 'department',
'manager_name' => 'manager full name',
'manager_username' => 'manager username',
'manager_employee_num' => 'manager employee number',
'min_amt' => 'minimum quantity',
'remote' => 'remote',
'vip' => 'vip',
+16 -5
View File
@@ -110,7 +110,7 @@ class ItemImporter extends Importer
protected function determineCheckout($row)
{
// Locations don't get checked out to anyone/anything
if ((get_class($this) == LocationImporter::class) || (get_class($this) == AssetModelImporter::class)) {
if ((get_class($this) == LocationImporter::class) || (get_class($this) == AssetModelImporter::class) || (get_class($this) == SupplierImporter::class) || (get_class($this) == ManufacturerImporter::class) || (get_class($this) == CategoryImporter::class)) {
return;
}
@@ -353,16 +353,27 @@ class ItemImporter extends Importer
* @param $user_manager string
* @return int id of company created/found
*/
public function fetchManager($user_manager_first_name, $user_manager_last_name)
public function fetchManager($user_manager_username = null, $user_manager_employee_num = null, $user_manager_first_name = null, $user_manager_last_name = null)
{
$manager = User::where('first_name', '=', $user_manager_first_name)
->where('last_name', '=', $user_manager_last_name)->first();
if ($user_manager_username!='') {
$manager = User::where('username', '=', $user_manager_username)->first();
$this->log('Checking on username '.$user_manager_username);
} elseif ($user_manager_employee_num!='') {
$manager = User::where('employee_num', '=', $user_manager_employee_num)->first();
$this->log('Checking on employee_num '.$user_manager_employee_num);
} else {
$manager = User::where('first_name', '=', $user_manager_first_name)
->where('last_name', '=', $user_manager_last_name)->first();
$this->log('Checking on full name');
}
if ($manager) {
$this->log('A matching Manager '.$user_manager_first_name.' '.$user_manager_last_name.' already exists');
return $manager->id;
}
$this->log('No matching Manager '.$user_manager_first_name.' '.$user_manager_last_name.' found. If their user account is being created through this import, you should re-process this file again. ');
$this->log('No matching Manager found. If their user account is being created through this import, you should re-process this file again. ');
return null;
}
+101
View File
@@ -0,0 +1,101 @@
<?php
namespace App\Importer;
use App\Models\Manufacturer;
use Illuminate\Support\Facades\Log;
/**
* When we are importing users via an Asset/etc import, we use createOrFetchUser() in
* Importer\Importer.php. [ALG]
*
* Class ManufacturerImporter
*/
class ManufacturerImporter extends ItemImporter
{
protected $manufacturers;
public function __construct($filename)
{
parent::__construct($filename);
}
protected function handle($row)
{
parent::handle($row);
$this->createManufacturerIfNotExists($row);
}
/**
* Create a supplier if a duplicate does not exist.
* @todo Investigate how this should interact with Importer::createManufacturerIfNotExists
*
* @author A. Gianotto
* @since 6.1.0
* @param array $row
*/
public function createManufacturerIfNotExists(array $row)
{
$editingManufacturer = false;
$supplier = Manufacturer::where('name', '=', $this->findCsvMatch($row, 'name'))->first();
if ($this->findCsvMatch($row, 'id')!='') {
// Override supplier if an ID was given
\Log::debug('Finding supplier by ID: '.$this->findCsvMatch($row, 'id'));
$supplier = Manufacturer::find($this->findCsvMatch($row, 'id'));
}
if ($supplier) {
if (! $this->updating) {
$this->log('A matching Manufacturer '.$this->item['name'].' already exists');
return;
}
$this->log('Updating Manufacturer');
$editingManufacturer = true;
} else {
$this->log('No Matching Manufacturer, Create a new one');
$supplier = new Manufacturer;
$supplier->created_by = auth()->id();
}
// Pull the records from the CSV to determine their values
$this->item['name'] = trim($this->findCsvMatch($row, 'name'));
$this->item['support_phone'] = trim($this->findCsvMatch($row, 'support_phone'));
$this->item['fax'] = trim($this->findCsvMatch($row, 'fax'));
$this->item['support_email'] = trim($this->findCsvMatch($row, 'support_email'));
$this->item['contact'] = trim($this->findCsvMatch($row, 'contact'));
$this->item['url'] = trim($this->findCsvMatch($row, 'url'));
$this->item['support_url'] = trim($this->findCsvMatch($row, 'support_url'));
$this->item['warranty_lookup_url'] = trim($this->findCsvMatch($row, 'warranty_lookup_url'));
$this->item['notes'] = trim($this->findCsvMatch($row, 'notes'));
Log::debug('Item array is: ');
Log::debug(print_r($this->item, true));
if ($editingManufacturer) {
Log::debug('Updating existing supplier');
$supplier->update($this->sanitizeItemForUpdating($supplier));
} else {
Log::debug('Creating supplier');
$supplier->fill($this->sanitizeItemForStoring($supplier));
}
if ($supplier->save()) {
$this->log('Manufacturer '.$supplier->name.' created or updated from CSV import');
return $supplier;
} else {
Log::debug($supplier->getErrors());
$this->logError($supplier, 'Manufacturer "'.$this->item['name'].'"');
return $supplier->errors;
}
}
}
+105
View File
@@ -0,0 +1,105 @@
<?php
namespace App\Importer;
use App\Models\Supplier;
use Illuminate\Support\Facades\Log;
/**
* When we are importing users via an Asset/etc import, we use createOrFetchUser() in
* Importer\Importer.php. [ALG]
*
* Class SupplierImporter
*/
class SupplierImporter extends ItemImporter
{
protected $suppliers;
public function __construct($filename)
{
parent::__construct($filename);
}
protected function handle($row)
{
parent::handle($row);
$this->createSupplierIfNotExists($row);
}
/**
* Create a supplier if a duplicate does not exist.
* @todo Investigate how this should interact with Importer::createSupplierIfNotExists
*
* @author A. Gianotto
* @since 6.1.0
* @param array $row
*/
public function createSupplierIfNotExists(array $row)
{
$editingSupplier = false;
$supplier = Supplier::where('name', '=', $this->findCsvMatch($row, 'name'))->first();
if ($this->findCsvMatch($row, 'id')!='') {
// Override supplier if an ID was given
\Log::debug('Finding supplier by ID: '.$this->findCsvMatch($row, 'id'));
$supplier = Supplier::find($this->findCsvMatch($row, 'id'));
}
if ($supplier) {
if (! $this->updating) {
$this->log('A matching Supplier '.$this->item['name'].' already exists');
return;
}
$this->log('Updating Supplier');
$editingSupplier = true;
} else {
$this->log('No Matching Supplier, Create a new one');
$supplier = new Supplier;
$supplier->created_by = auth()->id();
}
// Pull the records from the CSV to determine their values
$this->item['name'] = trim($this->findCsvMatch($row, 'name'));
$this->item['address'] = trim($this->findCsvMatch($row, 'address'));
$this->item['address2'] = trim($this->findCsvMatch($row, 'address2'));
$this->item['city'] = trim($this->findCsvMatch($row, 'city'));
$this->item['state'] = trim($this->findCsvMatch($row, 'state'));
$this->item['country'] = trim($this->findCsvMatch($row, 'country'));
$this->item['zip'] = trim($this->findCsvMatch($row, 'zip'));
$this->item['phone'] = trim($this->findCsvMatch($row, 'phone'));
$this->item['fax'] = trim($this->findCsvMatch($row, 'fax'));
$this->item['email'] = trim($this->findCsvMatch($row, 'email'));
$this->item['contact'] = trim($this->findCsvMatch($row, 'contact'));
$this->item['url'] = trim($this->findCsvMatch($row, 'url'));
$this->item['notes'] = trim($this->findCsvMatch($row, 'notes'));
Log::debug('Item array is: ');
Log::debug(print_r($this->item, true));
if ($editingSupplier) {
Log::debug('Updating existing supplier');
$supplier->update($this->sanitizeItemForUpdating($supplier));
} else {
Log::debug('Creating supplier');
$supplier->fill($this->sanitizeItemForStoring($supplier));
}
if ($supplier->save()) {
$this->log('Supplier '.$supplier->name.' created or updated from CSV import');
return $supplier;
} else {
Log::debug($supplier->getErrors());
$this->logError($supplier, 'Supplier "'.$this->item['name'].'"');
return $supplier->errors;
}
}
}
+1 -1
View File
@@ -62,7 +62,7 @@ class UserImporter extends ItemImporter
$this->item['activated'] = ($this->fetchHumanBoolean(trim($this->findCsvMatch($row, 'activated'))) == 1) ? '1' : 0;
$this->item['employee_num'] = trim($this->findCsvMatch($row, 'employee_num'));
$this->item['department_id'] = trim($this->createOrFetchDepartment(trim($this->findCsvMatch($row, 'department'))));
$this->item['manager_id'] = $this->fetchManager(trim($this->findCsvMatch($row, 'manager_first_name')), trim($this->findCsvMatch($row, 'manager_last_name')));
$this->item['manager_id'] = $this->fetchManager(trim($this->findCsvMatch($row, 'manager_username')), trim($this->findCsvMatch($row, 'manager_employee_num')), trim($this->findCsvMatch($row, 'manager_first_name')), trim($this->findCsvMatch($row, 'manager_last_name')));
$this->item['remote'] = ($this->fetchHumanBoolean(trim($this->findCsvMatch($row, 'remote'))) == 1 ) ? '1' : 0;
$this->item['vip'] = ($this->fetchHumanBoolean(trim($this->findCsvMatch($row, 'vip'))) ==1 ) ? '1' : 0;
$this->item['autoassign_licenses'] = ($this->fetchHumanBoolean(trim($this->findCsvMatch($row, 'autoassign_licenses'))) ==1 ) ? '1' : 0;
+34 -22
View File
@@ -12,6 +12,7 @@ use App\Mail\CheckoutConsumableMail;
use App\Mail\CheckoutLicenseMail;
use App\Models\Accessory;
use App\Models\Asset;
use App\Models\Category;
use App\Models\CheckoutAcceptance;
use App\Models\Component;
use App\Models\Consumable;
@@ -69,16 +70,16 @@ class CheckoutableListener
return;
}
$acceptance = $this->getCheckoutAcceptance($event);
$shouldSendEmailToUser = $this->shouldSendCheckoutEmailToUser($event->checkoutable);
$shouldSendEmailToAlertAddress = $this->shouldSendEmailToAlertAddress();
$shouldSendEmailToAlertAddress = $this->shouldSendEmailToAlertAddress($acceptance);
$shouldSendWebhookNotification = $this->shouldSendWebhookNotification();
if (!$shouldSendEmailToUser && !$shouldSendEmailToAlertAddress && !$shouldSendWebhookNotification) {
return;
}
$acceptance = $this->getCheckoutAcceptance($event);
if ($shouldSendEmailToUser || $shouldSendEmailToAlertAddress) {
$mailable = $this->getCheckoutMailType($event, $acceptance);
$notifiable = $this->getNotifiableUser($event);
@@ -227,6 +228,7 @@ class CheckoutableListener
if ($checkedOutToType != "App\Models\User") {
return null;
}
if (!$event->checkoutable->requireAcceptance()) {
return null;
}
@@ -234,6 +236,13 @@ class CheckoutableListener
$acceptance = new CheckoutAcceptance;
$acceptance->checkoutable()->associate($event->checkoutable);
$acceptance->assignedTo()->associate($event->checkedOutTo);
$category = $this->getCategoryFromCheckoutable($event->checkoutable);
if ($category?->alert_on_response) {
$acceptance->alert_on_response_id = auth()->id();
}
$acceptance->save();
return $acceptance;
@@ -360,23 +369,6 @@ class CheckoutableListener
return in_array(get_class($checkoutable), $this->skipNotificationsFor);
}
private function shouldSendEmailNotifications(Model $checkoutable): bool
{
//runs a check if the category wants to send checkin/checkout emails to users
$category = match (true) {
$checkoutable instanceof Asset => $checkoutable->model->category,
$checkoutable instanceof Accessory,
$checkoutable instanceof Consumable => $checkoutable->category,
$checkoutable instanceof LicenseSeat => $checkoutable->license->category,
default => null,
};
if (!$category?->checkin_email) {
return false;
}
return true;
}
private function shouldSendWebhookNotification(): bool
{
return Setting::getSettings() && Setting::getSettings()->webhook_endpoint;
@@ -419,9 +411,19 @@ class CheckoutableListener
return false;
}
private function shouldSendEmailToAlertAddress(): bool
private function shouldSendEmailToAlertAddress($acceptance = null): bool
{
return Setting::getSettings() && Setting::getSettings()->admin_cc_email;
$setting = Setting::getSettings();
if (!$setting) {
return false;
}
if (is_null($acceptance) && !$setting->admin_cc_always) {
return false;
}
return (bool) $setting->admin_cc_email;
}
private function getFormattedAlertAddresses(): array
@@ -461,4 +463,14 @@ class CheckoutableListener
return array($to, $cc);
}
private function getCategoryFromCheckoutable(Model $checkoutable): ?Category
{
return match (true) {
$checkoutable instanceof Asset => $checkoutable->model->category,
$checkoutable instanceof Accessory,
$checkoutable instanceof Consumable => $checkoutable->category,
$checkoutable instanceof LicenseSeat => $checkoutable->license->category,
};
}
}
+2
View File
@@ -6,6 +6,8 @@ use Livewire\Component;
class CategoryEditForm extends Component
{
public bool $alertOnResponse;
public $defaultEulaText;
public $eulaText;
+63 -8
View File
@@ -35,10 +35,14 @@ class Importer extends Component
public $accessories_fields;
public $assets_fields;
public $users_fields;
public $assetmodels_fields;
public $suppliers_fields;
public $licenses_fields;
public $locations_fields;
public $consumables_fields;
public $components_fields;
public $manufacturers_fields;
public $categories_fields;
public $aliases_fields;
protected $rules = [
@@ -85,9 +89,6 @@ class Importer extends Component
case 'component':
$results = $this->components_fields;
break;
case 'consumable':
$results = $this->consumables_fields;
break;
case 'license':
$results = $this->licenses_fields;
break;
@@ -97,8 +98,14 @@ class Importer extends Component
case 'location':
$results = $this->locations_fields;
break;
case 'user':
$results = $this->users_fields;
case 'supplier':
$results = $this->suppliers_fields;
break;
case 'manufacturer':
$results = $this->manufacturers_fields;
break;
case 'category':
$results = $this->categories_fields;
break;
default:
$results = [];
@@ -128,7 +135,7 @@ class Importer extends Component
//yes, this key *is* valid. Continue on to the next field.
continue;
} else {
//no, this key is *INVALID* for this import type. Better set it to null
//no, this key is *INVALID* for this import type. Better set it to null,
// and we'll hope that the $aliases_fields or something else picks it up.
$this->field_map[$i] = null; // fingers crossed! But it's not likely, tbh.
} // TODO - strictly speaking, this isn't necessary here I don't think.
@@ -149,7 +156,7 @@ class Importer extends Component
// in "Accessories"!)
if (array_key_exists($key, $this->columnOptions[$type])) {
$this->field_map[$i] = $key;
continue 3; // bust out of both of these loops; as well as the surrounding one - e.g. move on to the next header
continue 3; // bust out of both of these loops and the surrounding one - e.g. move on to the next header
}
}
}
@@ -171,6 +178,9 @@ class Importer extends Component
'license' => trans('general.licenses'),
'location' => trans('general.locations'),
'user' => trans('general.users'),
'supplier' => trans('general.suppliers'),
'manufacturer' => trans('general.manufacturers'),
'category' => trans('general.categories'),
];
/**
@@ -193,6 +203,7 @@ class Importer extends Component
];
$this->assets_fields = [
'id' => trans('general.id'),
'asset_eol_date' => trans('admin/hardware/form.eol_date'),
'asset_model' => trans('general.model_name'),
'asset_notes' => trans('general.item_notes', ['item' => trans('admin/hardware/general.asset')]),
@@ -319,6 +330,8 @@ class Importer extends Component
'location' => trans('general.location'),
'manager_first_name' => trans('general.importer.manager_first_name'),
'manager_last_name' => trans('general.importer.manager_last_name'),
'manager_employee_num' => trans('general.importer.manager_employee_num'),
'manager_username' => trans('general.importer.manager_username'),
'notes' => trans('general.notes'),
'phone_number' => trans('admin/users/table.phone'),
'remote' => trans('admin/users/general.remote'),
@@ -332,6 +345,7 @@ class Importer extends Component
$this->locations_fields = [
'id' => trans('general.id'),
'name' => trans('general.name'),
'address' => trans('general.address'),
'address2' => trans('general.importer.address2'),
'city' => trans('general.city'),
@@ -340,13 +354,52 @@ class Importer extends Component
'ldap_ou' => trans('admin/locations/table.ldap_ou'),
'manager' => trans('general.importer.manager_full_name'),
'manager_username' => trans('general.importer.manager_username'),
'name' => trans('general.item_name_var', ['item' => trans('general.location')]),
'notes' => trans('general.notes'),
'parent_location' => trans('admin/locations/table.parent'),
'state' => trans('general.state'),
'zip' => trans('general.zip'),
];
$this->suppliers_fields = [
'id' => trans('general.id'),
'name' => trans('general.name'),
'address' => trans('general.address'),
'address2' => trans('general.importer.address2'),
'city' => trans('general.city'),
'notes' => trans('general.notes'),
'state' => trans('general.state'),
'zip' => trans('general.zip'),
'phone' => trans('general.phone'),
'fax' => trans('general.fax'),
'url' => trans('general.url'),
'contact' => trans('general.contact'),
'email' => trans('general.email'),
];
$this->manufacturers_fields = [
'id' => trans('general.id'),
'name' => trans('general.name'),
'notes' => trans('general.notes'),
'support_phone' => trans('admin/manufacturers/table.support_phone'),
'support_url' => trans('admin/manufacturers/table.support_url'),
'support_email' => trans('admin/manufacturers/table.support_email'),
'warranty_lookup_url' => trans('admin/manufacturers/table.warranty_lookup_url'),
'url' => trans('general.url'),
];
$this->categories_fields = [
'id' => trans('general.id'),
'name' => trans('general.name'),
'notes' => trans('general.notes'),
'category_type' => trans('admin/categories/general.import_category_type'),
'eula_text' => trans('admin/categories/general.import_eula_text'),
'use_default_eula' => trans('admin/categories/general.use_default_eula_column'),
'require_acceptance' => trans('admin/categories/general.import_require_acceptance'),
'checkin_email' => trans('admin/categories/general.import_checkin_email'),
];
$this->assetmodels_fields = [
'category' => trans('general.category'),
'eol' => trans('general.eol'),
@@ -371,6 +424,8 @@ class Importer extends Component
'consumable name',
'component name',
'name',
'supplier name',
'location name',
],
'item_no' => [
'item number',
+2 -1
View File
@@ -10,15 +10,16 @@ class LocationScopeCheck extends Component
{
public $mismatched = [];
public $setting;
public $is_tested = false;
public function check_locations()
{
$this->mismatched = Helper::test_locations_fmcs(false);
$this->is_tested = true;
}
public function mount() {
$this->setting = Setting::getSettings();
$this->mismatched = Helper::test_locations_fmcs(false);
}
public function render()
@@ -0,0 +1,79 @@
<?php
namespace App\Mail;
use App\Models\CheckoutAcceptance;
use App\Models\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class CheckoutAcceptanceResponseMail extends Mailable
{
use Queueable, SerializesModels;
public CheckoutAcceptance $acceptance;
public User $recipient;
public bool $wasAccepted;
/**
* Create a new message instance.
*/
public function __construct(CheckoutAcceptance $acceptance, User $recipient, bool $wasAccepted)
{
$this->acceptance = $acceptance;
$this->recipient = $recipient;
$this->wasAccepted = $wasAccepted;
}
/**
* Get the message envelope.
*/
public function envelope(): Envelope
{
$subject = $this->wasAccepted
? trans('mail.initiated_accepted')
: trans('mail.initiated_declined');
return new Envelope(
subject: $subject,
);
}
/**
* Get the message content definition.
*/
public function content(): Content
{
return new Content(
markdown: 'mail.markdown.checkout-acceptance-response',
with: [
'assignedTo' => $this->acceptance->assignedTo,
'introduction' => $this->introduction(),
'item' => $this->acceptance->checkoutable,
'note' => $this->acceptance->note,
'recipient' => $this->recipient,
]
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
private function introduction(): string
{
return $this->wasAccepted
? trans('mail.following_accepted')
: trans('mail.following_declined');
}
}
+3 -19
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use App\Helpers\Helper;
use App\Models\Traits\Acceptable;
use App\Models\Traits\HasUploads;
use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -22,6 +23,7 @@ class Accessory extends SnipeModel
protected $presenter = \App\Presenters\AccessoryPresenter::class;
use CompanyableTrait;
use HasUploads;
use Loggable, Presentable;
use SoftDeletes;
@@ -102,24 +104,6 @@ class Accessory extends SnipeModel
];
/**
* Establishes the accessories -> action logs -> uploads relationship
*
* @author A. Gianotto <snipe@snipe.net>
* @since [v6.1.13]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function uploads()
{
return $this->hasMany(\App\Models\Actionlog::class, 'item_id')
->where('item_type', '=', self::class)
->where('action_type', '=', 'uploaded')
->whereNotNull('filename')
->orderBy('created_at', 'desc');
}
/**
* Establishes the accessory -> supplier relationship
*
@@ -308,7 +292,7 @@ class Accessory extends SnipeModel
*/
public function checkin_email()
{
return $this->category->checkin_email;
return $this->category?->checkin_email;
}
/**
+73 -12
View File
@@ -69,8 +69,8 @@ class Actionlog extends SnipeModel
*/
protected $searchableRelations = [
'company' => ['name'],
'adminuser' => ['first_name','last_name','username', 'email'],
'user' => ['first_name','last_name','username', 'email'],
'adminuser' => ['first_name','last_name','username', 'email', 'employee_num'],
'user' => ['first_name','last_name','username', 'email', 'employee_num'],
'assets' => ['asset_tag','name', 'serial', 'order_number', 'notes', 'purchase_date'],
'assets.model' => ['name', 'model_number', 'eol', 'notes'],
'assets.model.category' => ['name', 'notes'],
@@ -113,6 +113,11 @@ class Actionlog extends SnipeModel
} elseif (auth()->user() && auth()->user()->company) {
$actionlog->company_id = auth()->user()->company_id;
}
if ($actionlog->action_date == '') {
$actionlog->action_date = Carbon::now();
}
});
}
@@ -245,8 +250,8 @@ class Actionlog extends SnipeModel
public function uploads()
{
return $this->morphTo('item')
->where('action_type', '=', 'uploaded')
->withTrashed();
->where('action_type', '=', 'uploaded')
->withTrashed();
}
/**
@@ -271,7 +276,7 @@ class Actionlog extends SnipeModel
public function adminuser()
{
return $this->belongsTo(User::class, 'created_by')
->withTrashed();
->withTrashed();
}
/**
@@ -376,7 +381,7 @@ class Actionlog extends SnipeModel
if ($this->created_at > $override_default_next) {
$next_audit_days = '-'.$next_audit_days;
}
return $next_audit_days;
}
@@ -408,10 +413,10 @@ class Actionlog extends SnipeModel
public function getListingOfActionLogsChronologicalOrder()
{
return $this->all()
->where('action_type', '!=', 'uploaded')
->orderBy('item_id', 'asc')
->orderBy('created_at', 'asc')
->get();
->where('action_type', '!=', 'uploaded')
->orderBy('item_id', 'asc')
->orderBy('created_at', 'asc')
->get();
}
/**
@@ -434,7 +439,7 @@ class Actionlog extends SnipeModel
return 'api';
}
// This is probably NOT an API call
// This is probably NOT an API call
if (request()->filled('_token')) {
return 'gui';
}
@@ -444,6 +449,62 @@ class Actionlog extends SnipeModel
}
public function uploads_file_url()
{
switch ($this->item_type) {
case Accessory::class:
return route('show.accessoryfile', [$this->item_id, $this->id]);
case Asset::class:
return route('show/assetfile', [$this->item_id, $this->id]);
case AssetModel::class:
return route('show/modelfile', [$this->item_id, $this->id]);
case Consumable::class:
return route('show/locationsfile', [$this->item_id, $this->id]);
case Component::class:
return route('show.componentfile', [$this->item_id, $this->id]);
case License::class:
return route('show.licensefile', [$this->item_id, $this->id]);
case Location::class:
return route('show/locationsfile', [$this->item_id, $this->id]);
case User::class:
return route('show/userfile', [$this->item_id, $this->id]);
default:
return null;
}
}
public function uploads_file_path()
{
switch ($this->item_type) {
case Accessory::class:
return 'private_uploads/accessories/'.$this->filename;
case Asset::class:
return 'private_uploads/assets/'.$this->filename;
case AssetModel::class:
return 'private_uploads/assetmodels/'.$this->filename;
case Consumable::class:
return 'private_uploads/consumables/'.$this->filename;
case Component::class:
return 'private_uploads/components/'.$this->filename;
case License::class:
return 'private_uploads/licenses/'.$this->filename;
case Location::class:
return 'private_uploads/locations/'.$this->filename;
case User::class:
return 'private_uploads/users/'.$this->filename;
default:
return null;
}
}
// Manually sets $this->source for determineActionSource()
public function setActionSource($source = null): void
{
@@ -454,4 +515,4 @@ class Actionlog extends SnipeModel
{
return $query->leftJoin('users as admin_sort', 'action_logs.created_by', '=', 'admin_sort.id')->select('action_logs.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);
}
}
}
+24 -24
View File
@@ -7,19 +7,17 @@ use App\Exceptions\CheckoutNotAllowed;
use App\Helpers\Helper;
use App\Http\Traits\UniqueUndeletedTrait;
use App\Models\Traits\Acceptable;
use App\Models\Traits\HasUploads;
use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use App\Presenters\AssetPresenter;
use Illuminate\Support\Facades\Auth;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Storage;
use Watson\Validating\ValidatingTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Model;
/**
* Model for Assets.
@@ -33,6 +31,7 @@ class Asset extends Depreciable
protected $with = ['model', 'adminuser'];
use CompanyableTrait;
use HasUploads;
use HasFactory, Loggable, Requestable, Presentable, SoftDeletes, ValidatingTrait, UniqueUndeletedTrait;
public const LOCATION = 'location';
@@ -122,9 +121,9 @@ class Asset extends Depreciable
'assigned_to' => ['nullable', 'integer', 'required_with:assigned_type'],
'assigned_type' => ['nullable', 'required_with:assigned_to', 'in:'.User::class.",".Location::class.",".Asset::class],
'requestable' => ['nullable', 'boolean'],
'assigned_user' => ['nullable', 'exists:users,id,deleted_at,NULL'],
'assigned_location' => ['nullable', 'exists:locations,id,deleted_at,NULL', 'fmcs_location'],
'assigned_asset' => ['nullable', 'exists:assets,id,deleted_at,NULL']
'assigned_user' => ['integer', 'nullable', 'exists:users,id,deleted_at,NULL'],
'assigned_location' => ['integer', 'nullable', 'exists:locations,id,deleted_at,NULL', 'fmcs_location'],
'assigned_asset' => ['integer', 'nullable', 'exists:assets,id,deleted_at,NULL']
];
@@ -472,26 +471,10 @@ class Asset extends Depreciable
}
/**
* Get uploads for this asset
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function uploads()
{
return $this->hasMany('\App\Models\Actionlog', 'item_id')
->where('item_type', '=', Asset::class)
->where('action_type', '=', 'uploaded')
->whereNotNull('filename')
->orderBy('created_at', 'desc');
}
/**
* Determines whether the asset is checked out to a user
*
* Even though we allow allow for checkout to things beyond users
* Even though we allow for checkout to things beyond users
* this method is an easy way of seeing if we are checked out to a user.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
@@ -963,6 +946,7 @@ class Asset extends Depreciable
return $this->model->category->require_acceptance;
}
return false;
}
@@ -1129,6 +1113,7 @@ class Asset extends Depreciable
$query = $query
->orWhere('assets_users.first_name', 'LIKE', '%'.$term.'%')
->orWhere('assets_users.last_name', 'LIKE', '%'.$term.'%')
->orWhere('assets_users.jobtitle', 'LIKE', '%'.$term.'%')
->orWhere('assets_users.username', 'LIKE', '%'.$term.'%')
->orWhere('assets_users.employee_num', 'LIKE', '%'.$term.'%')
->orWhereMultipleColumns([
@@ -1585,11 +1570,13 @@ class Asset extends Depreciable
})->orWhere(function ($query) use ($search) {
$query->where('assets_users.first_name', 'LIKE', '%'.$search.'%')
->orWhere('assets_users.last_name', 'LIKE', '%'.$search.'%')
->orWhere('assets_users.username', 'LIKE', '%'.$search.'%')
->orWhere('assets_users.jobtitle', 'LIKE', '%'.$search.'%')
->orWhereMultipleColumns([
'assets_users.first_name',
'assets_users.last_name',
'assets_users.jobtitle',
], $search)
->orWhere('assets_users.username', 'LIKE', '%'.$search.'%')
->orWhere('assets_locations.name', 'LIKE', '%'.$search.'%')
->orWhere('assigned_assets.name', 'LIKE', '%'.$search.'%');
})->orWhere('assets.name', 'LIKE', '%'.$search.'%')
@@ -1972,6 +1959,19 @@ class Asset extends Depreciable
return $query->leftJoin('suppliers as suppliers_assets', 'assets.supplier_id', '=', 'suppliers_assets.id')->orderBy('suppliers_assets.name', $order);
}
/**
* Query builder scope to order on supplier name
*
* @param \Illuminate\Database\Query\Builder $query Query builder instance
* @param text $order Order
*
* @return \Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeOrderByJobTitle($query, $order)
{
return $query->leftJoin('users as users_sort', 'assets.assigned_to', '=', 'users_sort.id')->select('assets.*')->orderBy('users_sort.jobtitle', $order);
}
/**
* Query builder scope to search on location ID
*
+18 -2
View File
@@ -26,12 +26,12 @@ class AssetMaintenance extends Model implements ICompanyableChild
protected $table = 'asset_maintenances';
protected $rules = [
'asset_id' => 'required|integer',
'supplier_id' => 'required|integer',
'supplier_id' => 'nullable|integer',
'asset_maintenance_type' => 'required',
'title' => 'required|max:100',
'is_warranty' => 'boolean',
'start_date' => 'required|date_format:Y-m-d',
'completion_date' => 'date_format:Y-m-d|nullable',
'completion_date' => 'date_format:Y-m-d|nullable|after_or_equal:start_date',
'notes' => 'string|nullable',
'cost' => 'numeric|nullable',
];
@@ -166,6 +166,7 @@ class AssetMaintenance extends Model implements ICompanyableChild
return $this->belongsTo(\App\Models\Asset::class, 'asset_id')
->withTrashed();
}
/**
* Get the admin who created the maintenance
@@ -265,6 +266,21 @@ class AssetMaintenance extends Model implements ICompanyableChild
->orderBy('maintained_asset_status.name', $order);
}
/**
* Query builder scope to order on status label name
*
* @param \Illuminate\Database\Query\Builder $query Query builder instance
* @param text $order Order
*
* @return \Illuminate\Database\Query\Builder Modified query builder
*/
public function scopeOrderLocationName($query, $order)
{
return $query->join('assets as maintained_asset', 'asset_maintenances.asset_id', '=', 'maintained_asset.id')
->leftjoin('locations as maintained_asset_location', 'maintained_asset_location.id', '=', 'maintained_asset.location_id')
->orderBy('maintained_asset_location.name', $order);
}
/**
* Query builder scope to order on the user that created it
*/
+2 -15
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use App\Models\Traits\HasUploads;
use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -24,6 +25,7 @@ class AssetModel extends SnipeModel
use SoftDeletes;
use Loggable, Requestable, Presentable;
use TwoColumnUniqueUndeletedTrait;
use HasUploads;
/**
* Whether the model should inject its identifier to the unique
@@ -209,21 +211,6 @@ class AssetModel extends SnipeModel
&& ($this->deleted_at == '');
}
/**
* Get uploads for this model
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function uploads()
{
return $this->hasMany('\App\Models\Actionlog', 'item_id')
->where('item_type', '=', AssetModel::class)
->where('action_type', '=', 'uploaded')
->whereNotNull('filename')
->orderBy('created_at', 'desc');
}
/**
* Get user who created the item
+2
View File
@@ -32,6 +32,7 @@ class Category extends SnipeModel
protected $hidden = ['created_by', 'deleted_at'];
protected $casts = [
'alert_on_response' => 'boolean',
'created_by' => 'integer',
];
@@ -69,6 +70,7 @@ class Category extends SnipeModel
'eula_text',
'name',
'require_acceptance',
'alert_on_response',
'use_default_eula',
'created_by',
'notes',
+1
View File
@@ -15,6 +15,7 @@ class CheckoutAcceptance extends Model
protected $casts = [
'accepted_at' => 'datetime',
'declined_at' => 'datetime',
'alert_on_response_id' => 'integer',
];
/**
+1 -1
View File
@@ -160,7 +160,7 @@ final class Company extends SnipeModel
if (auth()->user()) {
Log::warning('Companyable is '.$companyable);
// Log::warning('Companyable is '.$companyable);
$current_user_company_id = auth()->user()->company_id;
$companyable_company_id = $companyable->company_id;
return $current_user_company_id == null || $current_user_company_id == $companyable_company_id || auth()->user()->isSuperUser();
+2 -15
View File
@@ -2,6 +2,7 @@
namespace App\Models;
use App\Models\Traits\HasUploads;
use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -20,6 +21,7 @@ class Component extends SnipeModel
protected $presenter = \App\Presenters\ComponentPresenter::class;
use CompanyableTrait;
use HasUploads;
use Loggable, Presentable;
use SoftDeletes;
protected $casts = [
@@ -113,21 +115,6 @@ class Component extends SnipeModel
&& ($this->deleted_at == '');
}
/**
* Establishes the components -> action logs -> uploads relationship
*
* @author A. Gianotto <snipe@snipe.net>
* @since [v6.1.13]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function uploads()
{
return $this->hasMany(\App\Models\Actionlog::class, 'item_id')
->where('item_type', '=', self::class)
->where('action_type', '=', 'uploaded')
->whereNotNull('filename')
->orderBy('created_at', 'desc');
}
/**
+3 -16
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use App\Helpers\Helper;
use App\Models\Traits\Acceptable;
use App\Models\Traits\HasUploads;
use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
@@ -29,6 +30,7 @@ class Consumable extends SnipeModel
use Loggable, Presentable;
use SoftDeletes;
use Acceptable;
use HasUploads;
protected $table = 'consumables';
protected $casts = [
@@ -111,21 +113,6 @@ class Consumable extends SnipeModel
];
/**
* Establishes the components -> action logs -> uploads relationship
*
* @author A. Gianotto <snipe@snipe.net>
* @since [v6.1.13]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function uploads()
{
return $this->hasMany(Actionlog::class, 'item_id')
->where('item_type', '=', self::class)
->where('action_type', '=', 'uploaded')
->whereNotNull('filename')
->orderBy('created_at', 'desc');
}
/**
@@ -284,7 +271,7 @@ class Consumable extends SnipeModel
*/
public function checkin_email()
{
return $this->category->checkin_email;
return $this->category?->checkin_email;
}
/**
+23 -4
View File
@@ -43,8 +43,8 @@ class DefaultLabel extends RectangleSheet
$this->textSize = Helper::convertUnit($settings->labels_fontsize, 'pt', 'in');
$this->labelWidth = $settings->labels_width;
$this->labelHeight = $settings->labels_height;
$this->labelWidth = $this->setLabelWidth($settings);
$this->labelHeight = $this->setLabelHeight($settings);
$this->labelSpacingH = $settings->labels_display_sgutter;
$this->labelSpacingV = $settings->labels_display_bgutter;
@@ -181,6 +181,25 @@ class DefaultLabel extends RectangleSheet
}
}
}
private function setLabelWidth(Setting $settings)
{
$labelWidth = $settings->labels_width;
?>
if ($labelWidth == 0) {
$labelWidth = 0.1;
}
return $labelWidth;
}
private function setLabelHeight(?Setting $settings)
{
$labelHeight = $settings->labels_height;
if ($labelHeight == 0) {
$labelHeight = 0.1;
}
return $labelHeight;
}
}
@@ -0,0 +1,104 @@
<?php
namespace App\Models\Labels\Tapes\Generic;
abstract class Continuous_53mm extends GenericTape
{
protected const TAPE_WIDTH = 53.0;
// Minimum height for the label
protected float $minHeight = 30.0;
private float $tapeHeight;
/**
* Constructor for 53mm tape
*
* Assumes tape is continuous, set to false and specify
* $spacing in concrete classfor die-cut labels
*
*
* @param float $height Height of the label in mm (default 60mm)
* @param bool $continuous Whether the tape is continuous or pre-cut
* @param float $spacing Spacing between labels for non-continuous tapes (in mm)
*/
public function __construct($height = 60.0, $continuous = true, $spacing = 0.0) {
parent::__construct(self::TAPE_WIDTH, $height, $continuous, $spacing);
$this->tapeHeight = $height;
}
public function getBarcodeRatio() {
return 0.9; // Barcode should use 90% of available width
}
/**
* Calculate the required height for the content
*
* @param $record The record to calculate height for
* @return float The calculated height in mm
*/
protected function calculateRequiredHeight($record) {
$height = $this->marginTop + $this->marginBottom;
// Add title height if present
if ($record->has('title') && $this->getSupportTitle()) {
$height += $this->titleSize + $this->titleMargin;
}
// Add barcode height if present
if (($record->has('barcode2d') && $this->getSupport2DBarcode()) ||
($record->has('barcode') && $this->getSupport1DBarcode())) {
$pa = $this->getPrintableArea();
$usableWidth = $pa->w;
$barcodeSize = $usableWidth * $this->getBarcodeRatio();
$height += $barcodeSize + $this->barcodeMargin;
}
// Add fields height if present
if ($record->has('fields') && $this->getSupportFields() > 0) {
foreach ($record->get('fields') as $field) {
$height += $this->labelSize + $this->labelMargin;
$height += $this->fieldSize + $this->fieldMargin;
}
}
// Add a small buffer to ensure everything fits
$height += 2.0;
// Ensure minimum height
return max($this->minHeight, $height);
}
/**
* Override the writeAll method to support dynamic page sizes for continuous tapes
*/
public function writeAll($pdf, $data) {
// Use auto-sizing for continuous tapes, fixed height for die-cut tapes
if ($this->continuous) {
$data->each(function ($record, $index) use ($pdf) {
// Calculate the required height for this record
$requiredHeight = $this->calculateRequiredHeight($record);
// Temporarily update the height property
$originalHeight = $this->height;
$this->height = $requiredHeight;
// Add a new page with the calculated dimensions
$pdf->AddPage(
$this->getOrientation(),
[$this->getWidth(), $requiredHeight],
false, // Don't reset page number
false // Don't reset object ID
);
// Write the content
$this->write($pdf, $record);
// Restore the original height
$this->height = $originalHeight;
});
} else {
// Use the default implementation for non-continuous (die-cut) tapes
parent::writeAll($pdf, $data);
}
}
}
@@ -0,0 +1,73 @@
<?php
namespace App\Models\Labels\Tapes\Generic;
class Continuous_53mm_A extends Continuous_53mm
{
public function getUnit() { return 'mm'; }
public function getSupportAssetTag() { return false; }
public function getSupport1DBarcode() { return true; }
public function getSupport2DBarcode() { return true; }
public function getSupportFields() { return 5; }
public function getSupportLogo() { return false; }
public function getSupportTitle() { return true; }
public function preparePDF($pdf) {
$pdf->SetAutoPageBreak(false);
}
public function write($pdf, $record) {
$pa = $this->getPrintableArea();
$currentX = $pa->x1;
$currentY = $pa->y1;
$usableWidth = $pa->w;
$usableHeight = $pa->h;
if ($record->has('title')) {
static::writeText(
$pdf, $record->get('title'),
$pa->x1, $pa->y1,
'freesans', '', $this->titleSize, 'C',
$pa->w, $this->titleSize, true, 0
);
$currentY += $this->titleSize + $this->titleMargin;
$usableHeight -= $this->titleSize + $this->titleMargin;
}
// Make the barcode as large as possible while still leaving room for fields
$barcodeSize = min($usableHeight * 0.8, $usableWidth * $this->getBarcodeRatio());
if ($record->has('barcode2d')) {
$barcodeX = $pa->x1 + ($usableWidth - $barcodeSize) / 2;
static::write2DBarcode(
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
$barcodeX, $currentY,
$barcodeSize, $barcodeSize
);
$currentY += $barcodeSize + $this->barcodeMargin;
}
if ($record->has('fields')) {
foreach ($record->get('fields') as $field) {
static::writeText(
$pdf, $field['label'],
$currentX, $currentY,
'freesans', '', $this->labelSize, 'L',
$usableWidth, $this->labelSize, true, 0
);
$currentY += $this->labelSize + $this->labelMargin;
static::writeText(
$pdf, $field['value'],
$currentX, $currentY,
'freemono', 'B', $this->fieldSize, 'L',
$usableWidth, $this->fieldSize, true, 0, 0.01
);
$currentY += $this->fieldSize + $this->fieldMargin;
}
}
}
}
@@ -0,0 +1,170 @@
<?php
namespace App\Models\Labels\Tapes\Generic;
use App\Helpers\Helper;
abstract class Continuous_Landscape_0_59in extends GenericTape
{
// abstract class for printers using 0.59in width paper in landscape orientation
// Using a larger TAPE_WIDTH value to increase font sizes
protected const TAPE_WIDTH = 0.59;
private float $tapeHeight;
protected float $minHeight = 1;
/**
* @param float $length Length of the label in inches (default 2.36in which is 60mm)
* @param bool $continuous Whether the tape is continuous or pre-cut
* @param float $spacing Spacing between labels for non-continuous tapes (in inches)
*/
public function __construct($length = 0.6, $continuous = true, $spacing = 0.0) {
// Swap width and height for landscape orientation
// The height becomes the width, and the length becomes the height
parent::__construct($length, self::TAPE_WIDTH, $continuous, $spacing);
$this->tapeHeight = $length;
$this->marginTop = 0.1;
$this->marginBottom = 0.1;
// Keep small horizontal margins
$this->marginLeft = self::TAPE_WIDTH * 0.2;
// $this->marginRight = self::TAPE_WIDTH * 0.1;
// Override font sizes to make them larger
// Calculate a larger base font size (3x the default)
$baseFontSize = self::TAPE_WIDTH * 0.16; // 3x the default 0.07
// Recalculate all element sizing based on the larger base font size
$this->titleSize = $baseFontSize; // Same as base font size
$this->titleMargin = $baseFontSize * 0.3; // 30% of base font size
$this->fieldSize = $baseFontSize * 1.1; // 110% of base font size
$this->fieldMargin = $baseFontSize * 0.1; // 10% of base font size
$this->labelSize = $baseFontSize * 0.7; // 70% of base font size
$this->labelMargin = $baseFontSize * -0.1; // -10% of base font size
$this->barcodeMargin = $baseFontSize * 0.9; // 20% of base font size
$this->tagSize = $baseFontSize * 0.8; // 80% of base font size
}
public function getBarcodeRatio() {
return 1.0; // Barcode should use 100% of available height
}
/**
* Calculate the required length for the content
*
* @param $record The record to calculate length for
* @return float The calculated length in inches
*/
protected function calculateRequiredLength($record) {
// Calculate length needed for barcode and fields side by side
$requiredLength = 0;
// Add barcode length if present
if (($record->has('barcode2d') && $this->getSupport2DBarcode()) ||
($record->has('barcode') && $this->getSupport1DBarcode())) {
// Use full tape width for barcode size
$barcodeSize = self::TAPE_WIDTH;
$requiredLength += $barcodeSize + $this->barcodeMargin * 0.3; // Minimal margin
}
// Add fields length if present - calculate based on actual content
if ($record->has('fields') && $this->getSupportFields() > 0) {
$fields = array_slice($record->get('fields')->toArray(), 0, $this->getSupportFields());
// Base width for field area
$fieldsWidth = self::TAPE_WIDTH;
// Calculate additional width based on text length
foreach ($fields as $field) {
// Get label and value text
$labelText = $field['label'] ?? '';
$valueText = $field['value'] ?? '';
// Calculate approximate width needed based on text length
// Increase character width to ensure enough space (0.15 inches per character)
$labelWidth = strlen($labelText) * 0.09;
$valueWidth = strlen($valueText) * 0.09;
// Use the longer of the two
$textWidth = max($labelWidth, $valueWidth);
// Ensure minimum width and add to total
$fieldsWidth = max($fieldsWidth, $textWidth);
}
// Add the calculated width for fields
$requiredLength += $fieldsWidth;
// Add minimal extra space for field padding
// Reduce padding to eliminate extraneous space on right edge
// $requiredLength += self::TAPE_WIDTH * 0.1;
}
// Ensure minimum length
return max($this->minHeight, $requiredLength);
}
/**
* Calculate text width accurately using the PDF object
*
* @param $pdf The PDF object
* @param string $text The text to measure
* @param string $font The font to use
* @param string $style The font style
* @param float $size The font size
* @return float The calculated width
*/
protected function calculateTextWidth($pdf, $text, $font, $style, $size) {
$originalFont = $pdf->getFontFamily();
$originalStyle = $pdf->getFontStyle();
$originalSize = $pdf->getFontSizePt();
$pdf->SetFont($font, $style, Helper::convertUnit($size, $this->getUnit(), 'pt', true));
$width = $pdf->GetStringWidth($text);
// Restore original font settings
$pdf->SetFont($originalFont, $originalStyle, $originalSize);
return $width;
}
/**
* Override the writeAll method to support dynamic page sizes for continuous tapes
*/
public function writeAll($pdf, $data) {
// Use auto-sizing for continuous tapes, fixed height for die-cut tapes
if ($this->continuous) {
$data->each(function ($record, $index) use ($pdf) {
// Calculate the required length by calling write with calculateOnly=true
$requiredLength = $this->write($pdf, $record);
// If write didn't return a length (old implementation), fall back to calculateRequiredLength
if ($requiredLength === null) {
$requiredLength = $this->calculateRequiredLength($record);
}
// Temporarily update the height property
$originalHeight = $this->height;
$this->height = self::TAPE_WIDTH; // Keep height fixed at tape width
// Add a new page with the calculated dimensions
// Keep height fixed at TAPE_WIDTH, use calculated length for width
$pdf->AddPage(
$this->getOrientation(),
[$requiredLength, self::TAPE_WIDTH],
false, // Don't reset page number
false // Don't reset object ID
);
// Write the content
$this->write($pdf, $record);
// Restore the original height
$this->height = $originalHeight;
});
} else {
// Use the default implementation for non-continuous (die-cut) tapes
parent::writeAll($pdf, $data);
}
}
}
@@ -0,0 +1,157 @@
<?php
namespace App\Models\Labels\Tapes\Generic;
class Continuous_Landscape_0_59in_A extends Continuous_Landscape_0_59in
{
public function getUnit() { return 'in'; }
public function getSupportAssetTag() { return false; }
public function getSupport1DBarcode() { return true; }
public function getSupport2DBarcode() { return true; }
public function getSupportFields() { return 2; }
public function getSupportLogo() { return false; }
public function getSupportTitle() { return false; }
public function preparePDF($pdf) {
$pdf->SetAutoPageBreak(false);
}
public function write($pdf, $record, $calculateOnly = false) {
$pa = $this->getPrintableArea();
$currentX = $pa->x1;
$currentY = $pa->y1;
$usableWidth = $pa->w;
$usableHeight = $pa->h;
// Calculate required length based on content
$requiredLength = 0;
// Use full usable height for barcode
$barcodeSize = $usableHeight;
// Add barcode width to required length
if ($record->has('barcode2d') && $this->getSupport2DBarcode()) {
$requiredLength += $barcodeSize;
// Add gap between barcode and fields
$requiredLength += $this->barcodeMargin;
}
// Calculate fields width using accurate text measurement
if ($record->has('fields') && $this->getSupportFields() > 0) {
$fields = array_slice($record->get('fields')->toArray(), 0, $this->getSupportFields());
$fieldsWidth = 0;
foreach ($fields as $field) {
$labelText = $field['label'] ?? '';
$valueText = $field['value'] ?? '';
// Calculate accurate width using the PDF object
$labelWidth = $this->calculateTextWidth($pdf, $labelText, 'freesans', 'B', $this->labelSize * 1.2);
$valueWidth = $this->calculateTextWidth($pdf, $valueText, 'freemono', 'B', $this->fieldSize * 1.3);
// Use the longer of the two
$textWidth = max($labelWidth, $valueWidth);
$fieldsWidth = max($fieldsWidth, $textWidth);
}
$requiredLength += $fieldsWidth;
}
// Add more padding to prevent text from being cut off
// $requiredLength += self::TAPE_WIDTH * 0.8;
// Ensure minimum length
$requiredLength = max($this->minHeight, $requiredLength);
// If we're just calculating, return the length
if ($calculateOnly) {
return $requiredLength;
}
// Otherwise, render the content
// Position barcode on the left side
if ($record->has('barcode2d') && $this->getSupport2DBarcode()) {
// Position at top of usable area
static::write2DBarcode(
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
$currentX, $currentY,
$barcodeSize, $barcodeSize
);
$currentX += $barcodeSize + $this->barcodeMargin;
$usableWidth -= $barcodeSize + $this->barcodeMargin;
}
// Position fields to the right of the barcode
if ($record->has('fields') && $this->getSupportFields() > 0) {
// Limit to the number of supported fields
$fields = array_slice($record->get('fields')->toArray(), 0, $this->getSupportFields());
// Calculate total height needed for fields
$totalFieldsHeight = 0;
foreach ($fields as $field) {
$totalFieldsHeight += $this->labelSize * 1.2 + $this->labelMargin; // Increased label size by 20%
$totalFieldsHeight += $this->fieldSize * 1.3 + $this->fieldMargin * 2; // Increased field size by 30% and margin
}
// Start position - respect top margin
$fieldY = $currentY; // $currentY already includes the top margin
$fieldWidth = $usableWidth;
// Calculate available height for fields (respecting margins)
$availableHeight = $usableHeight;
// If fields don't fill available height, adjust spacing proportionally
// but don't exceed the available height
$scaleFactor = 1.0; // Default scale factor
if ($totalFieldsHeight < $availableHeight && count($fields) > 0) {
// Scale up to fill available height, but not too much
$scaleFactor = min(1.5, $availableHeight / $totalFieldsHeight);
} else if ($totalFieldsHeight > $availableHeight && count($fields) > 0) {
// Scale down to fit within available height
$scaleFactor = $availableHeight / $totalFieldsHeight;
}
foreach ($fields as $field) {
// Calculate scaled spacing
$labelHeight = $this->labelSize * 1.2 * $scaleFactor;
$labelSpacing = $this->labelMargin * $scaleFactor;
$fieldHeight = $this->fieldSize * 1.3 * $scaleFactor;
$fieldSpacing = $this->fieldMargin * 2 * $scaleFactor;
// Check if label is empty or null
$labelText = $field['label'] ?? '';
$valueText = $field['value'] ?? '';
if (empty(trim($labelText))) {
// If label is empty, just render the value at the current Y position
static::writeText(
$pdf, $valueText,
$currentX, $fieldY,
'freemono', 'B', $this->fieldSize * 1.3, 'L', // Increased field size by 30%
$fieldWidth, $fieldHeight, false, 0, 0.00
);
$fieldY += ($fieldHeight + $fieldSpacing) + 0.02; // Increased spacing after value
} else {
// If label has content, render both label and value
static::writeText(
$pdf, $labelText,
$currentX, $fieldY,
'freesans', 'B', $this->labelSize * 1.2, 'L', // Increased label size by 20% and made bold
$labelWidth, $labelHeight, false, 0,
);
$fieldY += ($labelHeight + $labelSpacing) + 0.01;
// Value
static::writeText(
$pdf, $valueText,
$currentX, $fieldY, // Position value directly below label
'freemono', 'B', $this->fieldSize * 1.3, 'L', // Increased field size by 30%
$fieldWidth, $fieldHeight, false, 0, 0.00
);
$fieldY += ($fieldHeight + $fieldSpacing) + 0.02; // Increased spacing after value
}
}
}
}
}
@@ -0,0 +1,103 @@
<?php
namespace App\Models\Labels\Tapes\Generic;
use App\Helpers\Helper;
use App\Models\Labels\Label;
abstract class GenericTape extends Label
{
// Default tape width in mm
protected const TAPE_WIDTH = 42.0;
// Tape properties
protected float $width;
protected float $height;
protected bool $continuous;
protected float $spacing = 0.0; // Space between labels for non-continuous tapes
// Margins in mm
protected float $marginTop;
protected float $marginBottom;
protected float $marginLeft;
protected float $marginRight;
// Element sizing in mm
protected float $titleSize;
protected float $titleMargin;
protected float $fieldSize;
protected float $fieldMargin;
protected float $labelSize;
protected float $labelMargin;
protected float $barcodeMargin;
protected float $tagSize;
/**
* Constructor for generic tape
*
* @param float $width Width of the tape in mm
* @param float $height Height of the label in mm (for continuous tapes, this is the default height)
* @param bool $continuous Whether the tape is continuous or pre-cut
* @param float $spacing Spacing between labels for non-continuous tapes (in mm)
*/
public function __construct(float $width, float $height, bool $continuous = true, float $spacing = 0.0) {
$this->width = $width;
$this->height = $height;
$this->continuous = $continuous;
$this->spacing = $spacing;
// Calculate base font size (7% of tape width)
$baseFontSize = static::TAPE_WIDTH * 0.07;
// Calculate margin (4% of tape width)
$margin = static::TAPE_WIDTH * 0.04;
// Set margins
$this->marginTop = $margin;
$this->marginBottom = $margin;
$this->marginLeft = $margin;
$this->marginRight = $margin;
// Calculate and set element sizing based on base font size
$this->titleSize = $baseFontSize; // Same as base font size
$this->titleMargin = $baseFontSize * 0.3; // 30% of base font size
$this->fieldSize = $baseFontSize * 1.1; // 110% of base font size
$this->fieldMargin = $baseFontSize * 0.1; // 10% of base font size
$this->labelSize = $baseFontSize * 0.7; // 70% of base font size
$this->labelMargin = $baseFontSize * -0.1; // -10% of base font size
$this->barcodeMargin = $baseFontSize * 0.5; // 50% of base font size
$this->tagSize = $baseFontSize * 0.8; // 80% of base font size
}
// Unit of measurement
public function getUnit() { return 'mm'; }
// Label dimensions
public function getWidth() { return $this->width; }
public function getHeight() { return $this->height; }
// Margins
public function getMarginTop() { return $this->marginTop; }
public function getMarginBottom() { return $this->marginBottom; }
public function getMarginLeft() { return $this->marginLeft; }
public function getMarginRight() { return $this->marginRight; }
/**
* Check if this is a continuous tape
*
* @return bool
*/
public function isContinuous() {
return $this->continuous;
}
/**
* Get spacing between labels (for die-cut tapes)
*
* @return float
*/
public function getSpacing() {
return $this->spacing;
}
}
@@ -0,0 +1,32 @@
<?php
namespace App\Models\Labels\Tapes\Generic;
abstract class Tape_53mm extends GenericTape
{
// Override tape width to 53mm
protected const TAPE_WIDTH = 53.0;
private float $tapeHeight;
/**
* Constructor for 53mm tape
*
* @param float $height Height of the label in mm (default 30mm)
* @param bool $continuous Whether the tape is continuous or pre-cut
* @param float $spacing Spacing between labels for non-continuous tapes (in mm)
*/
public function __construct(float $height = 30.0, bool $continuous = true, float $spacing = 0.0) {
parent::__construct(self::TAPE_WIDTH, $height, $continuous, $spacing);
$this->tapeHeight = $height;
}
/**
* Get the barcode size ratio for calculations
*
* @return float
*/
public function getBarcodeRatio() {
return 0.9; // Barcode should use 90% of available width
}
}
@@ -0,0 +1,77 @@
<?php
namespace App\Models\Labels\Tapes\Generic;
class Tape_53mm_A extends Tape_53mm
{
public function __construct() {
parent::__construct(40.0, true, 0.0);
}
public function getUnit() { return 'mm'; }
public function getSupportAssetTag() { return false; }
public function getSupport1DBarcode() { return false; }
public function getSupport2DBarcode() { return true; }
public function getSupportFields() { return 5; }
public function getSupportLogo() { return false; }
public function getSupportTitle() { return true; }
public function preparePDF($pdf) {
$pdf->SetAutoPageBreak(false);
}
public function write($pdf, $record) {
$pa = $this->getPrintableArea();
$currentX = $pa->x1;
$currentY = $pa->y1;
$usableWidth = $pa->w;
$usableHeight = $pa->h;
if ($record->has('title')) {
static::writeText(
$pdf, $record->get('title'),
$pa->x1, $pa->y1,
'freesans', '', $this->titleSize, 'C',
$pa->w, $this->titleSize, true, 0
);
$currentY += $this->titleSize + $this->titleMargin;
$usableHeight -= $this->titleSize + $this->titleMargin;
}
// Make the barcode as large as possible while still leaving room for fields
$barcodeSize = min($usableHeight * 0.8, $usableWidth * $this->getBarcodeRatio());
if ($record->has('barcode2d')) {
$barcodeX = $pa->x1 + ($usableWidth - $barcodeSize) / 2;
static::write2DBarcode(
$pdf, $record->get('barcode2d')->content, $record->get('barcode2d')->type,
$barcodeX, $currentY,
$barcodeSize, $barcodeSize
);
$currentY += $barcodeSize + $this->barcodeMargin;
}
if ($record->has('fields')) {
foreach ($record->get('fields') as $field) {
static::writeText(
$pdf, $field['label'],
$currentX, $currentY,
'freesans', '', $this->labelSize, 'L',
$usableWidth, $this->labelSize, true, 0
);
$currentY += $this->labelSize + $this->labelMargin;
static::writeText(
$pdf, $field['value'],
$currentX, $currentY,
'freemono', 'B', $this->fieldSize, 'L',
$usableWidth, $this->fieldSize, true, 0, 0.01
);
$currentY += $this->fieldSize + $this->fieldMargin;
}
}
}
}
+15 -23
View File
@@ -3,6 +3,7 @@
namespace App\Models;
use App\Helpers\Helper;
use App\Models\Traits\HasUploads;
use App\Models\Traits\Searchable;
use App\Presenters\Presentable;
use Carbon\Carbon;
@@ -21,6 +22,7 @@ class License extends Depreciable
use SoftDeletes;
use CompanyableTrait;
use HasUploads;
use Loggable, Presentable;
protected $injectUniqueIdentifier = true;
use ValidatingTrait;
@@ -43,7 +45,7 @@ class License extends Depreciable
protected $rules = [
'name' => 'required|string|min:3|max:255',
'seats' => 'required|min:1|integer',
'seats' => 'required|min:1|integer|limit_change:10000', // limit_change is a "pseudo-rule" that translates into 'between', see prepareLimitChangeRule() below
'license_email' => 'email|nullable|max:120',
'license_name' => 'string|nullable|max:100',
'notes' => 'string|nullable',
@@ -113,6 +115,7 @@ class License extends Depreciable
'company' => ['name'],
'category' => ['name'],
'depreciation' => ['name'],
'supplier' => ['name'],
];
protected $appends = ['free_seat_count'];
@@ -148,6 +151,14 @@ class License extends Depreciable
});
}
public function prepareLimitChangeRule($parameters, $field)
{
$actual_seat_count = $this->licenseseats()->count(); //we use the *actual* seat count here, in case your license has gone wonky
$lower_bound = $actual_seat_count - $parameters[0];
$upper_bound = $actual_seat_count + $parameters[0];
return ["between", ($lower_bound <= 0 ? 1 : $lower_bound), $upper_bound];
}
/**
* Balance seat counts
*
@@ -164,21 +175,17 @@ class License extends Depreciable
// On Create, we just make one for each of the seats.
$change = abs($oldSeats - $newSeats);
if ($oldSeats > $newSeats) {
$license->load('licenseseats.user');
// Need to delete seats... lets see if if we have enough.
$seatsAvailableForDelete = $license->licenseseats->reject(function ($seat) {
return ((bool) $seat->assigned_to) || ((bool) $seat->asset_id);
});
$seatsAvailableForDelete = $license->licenseseats()->whereNull('assigned_to')->whereNull('asset_id')->limit($change);
if ($change > $seatsAvailableForDelete->count()) {
Session::flash('error', trans('admin/licenses/message.assoc_users'));
return false;
}
for ($i = 1; $i <= $change; $i++) {
$seatsAvailableForDelete->pop()->delete();
}
$seatsAvailableForDelete->delete();
// Log Deletion of seats.
$logAction = new Actionlog;
$logAction->item_type = self::class;
@@ -407,21 +414,6 @@ class License extends Depreciable
->orderBy('created_at', 'desc');
}
/**
* Establishes the license -> action logs -> uploads relationship
*
* @author A. Gianotto <snipe@snipe.net>
* @since [v2.0]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function uploads()
{
return $this->hasMany(\App\Models\Actionlog::class, 'item_id')
->where('item_type', '=', self::class)
->where('action_type', '=', 'uploaded')
->whereNotNull('filename')
->orderBy('created_at', 'desc');
}
/**
+22 -16
View File
@@ -6,6 +6,7 @@ use App\Http\Traits\UniqueUndeletedTrait;
use App\Models\Asset;
use App\Models\Setting;
use App\Models\SnipeModel;
use App\Models\Traits\HasUploads;
use App\Models\Traits\Searchable;
use App\Models\User;
use App\Presenters\Presentable;
@@ -25,6 +26,7 @@ class Location extends SnipeModel
protected $presenter = \App\Presenters\LocationPresenter::class;
use Presentable;
use SoftDeletes;
use HasUploads;
protected $table = 'locations';
protected $rules = [
@@ -135,6 +137,17 @@ class Location extends SnipeModel
return $this->hasMany(\App\Models\User::class, 'location_id');
}
/**
* Establishes the location -> admin user relationship
*
* @author A. Gianotto <snipe@snipe.net>
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
/**
* Find assets with this location as their location_id
*
@@ -289,22 +302,6 @@ class Location extends SnipeModel
return $this->attributes['ldap_ou'] = empty($ldap_ou) ? null : $ldap_ou;
}
/**
* Get uploads for this location
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v4.0]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function uploads()
{
return $this->hasMany('\App\Models\Actionlog', 'item_id')
->where('item_type', '=', Location::class)
->where('action_type', '=', 'uploaded')
->whereNotNull('filename')
->orderBy('created_at', 'desc');
}
/**
* Query builder scope to order on parent
@@ -374,4 +371,13 @@ class Location extends SnipeModel
{
return $query->leftJoin('companies as company_sort', 'locations.company_id', '=', 'company_sort.id')->orderBy('company_sort.name', $order);
}
/**
* Query builder scope to order on the user that created it
*/
public function scopeOrderByCreatedByName($query, $order)
{
return $query->leftJoin('users as admin_sort', 'locations.created_by', '=', 'admin_sort.id')->select('locations.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);
}
}
+3 -6
View File
@@ -89,13 +89,10 @@ trait Loggable
$log->note = $note;
$log->action_date = $action_date;
if (! $log->action_date) {
$log->action_date = date('Y-m-d H:i:s');
}
$changed = [];
$array_to_flip = array_keys($fields_array);
$array_to_flip = array_merge($array_to_flip, ['action_date','name','status_id','location_id','expected_checkin']);
$array_to_flip = array_merge($array_to_flip, ['name','status_id','location_id','expected_checkin']);
$originalValues = array_intersect_key($originalValues, array_flip($array_to_flip));
@@ -182,7 +179,7 @@ trait Loggable
$log->note = $note;
$log->action_date = $action_date;
if (! $log->action_date) {
if (!$action_date) {
$log->action_date = date('Y-m-d H:i:s');
}
@@ -193,7 +190,7 @@ trait Loggable
$changed = [];
$array_to_flip = array_keys($fields_array);
$array_to_flip = array_merge($array_to_flip, ['action_date','name','status_id','location_id','expected_checkin']);
$array_to_flip = array_merge($array_to_flip, ['name','status_id','location_id','expected_checkin']);
$originalValues = array_intersect_key($originalValues, array_flip($array_to_flip));
+2
View File
@@ -67,11 +67,13 @@ class Setting extends Model
'google_login',
'google_client_id',
'google_client_secret',
'manager_view_enabled',
];
protected $casts = [
'label2_asset_logo' => 'boolean',
'require_checkinout_notes' => 'boolean',
'manager_view_enabled' => 'boolean',
];
/**
+22 -1
View File
@@ -48,7 +48,7 @@ class Supplier extends SnipeModel
*
* @var array
*/
protected $searchableAttributes = ['name'];
protected $searchableAttributes = ['name', 'notes', 'phone', 'fax', 'url', 'email', 'contact', 'address', 'address2', 'city', 'state', 'country', 'zip'];
/**
* The relations and their attributes that should be included when searching the model.
@@ -128,6 +128,18 @@ class Supplier extends SnipeModel
return $this->hasMany(\App\Models\Consumable::class, 'supplier_id');
}
/**
* Establishes the supplier -> admin user relationship
*
* @author A. Gianotto <snipe@snipe.net>
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function adminuser()
{
return $this->belongsTo(\App\Models\User::class, 'created_by');
}
/**
* Establishes the supplier -> asset maintenances relationship
*
@@ -197,4 +209,13 @@ class Supplier extends SnipeModel
return $url;
}
/**
* Query builder scope to order on the user that created it
*/
public function scopeOrderByCreatedByName($query, $order)
{
return $query->leftJoin('users as admin_sort', 'suppliers.created_by', '=', 'admin_sort.id')->select('suppliers.*')->orderBy('admin_sort.first_name', $order)->orderBy('admin_sort.last_name', $order);
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models\Traits;
use App\Models\Actionlog;
trait HasUploads
{
public function uploads() {
return $this->hasMany(Actionlog::class, 'item_id')
->where('item_type', self::class)
->where('action_type', '=', 'uploaded')
->whereNotNull('filename');
}
}
+1 -1
View File
@@ -164,7 +164,7 @@ trait Searchable
}
}
// I put this here because I only want to add the concat one time in the end of the user relation search
if($relation == 'user') {
if(($relation == 'adminuser') || ($relation == 'user')) {
$query->orWhereRaw(
$this->buildMultipleColumnSearch([
'users.first_name',
+103 -16
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use App\Http\Traits\UniqueUndeletedTrait;
use App\Models\Traits\Searchable;
use App\Models\Traits\HasUploads;
use App\Presenters\Presentable;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
@@ -18,6 +19,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\Access\Authorizable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Str;
use Laravel\Passport\HasApiTokens;
use Watson\Validating\ValidatingTrait;
use Illuminate\Database\Eloquent\Casts\Attribute;
@@ -26,9 +28,10 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
{
use HasFactory;
use CompanyableTrait;
use HasUploads;
protected $presenter = \App\Presenters\UserPresenter::class;
use SoftDeletes, ValidatingTrait;
use SoftDeletes, ValidatingTrait, Loggable;
use Authenticatable, Authorizable, CanResetPassword, HasApiTokens;
use UniqueUndeletedTrait;
use Notifiable;
@@ -168,6 +171,15 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
}
public function isAvatarExternal() {
// Check if it's a google avatar or some external avatar
if (Str::startsWith($this->avatar, ['http://', 'https://'])) {
return true;
}
return false;
}
/**
* Internally check the user permission for the given section
*
@@ -520,21 +532,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
return $this->hasMany(\App\Models\Asset::class, 'id')->withTrashed();
}
/**
* Establishes the user -> uploads relationship
*
* @author A. Gianotto <snipe@snipe.net>
* @since [v3.0]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function uploads()
{
return $this->hasMany(\App\Models\Actionlog::class, 'item_id')
->where('item_type', self::class)
->where('action_type', '=', 'uploaded')
->whereNotNull('filename')
->orderBy('created_at', 'desc');
}
/**
* Establishes the user -> acceptances relationship
@@ -551,6 +549,25 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
->orderBy('created_at', 'desc');
}
/**
* Establishes the user -> eula relationship
*
* @return \Illuminate\Database\Eloquent\Relations\Relation
* @since [v8.1.16]
* @author [Godfrey Martinez] [<gmartinez@grokability.com>]
*/
public function eulas()
{
return $this->hasMany(Actionlog::class, 'target_id')
->with('item')
->select(['id', 'target_id', 'target_type', 'action_type', 'filename', 'accept_signature', 'created_at', 'note', 'item_id', 'item_type'])
->where('target_type', self::class)
->where('action_type', 'accepted')
->whereNotNull('filename')
->whereNotNull('accept_signature')
->orderBy('created_at', 'desc');
}
/**
* Establishes the user -> requested assets relationship
*
@@ -956,5 +973,75 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
}
/**
* Get all direct and indirect subordinates for this user.
*
* @return \Illuminate\Support\Collection
*/
public function getAllSubordinates()
{
$subordinates = collect();
$this->fetchSubordinatesRecursive($this, $subordinates);
return $subordinates->unique('id');
}
/**
* Get all direct and indirect subordinates for this user, including self.
*
* @return \Illuminate\Support\Collection
*/
public function getAllSubordinatesIncludingSelf()
{
$subordinates = collect([$this]);
$this->fetchSubordinatesRecursive($this, $subordinates);
return $subordinates->unique('id');
}
/**
* Recursive helper function to fetch subordinates.
*
* @param User $manager
* @param \Illuminate\Support\Collection $subs
*/
protected function fetchSubordinatesRecursive(User $manager, \Illuminate\Support\Collection &$subs)
{
// Eager load 'managesUsers' to prevent N+1 queries in recursion
$directSubordinates = $manager->managesUsers()->with('managesUsers')->get();
foreach ($directSubordinates as $directSubordinate) {
// Add subordinate if not already in the collection
if (!$subs->contains('id', $directSubordinate->id)) {
$subs->push($directSubordinate);
// Recursive call for this subordinate's subordinates
$this->fetchSubordinatesRecursive($directSubordinate, $subs);
}
}
}
/**
* Check if the current user is a direct or indirect manager of the given user.
*
* @param User $userToCheck
* @return bool
*/
public function isManagerOf(User $userToCheck): bool
{
// Optimization: If it's the same user, they are not their own manager
if ($this->id === $userToCheck->id) {
return false;
}
// Eager load manager relationship to potentially reduce queries in the loop
$manager = $userToCheck->load('manager')->manager;
while ($manager) {
if ($manager->id === $this->id) {
return true;
}
// Move up the hierarchy (load relationship if not already loaded)
$manager = $manager->load('manager')->manager;
}
return false;
}
}
+4
View File
@@ -62,6 +62,7 @@ class AssetObserver
$logAction = new Actionlog();
$logAction->item_type = Asset::class;
$logAction->item_id = $asset->id;
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->log_meta = json_encode($changed);
@@ -108,6 +109,7 @@ class AssetObserver
$logAction = new Actionlog();
$logAction->item_type = Asset::class; // can we instead say $logAction->item = $asset ?
$logAction->item_id = $asset->id;
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
if($asset->imported) {
@@ -128,6 +130,7 @@ class AssetObserver
$logAction->item_type = Asset::class;
$logAction->item_id = $asset->id;
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->logaction('delete');
}
@@ -143,6 +146,7 @@ class AssetObserver
$logAction = new Actionlog();
$logAction->item_type = Asset::class;
$logAction->item_id = $asset->id;
$logAction->action_date = date('Y-m-d H:i:s');
$logAction->created_at = date('Y-m-d H:i:s');
$logAction->created_by = auth()->id();
$logAction->logaction('restore');
+3
View File
@@ -21,6 +21,7 @@ class AccessoryPresenter extends Presenter
'switchable' => true,
'title' => trans('general.id'),
'visible' => false,
'printIgnore' => true,
], [
'field' => 'image',
'searchable' => false,
@@ -172,6 +173,7 @@ class AccessoryPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'accessoriesActionsFormatter',
'printIgnore' => true,
],
];
@@ -240,6 +242,7 @@ class AccessoryPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'accessoriesInOutFormatter',
'printIgnore' => true,
],
];
+2
View File
@@ -21,6 +21,7 @@ class AssetAuditPresenter extends Presenter
'field' => 'checkbox',
'checkbox' => true,
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
],
[
'field' => 'id',
@@ -266,6 +267,7 @@ class AssetAuditPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'hardwareAuditFormatter',
'printIgnore' => true,
];
return json_encode($layout);
@@ -150,6 +150,7 @@ class AssetMaintenancesPresenter extends Presenter
'title' => trans('table.actions'),
'visible' => true,
'formatter' => 'maintenancesActionsFormatter',
'printIgnore' => true,
],
];
+2
View File
@@ -16,6 +16,7 @@ class AssetModelPresenter extends Presenter
'field' => 'checkbox',
'checkbox' => true,
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
],
[
'field' => 'id',
@@ -185,6 +186,7 @@ class AssetModelPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'modelsActionsFormatter',
'printIgnore' => true,
];
return json_encode($layout);
+10
View File
@@ -22,6 +22,7 @@ class AssetPresenter extends Presenter
'field' => 'checkbox',
'checkbox' => true,
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
], [
'field' => 'id',
'searchable' => false,
@@ -108,6 +109,12 @@ class AssetPresenter extends Presenter
'title' => trans('general.employee_number'),
'visible' => false,
'formatter' => 'employeeNumFormatter',
],[
'field' => 'jobtitle',
'searchable' => true,
'sortable' => true,
'title' => trans('admin/users/table.title'),
'visible' => false,
], [
'field' => 'location',
'searchable' => true,
@@ -340,6 +347,7 @@ class AssetPresenter extends Presenter
'title' => trans('general.checkin').'/'.trans('general.checkout'),
'visible' => true,
'formatter' => 'hardwareInOutFormatter',
'printIgnore' => true,
];
$layout[] = [
@@ -349,6 +357,7 @@ class AssetPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'hardwareActionsFormatter',
'printIgnore' => true,
];
return json_encode($layout);
@@ -416,6 +425,7 @@ class AssetPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'accessoriesInOutFormatter',
'printIgnore' => true,
],
];
+2 -1
View File
@@ -112,7 +112,8 @@ class CategoryPresenter extends Presenter
'sortable' => false,
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'categoriesActionsFormatter',
'formatter' => 'categoriesActionsFormatter',
'printIgnore' => true,
],
];
+1
View File
@@ -142,6 +142,7 @@ class CompanyPresenter extends Presenter
'title' => trans('table.actions'),
'visible' => true,
'formatter' => 'companiesActionsFormatter',
'printIgnore' => true,
],
];
+2
View File
@@ -169,6 +169,7 @@ class ComponentPresenter extends Presenter
'title' => trans('general.checkin').'/'.trans('general.checkout'),
'visible' => true,
'formatter' => 'componentsInOutFormatter',
'printIgnore' => true,
];
$layout[] = [
@@ -178,6 +179,7 @@ class ComponentPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'componentsActionsFormatter',
'printIgnore' => true,
];
return json_encode($layout);
+9 -8
View File
@@ -72,14 +72,6 @@ class ConsumablePresenter extends Presenter
'searchable' => true,
'sortable' => true,
'title' => trans('admin/consumables/general.item_no'),
], [
'field' => 'min_amt',
'searchable' => false,
'sortable' => true,
'title' => trans('general.min_amt'),
'visible' => true,
'formatter' => 'minAmtFormatter',
'class' => 'text-right text-padding-number-cell',
], [
'field' => 'qty',
'searchable' => false,
@@ -96,6 +88,14 @@ class ConsumablePresenter extends Presenter
'visible' => true,
'class' => 'text-right text-padding-number-cell',
'footerFormatter' => 'qtySumFormatter',
], [
'field' => 'min_amt',
'searchable' => false,
'sortable' => true,
'title' => trans('general.min_amt'),
'visible' => true,
'formatter' => 'minAmtFormatter',
'class' => 'text-right text-padding-number-cell',
], [
'field' => 'location',
'searchable' => true,
@@ -173,6 +173,7 @@ class ConsumablePresenter extends Presenter
'title' => trans('table.actions'),
'visible' => true,
'formatter' => 'consumablesActionsFormatter',
'printIgnore' => true,
],
];
+1
View File
@@ -96,6 +96,7 @@ class DepreciationPresenter extends Presenter
'title' => trans('table.actions'),
'visible' => true,
'formatter' => 'depreciationsActionsFormatter',
'printIgnore' => true,
],
];
+172
View File
@@ -0,0 +1,172 @@
<?php
namespace App\Presenters;
/**
* Class AccessoryPresenter
*/
class HistoryPresenter extends Presenter
{
/**
* Json Column Layout for bootstrap table
* @return string
*/
public static function dataTableLayout($serial = false)
{
$extra = [];
$layout_start = [
[
'id' => 'id',
'searchable' => false,
'sortable' => true,
'switchable' => true,
'title' => trans('general.id'),
'visible' => false,
'class' => 'hidden-xs',
],
[
'field' => 'icon',
'searchable' => false,
'sortable' => true,
'switchable' => true,
'title' => trans('admin/hardware/table.icon'),
'visible' => true,
'class' => 'hidden-xs',
'formatter' => 'iconFormatter',
],
[
'field' => 'created_at',
'searchable' => true,
'sortable' => true,
'switchable' => true,
'title' => trans('general.created_at'),
'visible' => true,
'formatter' => 'dateDisplayFormatter',
],
[
'field' => 'created_by',
'searchable' => true,
'sortable' => true,
'title' => trans('general.created_by'),
'visible' => true,
'formatter' => 'usersLinkObjFormatter',
],
[
'field' => 'action_date',
'searchable' => false,
'sortable' => true,
'title' => trans('general.action_date'),
'visible' => false,
'formatter' => 'dateDisplayFormatter',
],
[
'field' => 'action_type',
'searchable' => true,
'sortable' => true,
'switchable' => true,
'title' => trans('general.action'),
'visible' => true,
],
[
'field' => 'item',
'searchable' => true,
'sortable' => true,
'switchable' => true,
'title' => trans('general.item'),
'visible' => true,
'formatter' => 'polymorphicItemFormatter',
],
];
if ($serial) {
$extra = [
[
'field' => 'item.serial',
'title' => trans('admin/hardware/table.serial'),
'visible' => false,
]
];
}
$layout_end = [
[
'field' => 'target',
'searchable' => true,
'sortable' => true,
'switchable' => true,
'title' => trans('general.target'),
'visible' => true,
'formatter' => 'polymorphicItemFormatter',
],
[
'field' => 'file',
'searchable' => true,
'sortable' => true,
'switchable' => true,
'title' => trans('general.file_name'),
'visible' => true,
'formatter' => 'fileUploadNameFormatter',
],
[
'field' => 'file_download',
'searchable' => false,
'sortable' => true,
'switchable' => true,
'title' => trans('general.download'),
'visible' => true,
'formatter' => 'fileUploadFormatter',
],
[
'field' => 'note',
'searchable' => true,
'sortable' => true,
'visible' => true,
'title' => trans('general.notes'),
'formatter' => 'notesFormatter'
],
[
'field' => 'signature_file',
'searchable' => true,
'sortable' => true,
'switchable' => true,
'title' => trans('general.signature'),
'visible' => false,
'formatter' => 'imageFormatter',
],
[
'field' => 'log_meta',
'searchable' => false,
'sortable' => false,
'visible' => true,
'title' => trans('admin/hardware/table.changed'),
'formatter' => 'changeLogFormatter',
],
[
'field' => 'remote_ip',
'searchable' => true,
'sortable' => true,
'visible' => false,
'title' => trans('admin/settings/general.login_ip'),
],
[
'field' => 'user_agent',
'searchable' => true,
'sortable' => true,
'visible' => false,
'title' => trans('admin/settings/general.login_user_agent'),
],
[
'field' => 'action_source',
'searchable' => true,
'sortable' => true,
'visible' => false,
'title' => trans('general.action_source'),
],
];
$merged = array_merge($layout_start, $extra, $layout_end);
return json_encode($merged);
}
}
+2
View File
@@ -202,6 +202,7 @@ class LicensePresenter extends Presenter
'title' => trans('general.checkin').'/'.trans('general.checkout'),
'visible' => true,
'formatter' => 'licensesInOutFormatter',
'printIgnore' => true,
];
$layout[] = [
@@ -211,6 +212,7 @@ class LicensePresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'licensesActionsFormatter',
'printIgnore' => true,
];
return json_encode($layout);
+12 -1
View File
@@ -18,6 +18,8 @@ class LocationPresenter extends Presenter
'field' => 'bulk_selectable',
'checkbox' => true,
'formatter' => 'checkboxEnabledFormatter',
'titleTooltip' => trans('general.select_all_none'),
'printIgnore' => true,
], [
'field' => 'id',
'searchable' => false,
@@ -208,7 +210,16 @@ class LocationPresenter extends Presenter
'title' => trans('general.created_at'),
'visible' => false,
'formatter' => 'dateDisplayFormatter',
], [
],
[
'field' => 'created_by',
'searchable' => true,
'sortable' => true,
'switchable' => true,
'title' => trans('general.created_by'),
'visible' => false,
'formatter' => 'usersLinkObjFormatter',
],[
'field' => 'actions',
'searchable' => false,
'sortable' => false,
+1
View File
@@ -163,6 +163,7 @@ class ManufacturerPresenter extends Presenter
'title' => trans('table.actions'),
'visible' => true,
'formatter' => 'manufacturersActionsFormatter',
'printIgnore' => true,
],
];
@@ -61,6 +61,7 @@ class PredefinedKitPresenter extends Presenter
'title' => trans('general.checkin').'/'.trans('general.checkout'),
'visible' => true,
'formatter' => 'kitsInOutFormatter',
'printIgnore' => true,
];
$layout[] = [
@@ -70,6 +71,7 @@ class PredefinedKitPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'kitsActionsFormatter',
'printIgnore' => true,
];
return json_encode($layout);
@@ -121,6 +123,7 @@ class PredefinedKitPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'kits_modelsActionsFormatter',
'printIgnore' => true,
],
];
@@ -173,6 +176,7 @@ class PredefinedKitPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'kits_licensesActionsFormatter',
'printIgnore' => true,
],
];
@@ -225,6 +229,7 @@ class PredefinedKitPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'kits_accessoriesActionsFormatter',
'printIgnore' => true,
],
];
@@ -277,6 +282,7 @@ class PredefinedKitPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'kits_consumablesActionsFormatter',
'printIgnore' => true,
],
];
+1
View File
@@ -105,6 +105,7 @@ class StatusLabelPresenter extends Presenter
'switchable' => false,
'title' => trans('table.actions'),
'formatter' => 'statuslabelsActionsFormatter',
'printIgnore' => true,
],
];

Some files were not shown because too many files have changed in this diff Show More