A free open source IT asset/license management system
this works!
spencerrlongg0fb1639915f8
diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.phpindex 443cd2b8fa..f70d40e5d8 100644--- a/app/Http/Controllers/Assets/BulkAssetsController.php+++ b/app/Http/Controllers/Assets/BulkAssetsController.php@@ -214,15 +214,16 @@ class BulkAssetsController extends Controller}$custom_field_columns = CustomField::all()->pluck('db_column')->toArray();- // find input attirubtes that start with 'null_'- $temp_custom_fields_to_null = array_filter($request->all(), function ($key) {++ // 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+ // remove 'null' from the keys$custom_fields_to_null = [];- foreach ($temp_custom_fields_to_null as $key => $value) {- $custom_fields_to_null[str_replace('null_', '', $key)] = $value;+ foreach ($null_custom_fields_inputs as $key => $value) {+ $custom_fields_to_null[str_replace('null', '', $key)] = $value;}@@ -267,7 +268,7 @@ class BulkAssetsController extends Controller|| ($request->filled('null_next_audit_date'))|| ($request->filled('null_asset_eol_date'))|| ($request->anyFilled($custom_field_columns))- || ($request->anyFilled(array_keys($custom_fields_to_null)))+ || ($request->anyFilled(array_keys($null_custom_fields_inputs)))) {// Let's loop through those assets and build an update array@@ -295,7 +296,7 @@ class BulkAssetsController extends Controller$this->conditionallyAddItem($custom_field_column);}foreach ($custom_fields_to_null as $key => $custom_field_to_null) {-+ //dd($key);$this->conditionallyAddItem($key);}@@ -451,6 +452,15 @@ class BulkAssetsController extends Controllerif ($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});