From 91e824c5b03995adbbde481eb004787be28f98bf Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 11 Aug 2022 18:25:07 -0700 Subject: [PATCH 1/5] Check for nullifying checkboxes Signed-off-by: snipe --- app/Http/Controllers/Assets/BulkAssetsController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.php index 418b70473..52f3588e9 100644 --- a/app/Http/Controllers/Assets/BulkAssetsController.php +++ b/app/Http/Controllers/Assets/BulkAssetsController.php @@ -103,6 +103,8 @@ class BulkAssetsController extends Controller || ($request->filled('company_id')) || ($request->filled('status_id')) || ($request->filled('model_id')) + || ($request->filled('null_purchase_date')) + || ($request->filled('null_expected_checkin_date')) ) { foreach ($assets as $assetId) { @@ -117,6 +119,14 @@ class BulkAssetsController extends Controller ->conditionallyAddItem('supplier_id') ->conditionallyAddItem('warranty_months'); + if ($request->input('null_purchase_date')=='1') { + $this->update_array['purchase_date'] = null; + } + + if ($request->input('null_expected_checkin_date')=='1') { + $this->update_array['expected_checkin'] = null; + } + if ($request->filled('purchase_cost')) { $this->update_array['purchase_cost'] = Helper::ParseCurrency($request->input('purchase_cost')); } From 70bb4cd746a07d69bfd03e73f1e144e383f8951b Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 11 Aug 2022 18:25:15 -0700 Subject: [PATCH 2/5] Added translation Signed-off-by: snipe --- resources/lang/en/general.php | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lang/en/general.php b/resources/lang/en/general.php index 36b47c195..6a2bc3508 100644 --- a/resources/lang/en/general.php +++ b/resources/lang/en/general.php @@ -371,6 +371,7 @@ return [ 'bulk_soft_delete' =>'Also soft-delete these users. Their asset history will remain intact unless/until you purge deleted records in the Admin Settings.', 'bulk_checkin_delete_success' => 'Your selected users have been deleted and their items have been checked in.', 'bulk_checkin_success' => 'The items for the selected users have been checked in.', + 'set_to_null' => 'Delete values for this asset|Delete values for all :asset_count assets ', ]; \ No newline at end of file From a0ba33ed7c18c56e1e34e20b22b4f094fbc2862a Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 11 Aug 2022 18:25:22 -0700 Subject: [PATCH 3/5] Added checkboxes Signed-off-by: snipe --- resources/views/hardware/bulk.blade.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/resources/views/hardware/bulk.blade.php b/resources/views/hardware/bulk.blade.php index b508db0b8..e6f890a89 100755 --- a/resources/views/hardware/bulk.blade.php +++ b/resources/views/hardware/bulk.blade.php @@ -31,24 +31,38 @@
-
+
{!! $errors->first('purchase_date', ' :message') !!}
+
+ +
+
-
+
+ {!! $errors->first('expected_checkin', '') !!}
+
+ +
From 2c68ec927a92b6c6aa9630f18a45ada26f456317 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 11 Aug 2022 18:30:59 -0700 Subject: [PATCH 4/5] Use trans_choice for string Signed-off-by: snipe --- resources/lang/en/admin/hardware/form.php | 2 +- resources/views/hardware/bulk.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lang/en/admin/hardware/form.php b/resources/lang/en/admin/hardware/form.php index b2d7bab0f..22aac61d0 100644 --- a/resources/lang/en/admin/hardware/form.php +++ b/resources/lang/en/admin/hardware/form.php @@ -6,7 +6,7 @@ return [ 'bulk_delete_warn' => 'You are about to delete :asset_count assets.', 'bulk_update' => 'Bulk Update Assets', 'bulk_update_help' => 'This form allows you to update multiple assets at once. Only fill in the fields you need to change. Any fields left blank will remain unchanged. ', - 'bulk_update_warn' => 'You are about to edit the properties of :asset_count assets.', + 'bulk_update_warn' => 'You are about to edit the properties of a single asset.|You are about to edit the properties of :asset_count assets.', 'checkedout_to' => 'Checked Out To', 'checkout_date' => 'Checkout Date', 'checkin_date' => 'Checkin Date', diff --git a/resources/views/hardware/bulk.blade.php b/resources/views/hardware/bulk.blade.php index e6f890a89..2ecf7bee4 100755 --- a/resources/views/hardware/bulk.blade.php +++ b/resources/views/hardware/bulk.blade.php @@ -20,7 +20,7 @@

{{ trans('admin/hardware/form.bulk_update_help') }}

- {{ trans('admin/hardware/form.bulk_update_warn', ['asset_count' => count($assets)]) }} + {{ trans_choice('admin/hardware/form.bulk_update_warn', count($assets), ['asset_count' => count($assets)]) }}
From 7b3be076b435292ce777dc78fae9e178b3c14a82 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 11 Aug 2022 18:38:34 -0700 Subject: [PATCH 5/5] Make location field the same width Signed-off-by: snipe --- resources/views/partials/forms/edit/location-select.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/partials/forms/edit/location-select.blade.php b/resources/views/partials/forms/edit/location-select.blade.php index 262537795..6603f5878 100644 --- a/resources/views/partials/forms/edit/location-select.blade.php +++ b/resources/views/partials/forms/edit/location-select.blade.php @@ -2,7 +2,7 @@
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }} -
+