A free open source IT asset/license management system
Merge branch 'develop' into feature/8709-bulk-deletion-of-asset-categories-suppliers-manufacturers
Spencer Long30520297e8b3
diff --cc app/Http/Controllers/SuppliersController.phpindex e6671808ce,2a3c73bebe..c824bc1ffa--- a/app/Http/Controllers/SuppliersController.php+++ b/app/Http/Controllers/SuppliersController.php@@@ -2,13 -2,8 +2,12 @@@namespace App\Http\Controllers;+use App\Actions\Suppliers\DestroySupplierAction;+use App\Exceptions\ModelStillHasAssetMaintenances;+use App\Exceptions\ModelStillHasAssets;+use App\Exceptions\ModelStillHasLicenses;use App\Http\Requests\ImageUploadRequest;use App\Models\Supplier;- use Illuminate\Support\Facades\Auth;use Illuminate\Http\RedirectResponse;use \Illuminate\Contracts\View\View;diff --cc resources/lang/en-US/admin/suppliers/message.phpindex 55fd2a50f0,01256abd23..ee5b104028--- a/resources/lang/en-US/admin/suppliers/message.php+++ b/resources/lang/en-US/admin/suppliers/message.php@@@ -20,14 -20,9 +20,14 @@@ return array'confirm' => 'Are you sure you wish to delete this supplier?','error' => 'There was an issue deleting the supplier. Please try again.','success' => 'Supplier was deleted successfully.',+ 'not_found' => 'Supplier not found.',+ 'bulk_success' => 'Suppliers were deleted successfully.',+ 'bulk_assoc_assets' => ':supplier_name still has associated assets and cannot be deleted. Please update your assets to no longer reference this supplier and try again.',+ 'bulk_assoc_licenses' => ':supplier_name still has associated licenses and cannot be deleted. Please update your licenses to no longer reference this supplier and try again.',+ 'bulk_assoc_maintenances' => ':supplier_name still has associated maintenances and cannot be deleted. Please update your maintenances to no longer reference this supplier and try again.','assoc_assets' => 'This supplier is currently associated with :asset_count asset(s) and cannot be deleted. Please update your assets to no longer reference this supplier and try again. ','assoc_licenses' => 'This supplier is currently associated with :licenses_count licences(s) and cannot be deleted. Please update your licenses to no longer reference this supplier and try again. ',- 'assoc_maintenances' => 'This supplier is currently associated with :asset_maintenances_count asset maintenances(s) and cannot be deleted. Please update your asset maintenances to no longer reference this supplier and try again. ',+ 'assoc_maintenances' => 'This supplier is currently associated with :maintenances_count asset maintenances(s) and cannot be deleted. Please update your asset maintenances to no longer reference this supplier and try again. ',));diff --cc resources/views/categories/index.blade.phpindex 11dee11a41,6eec402ddd..4680d58201--- a/resources/views/categories/index.blade.php+++ b/resources/views/categories/index.blade.php@@@ -23,21 -16,11 +17,16 @@@<tabledata-columns="{{ \App\Presenters\CategoryPresenter::dataTableLayout() }}"data-cookie-id-table="categoryTable"- data-pagination="true"data-id-table="categoryTable"- data-search="true"data-side-pagination="server"- data-show-columns="true"- data-show-fullscreen="true"- data-show-export="true"- data-show-refresh="true"data-sort-order="asc"id="categoryTable"+ {{-- begin stuff for bulk dropdown --}}+ data-toolbar="#categoriesBulkEditToolbar"+ data-bulk-button-id="#bulkCategoryEditButton"+ data-bulk-form-id="#categoriesBulkForm"+ {{-- end stuff for bulk dropdown --}}+ data-buttons="categoryButtons"class="table table-striped snipe-table"data-url="{{ route('api.categories.index') }}"data-export-options='{diff --cc resources/views/manufacturers/index.blade.phpindex 0e31eb2d89,654f206d50..7ec3e9a8aa--- a/resources/views/manufacturers/index.blade.php+++ b/resources/views/manufacturers/index.blade.php@@@ -52,21 -35,11 +36,16 @@@<tabledata-columns="{{ \App\Presenters\ManufacturerPresenter::dataTableLayout() }}"data-cookie-id-table="manufacturersTable"- data-pagination="true"data-id-table="manufacturersTable"- data-search="true"data-side-pagination="server"- data-show-columns="true"- data-show-fullscreen="true"- data-show-export="true"- data-show-refresh="true"data-sort-order="asc"id="manufacturersTable"+ {{-- begin stuff for bulk dropdown --}}+ data-toolbar="#manufacturersBulkEditToolbar"+ data-bulk-button-id="#bulkManufacturerEditButton"+ data-bulk-form-id="#manufacturersBulkForm"+ {{-- end stuff for bulk dropdown --}}+ data-buttons="manufacturerButtons"class="table table-striped snipe-table"data-url="{{route('api.manufacturers.index', ['deleted' => (request('deleted')=='true') ? 'true' : 'false' ]) }}"data-export-options='{diff --cc resources/views/suppliers/index.blade.phpindex fca1f83d14,6e70a734c3..2b448a29d5--- a/resources/views/suppliers/index.blade.php+++ b/resources/views/suppliers/index.blade.php@@@ -10,39 -10,18 +10,28 @@@@section('content')- @section('header_right')- @can('create', \App\Models\Supplier::class)- <a href="{{ route('suppliers.create') }}" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>- @endcan- @stop-<div class="row"><div class="col-md-12">- <div class="box box-default">+ <div class="box"><div class="box-body">- <table++ <div class="row">+ <div class="col-md-12">+ @include('partials.supplier-bulk-actions')++ <tabledata-columns="{{ \App\Presenters\SupplierPresenter::dataTableLayout() }}"data-cookie-id-table="suppliersTable"- data-pagination="true"data-id-table="suppliersTable"- data-search="true"data-side-pagination="server"- data-show-columns="true"- data-show-fullscreen="true"- data-show-export="true"- data-show-refresh="true"data-sort-order="asc"id="suppliersTable"+ {{-- begin stuff for bulk dropdown --}}+ data-toolbar="#suppliersBulkEditToolbar"+ data-bulk-button-id="#bulkSupplierEditButton"+ data-bulk-form-id="#suppliersBulkForm"+ {{-- end stuff for bulk dropdown --}}+ data-buttons="supplierButtons"class="table table-striped snipe-table"data-url="{{ route('api.suppliers.index') }}"data-export-options='{diff --cc tests/Feature/Suppliers/Api/DeleteSuppliersTest.phpindex 06b85b75aa,9bdc13ca8c..a22922d359--- a/tests/Feature/Suppliers/Api/DeleteSuppliersTest.php+++ b/tests/Feature/Suppliers/Api/DeleteSuppliersTest.php@@@ -30,12 -30,11 +30,12 @@@ class DeleteSuppliersTest extends TestC$actor = $this->actingAsForApi(User::factory()->deleteSuppliers()->create());$actor->deleteJson(route('api.suppliers.destroy', $supplierWithAsset))->assertStatusMessageIs('error');- $actor->deleteJson(route('api.suppliers.destroy', $supplierWithAssetMaintenance))->assertStatusMessageIs('error');+ $actor->deleteJson(route('api.suppliers.destroy', $supplierWithMaintenance))->assertStatusMessageIs('error');$actor->deleteJson(route('api.suppliers.destroy', $supplierWithLicense))->assertStatusMessageIs('error');+$this->assertNotSoftDeleted($supplierWithAsset);- $this->assertNotSoftDeleted($supplierWithAssetMaintenance);+ $this->assertNotSoftDeleted($supplierWithMaintenance);$this->assertNotSoftDeleted($supplierWithLicense);}