From aa8dfcf89fb9a447ee35eb3ffba68b9dce9bbddb Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Wed, 22 Mar 2023 13:48:23 -0600 Subject: [PATCH 1/4] Added a ternary to avoid null offset in array --- .../notifications/markdown/report-expiring-assets.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/notifications/markdown/report-expiring-assets.blade.php b/resources/views/notifications/markdown/report-expiring-assets.blade.php index 4311096a6..7c91fff97 100644 --- a/resources/views/notifications/markdown/report-expiring-assets.blade.php +++ b/resources/views/notifications/markdown/report-expiring-assets.blade.php @@ -10,7 +10,7 @@ $expires = Helper::getFormattedDateObject($asset->present()->warranty_expires, ' $diff = round(abs(strtotime($asset->present()->warranty_expires) - strtotime(date('Y-m-d')))/86400); $icon = ($diff <= ($threshold / 2)) ? '🚨' : (($diff <= $threshold) ? '⚠️' : ' '); @endphp -{{ $icon }} {{ $asset->present()->name }} {{ $diff }} {{ trans('mail.Days') }} {{ $expires['formatted'] }} {{ ($asset->supplier ? e($asset->supplier->name) : '') }} {{ ($asset->assignedTo ? e($asset->assignedTo->present()->name()) : '') }} +{{ $icon }} {{ $asset->present()->name }} {{ $diff }} {{ trans('mail.Days') }} {{ !is_null($expires) ? $expires['formatted'] : '' }} {{ ($asset->supplier ? e($asset->supplier->name) : '') }} {{ ($asset->assignedTo ? e($asset->assignedTo->present()->name()) : '') }} @endforeach @endcomponent From fbb368402242a8ffc31c33b78fd8b11c018a81d8 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Thu, 23 Mar 2023 12:43:02 -0600 Subject: [PATCH 2/4] Add a condition to 'restart' the color index for the status pie chart --- app/Helpers/Helper.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index df498da8c..78693b60c 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -334,7 +334,11 @@ class Helper '#92896B', ]; + $total_colors = count($colors); + if ($index >= $total_colors) { + $index = $index - $total_colors; + } return $colors[$index]; } From 317335e79ff40c27169e28b41c87cc13e1b0ec46 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Thu, 23 Mar 2023 17:40:03 -0700 Subject: [PATCH 3/4] Allow the migration of sqlite databases --- .../2021_04_14_180125_add_ids_to_tables.php | 7 +++++- ..._adds_webhook_option_to_settings_table.php | 23 +++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/database/migrations/2021_04_14_180125_add_ids_to_tables.php b/database/migrations/2021_04_14_180125_add_ids_to_tables.php index 07172164f..bac56466c 100644 --- a/database/migrations/2021_04_14_180125_add_ids_to_tables.php +++ b/database/migrations/2021_04_14_180125_add_ids_to_tables.php @@ -22,7 +22,7 @@ class AddIdsToTables extends Migration Schema::table('password_resets', function (Blueprint $table) { // Add the id column to the password_resets table if it doesn't yet have one - if (! Schema::hasColumn('password_resets', 'id')) { + if (! Schema::hasColumn('password_resets', 'id') && $this->notUsingSqlite()) { $table->increments('id'); } }); @@ -47,4 +47,9 @@ class AddIdsToTables extends Migration } }); } + + private function notUsingSqlite() + { + return Schema::connection($this->getConnection())->getConnection()->getDriverName() !== 'sqlite'; + } } diff --git a/database/migrations/2023_02_28_173527_adds_webhook_option_to_settings_table.php b/database/migrations/2023_02_28_173527_adds_webhook_option_to_settings_table.php index c3409c9d6..269a62518 100644 --- a/database/migrations/2023_02_28_173527_adds_webhook_option_to_settings_table.php +++ b/database/migrations/2023_02_28_173527_adds_webhook_option_to_settings_table.php @@ -13,12 +13,27 @@ class AddsWebhookOptionToSettingsTable extends Migration */ public function up() { + /** + * So...you're probably wondering why this isn't all in one Schema::table()... + * Turns out we'll get the following error: + * "SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification." + * if we're running sqlite so a solution is to make multiple calls. + * ¯\_(ツ)_/¯ + */ Schema::table('settings', function (Blueprint $table) { - $table->string('webhook_selected')->after('slack_botname')->default('slack')->nullable(); - $table->renameColumn('slack_botname', 'webhook_botname'); - $table->renameColumn('slack_endpoint', 'webhook_endpoint'); - $table->renameColumn('slack_channel', 'webhook_channel'); + $table->string('webhook_selected')->after('slack_botname')->default('slack')->nullable(); + }); + Schema::table('settings', function (Blueprint $table) { + $table->renameColumn('slack_botname', 'webhook_botname'); + }); + + Schema::table('settings', function (Blueprint $table) { + $table->renameColumn('slack_endpoint', 'webhook_endpoint'); + }); + + Schema::table('settings', function (Blueprint $table) { + $table->renameColumn('slack_channel', 'webhook_channel'); }); } From e869b1fd53bccb1d1788655f9e5b567546c7ff2a Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 24 Mar 2023 06:11:24 -0700 Subject: [PATCH 4/4] Fixed #12724 - fieldset not saving on model Signed-off-by: snipe --- app/Http/Controllers/AssetModelsController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/AssetModelsController.php b/app/Http/Controllers/AssetModelsController.php index 54d2310e8..dbefb2e7b 100755 --- a/app/Http/Controllers/AssetModelsController.php +++ b/app/Http/Controllers/AssetModelsController.php @@ -82,8 +82,8 @@ class AssetModelsController extends Controller $model->user_id = Auth::id(); $model->requestable = Request::has('requestable'); - if ($request->input('custom_fieldset') != '') { - $model->fieldset_id = e($request->input('custom_fieldset')); + if ($request->input('fieldset_id') != '') { + $model->fieldset_id = e($request->input('fieldset_id')); } $model = $request->handleImages($model); @@ -160,10 +160,10 @@ class AssetModelsController extends Controller $this->removeCustomFieldsDefaultValues($model); - if ($request->input('custom_fieldset') == '') { + if ($request->input('fieldset_id') == '') { $model->fieldset_id = null; } else { - $model->fieldset_id = $request->input('custom_fieldset'); + $model->fieldset_id = $request->input('fieldset_id'); if ($this->shouldAddDefaultValues($request->input())) { if (!$this->assignCustomFieldsDefaultValues($model, $request->input('default_values'))){ @@ -444,7 +444,7 @@ class AssetModelsController extends Controller { return ! empty($input['add_default_values']) && ! empty($input['default_values']) - && ! empty($input['custom_fieldset']); + && ! empty($input['fieldset_id']); } /**