Commit graph

3259 commits

Author SHA1 Message Date
spencerrlongg 38d8d3076d Refactor asset handling and streamline code
This refactoring introduces helper methods for handling image uploads, custom fields, and checkouts, improving code organization and readability. Unnecessary imports, comments, and unused variables were removed for cleaner code. Error handling was also improved with additional exception reporting in the asset update flow.
2024-12-04 21:43:47 -06:00
spencerrlongg 19771d26fb formatting 2024-12-03 14:46:32 -06:00
spencerrlongg 5e475c3558 Remove unused imports from AssetsController files.
Simplify the code by cleaning up unused import statements in both `AssetsController.php` and `Api/AssetsController.php`. This reduces potential confusion and helps maintain cleaner code for future development and maintenance.
2024-12-03 14:41:30 -06:00
spencerrlongg bdf1033277 Merge remote-tracking branch 'upstream/develop' into refactor/asset-action
# Conflicts:
#	app/Http/Controllers/Api/AssetsController.php
#	app/Http/Controllers/Assets/AssetsController.php
#	app/Http/Controllers/Assets/BulkAssetsController.php
#	resources/lang/en-US/admin/hardware/message.php
2024-12-03 14:31:50 -06:00
spencerrlongg 16740b41e4 Simplify asset handling logic for creation and update
Refactor asset creation and update processes by removing redundant save checks and organizing error handling logic. Enhance success and failure feedback in the asset creation flow to improve clarity and user experience. Add support for detailed multi-success and partial failure messages to alert users of outcomes.
2024-12-03 13:50:30 -06:00
spencerrlongg 0a1aba5406 a little work for conflicts 2024-11-29 14:32:19 -06:00
snipe ee4a54be24 Fixed order by notes for users
Some checks failed
Crowdin Action / upload-sources-to-crowdin (push) Has been cancelled
Docker images (Alpine) / docker (push) Has been cancelled
Docker images / docker (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Has been cancelled
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Has been cancelled
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Has been cancelled
Signed-off-by: snipe <snipe@snipe.net>
2024-11-27 15:48:13 +00:00
snipe 2cb1b6d462 Use transformer on API update
Signed-off-by: snipe <snipe@snipe.net>
2024-11-27 13:51:53 +00:00
spencerrlongg ac1d09add0 Fix authorization check in AssetsController
Removed incorrect and commented-out authorization check in the destroy method. Ensured proper authorization by explicitly authorizing the asset instance before attempting deletion.
2024-11-26 14:49:50 -06:00
spencerrlongg 09d4e0cb05 Remove unnecessary parameter and add delete asset tests
Removed the redundant $request parameter from the destroy method in AssetsController. Added feature tests to verify asset deletion functionality with proper permissions and ensure deletion is forbidden without permissions.
2024-11-26 14:37:45 -06:00
spencerrlongg 233656df01 Add tests for storing assets with all fields and multiple entries
Introduced StoreAssetTest to verify the handling of full asset records and multiple asset entries in the database. Updated StoreAssetAction and AssetsController to support next audit date validation and improved error handling.
2024-11-26 14:28:22 -06:00
snipe 82108f8a18
Merge pull request #15208 from akemidx/feature/sc-26415
FEATURE: Option for Notes to be Required on Asset Checkin/Checkout
2024-11-26 20:11:04 +00:00
Godfrey M 60642cd902 fix user api update from clearing location_id unnecessarily 2024-11-26 09:58:17 -08:00
spencerrlongg 705a852d45 Refactor error handling and remove redundant code
Refactored error handling by replacing `\Exception` with `Exception` for consistency. Removed redundant comments and unused code to improve readability and maintainability of the `StoreAssetAction` class.
2024-11-25 20:09:30 -06:00
spencerrlongg 5aa2f307cd Remove debug dump statements
This commit removes various debug dump statements from BulkAssetsController and UpdateAssetAction. These changes clean up the code and improve readability by eliminating unnecessary debugging output. Maintaining clean code ensures better maintainability and performance.
2024-11-22 20:49:52 -06:00
akemidx dd223fc215 commit for testing 2024-11-21 19:01:27 -05:00
snipe 8b38dc83f6
Merge pull request #15851 from marcusmoore/testing/api-component-checkin
Fixed bug in component checkins via api
2024-11-21 19:24:12 +00:00
spencerrlongg a3cdb3b62f Fix error message format in BulkAssetsController
Previously, the error message was set as a string, which led to an inconsistency in how errors were handled. This change updates the error message to be an array, ensuring it aligns with the expected format.
2024-11-21 11:11:11 -06:00
spencerrlongg 10126b8362 Fix error handling in BulkAssetsController
Updated exception handling to capture detailed validation errors in BulkAssetsController. Corrected formatting in notifications view for displaying error messages.
2024-11-20 16:42:56 -06:00
Marcus Moore f932a4fc76
Always run validation on checkin 2024-11-20 12:25:06 -08:00
spencerrlongg 617fe85699 Fix typos and use correct array notation in asset updates
Corrected spelling mistakes in test files and updated code to use the correct array notation in request validation for asset updates. This ensures better readability and consistency in the codebase while preventing potential errors related to incorrect data handling.
2024-11-20 13:11:03 -06:00
snipe 8cd4b3303e
Merge pull request #15847 from NebelKreis/feature/hardware-label-generation-api
Some checks are pending
Crowdin Action / upload-sources-to-crowdin (push) Waiting to run
Docker images (Alpine) / docker (push) Waiting to run
Docker images / docker (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Waiting to run
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Waiting to run
Added #15677: API Route for Generating Asset Labels
2024-11-20 11:14:28 +00:00
NebelKreis d5c141dc59 Fix: Removed setting validation as it is not strictly necessary 2024-11-20 11:55:48 +01:00
spencerrlongg 94e7310cd9 Fix bulk asset update error handling and improve access checks
Improved the error handling in the BulkAssetsController by re-enabling custom field permission checks. Updated the UpdateAssetAction to better handle encrypted custom fields and streamlined user roles in the BulkEditAssetsTest.
2024-11-19 19:57:26 -06:00
snipe cca76005a2
Merge pull request #15852 from marcusmoore/testing/ui-delete-component
Some checks are pending
Crowdin Action / upload-sources-to-crowdin (push) Waiting to run
Docker images (Alpine) / docker (push) Waiting to run
Docker images / docker (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Waiting to run
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Waiting to run
Added tests around deleting component via ui
2024-11-20 01:27:19 +00:00
Marcus Moore 54f5f46e31
Improve check for image existence 2024-11-19 16:44:42 -08:00
Marcus Moore da4c877ed8
Use === over == 2024-11-19 16:13:53 -08:00
Marcus Moore e8cad0df69
Formatting 2024-11-19 16:13:30 -08:00
spencerrlongg 0353c7a03b Fix error handling in BulkAssetsController
Updated error handling to ensure all exceptions are properly stored in the errors array and removed unused custom_field_problem variable. Also, uncommented location assignment code in UpdateAssetAction for clearer logic.
2024-11-19 17:56:56 -06:00
spencerrlongg 3cf583ab03 Add CustomFieldPermissionException handling 2024-11-19 17:45:35 -06:00
spencerrlongg 9f815996c7 tests 'n stuff 2024-11-19 14:45:54 -06:00
spencerrlongg 3e97f0274c rm extra code 2024-11-19 10:04:10 -06:00
spencerrlongg 6c1239eee5 cleaned - more work needs to happen 2024-11-19 10:02:04 -06:00
snipe 15a31bd141 Fixed variable name
Signed-off-by: snipe <snipe@snipe.net>
2024-11-19 13:22:44 +00:00
NebelKreis 66d6b01307 Feature: Added translations for label generation API endpoint 2024-11-19 14:16:06 +01:00
NebelKreis 889aff43c2 Feature: Added API endpoint for generating asset labels 2024-11-19 14:13:05 +01:00
spencerrlongg dd8fb6ef4a fixed some things, made bulk progress, tests pass 2024-11-19 00:13:28 -06:00
spencerrlongg 7ab0b98ff2 var changes 2024-11-18 12:43:28 -06:00
snipe e8d1093376 Fixed admin user not showing in download all activity report
Signed-off-by: snipe <snipe@snipe.net>
2024-11-15 18:51:45 +00:00
snipe 187e231c0e Fixed #15825
Some checks are pending
Crowdin Action / upload-sources-to-crowdin (push) Waiting to run
Docker images (Alpine) / docker (push) Waiting to run
Docker images / docker (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Waiting to run
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Waiting to run
Signed-off-by: snipe <snipe@snipe.net>
2024-11-15 13:18:15 +00:00
spencerrlongg c91dfaf9df gui seemingly working, other good progress - api next 2024-11-14 16:54:23 -06:00
snipe a0b8483878 Removed extra sort
Signed-off-by: snipe <snipe@snipe.net>
2024-11-14 14:41:11 +00:00
snipe 940f1c2ecc Fixed #15812 - regression in action_type search
Signed-off-by: snipe <snipe@snipe.net>
2024-11-14 12:24:15 +00:00
snipe 4e28650ca9 Specify table name in select
Signed-off-by: snipe <snipe@snipe.net>
2024-11-14 10:18:39 +00:00
snipe 73383c688e
Merge pull request #15782 from Toreg87/fixes/indentation_userscontroller
Fix Indentation in UsersController
2024-11-13 21:21:40 +00:00
snipe 4a18946dd7 Added created by to imports
Signed-off-by: snipe <snipe@snipe.net>
2024-11-13 18:42:27 +00:00
snipe d3602c0595 Allow sorting on admin name in API
Signed-off-by: snipe <snipe@snipe.net>
2024-11-13 18:23:26 +00:00
spencerrlongg 47d132703e some more good progress on UpdateAssetAction.php 2024-11-12 18:08:29 -06:00
snipe 48713cbddf Added additional helper files to assetmodel importer
Signed-off-by: snipe <snipe@snipe.net>
2024-11-12 22:40:00 +00:00
spencerrlongg 916c0c0394 good progress on update action 2024-11-12 14:46:56 -06:00