From f5360d2f2decd25f577dfebb4229031f4086a454 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Fri, 17 Nov 2023 09:37:38 +0100 Subject: [PATCH] Rename the block period description field to notes for compatibility with the other unavailability events --- application/controllers/Blocked_periods.php | 4 ++-- .../migrations/048_create_blocked_periods_table.php | 2 +- application/models/Blocked_periods_model.php | 10 +++++----- application/views/pages/blocked_periods.php | 6 +++--- assets/js/pages/blocked_periods.js | 6 +++--- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/application/controllers/Blocked_periods.php b/application/controllers/Blocked_periods.php index b86b5b3f..d228d3e0 100644 --- a/application/controllers/Blocked_periods.php +++ b/application/controllers/Blocked_periods.php @@ -127,7 +127,7 @@ class Blocked_periods extends EA_Controller { 'name', 'start_datetime', 'end_datetime', - 'description' + 'notes' ]); $blocked_period_id = $this->blocked_periods_model->save($blocked_period); @@ -166,7 +166,7 @@ class Blocked_periods extends EA_Controller { 'name', 'start_datetime', 'end_datetime', - 'description' + 'notes' ]); $blocked_period_id = $this->blocked_periods_model->save($blocked_period); diff --git a/application/migrations/048_create_blocked_periods_table.php b/application/migrations/048_create_blocked_periods_table.php index 1c62d733..4b262a5a 100644 --- a/application/migrations/048_create_blocked_periods_table.php +++ b/application/migrations/048_create_blocked_periods_table.php @@ -46,7 +46,7 @@ class Migration_Create_blocked_periods_table extends EA_Migration { 'type' => 'DATETIME', 'null' => TRUE, ], - 'description' => [ + 'notes' => [ 'type' => 'TEXT', 'null' => TRUE, ], diff --git a/application/models/Blocked_periods_model.php b/application/models/Blocked_periods_model.php index 081021d9..92b8931e 100644 --- a/application/models/Blocked_periods_model.php +++ b/application/models/Blocked_periods_model.php @@ -34,7 +34,7 @@ class Blocked_periods_model extends EA_Model { 'name' => 'name', 'start' => 'start_datetime', 'end' => 'end_datetime', - 'description' => 'description', + 'notes' => 'notes', ]; /** @@ -281,7 +281,7 @@ class Blocked_periods_model extends EA_Model { ->from('blocked_periods') ->group_start() ->like('name', $keyword) - ->or_like('description', $keyword) + ->or_like('notes', $keyword) ->group_end() ->limit($limit) ->offset($offset) @@ -322,7 +322,7 @@ class Blocked_periods_model extends EA_Model { 'name' => $blocked_period['name'], 'start' => array_key_exists('start_datetime', $blocked_period) ? $blocked_period['start_datetime'] : NULL, 'end' => array_key_exists('end_datetime', $blocked_period) ? $blocked_period['end_datetime'] : NULL, - 'description' => array_key_exists('description', $blocked_period) ? $blocked_period['description'] : NULL + 'notes' => array_key_exists('notes', $blocked_period) ? $blocked_period['notes'] : NULL ]; $blocked_period = $encoded_resource; @@ -358,9 +358,9 @@ class Blocked_periods_model extends EA_Model { $decoded_resource['end_datetime'] = $blocked_period['end']; } - if (array_key_exists('description', $blocked_period)) + if (array_key_exists('notes', $blocked_period)) { - $decoded_resource['description'] = $blocked_period['description']; + $decoded_resource['notes'] = $blocked_period['notes']; } $blocked_period = $decoded_resource; diff --git a/application/views/pages/blocked_periods.php b/application/views/pages/blocked_periods.php index 577e73d2..ebfaae87 100644 --- a/application/views/pages/blocked_periods.php +++ b/application/views/pages/blocked_periods.php @@ -92,10 +92,10 @@
-
diff --git a/assets/js/pages/blocked_periods.js b/assets/js/pages/blocked_periods.js index a158d44e..16d465b4 100644 --- a/assets/js/pages/blocked_periods.js +++ b/assets/js/pages/blocked_periods.js @@ -21,7 +21,7 @@ App.Pages.BlockedPeriods = (function () { const $name = $('#name'); const $startDateTime = $('#start-date-time'); const $endDateTime = $('#end-date-time'); - const $description = $('#description'); + const $notes = $('#notes'); const moment = window.moment; let filterResults = {}; @@ -130,7 +130,7 @@ App.Pages.BlockedPeriods = (function () { name: $name.val(), start_datetime: startDateTimeMoment.format('YYYY-MM-DD HH:mm:ss'), end_datetime: endDateTimeMoment.format('YYYY-MM-DD HH:mm:ss'), - description: $description.val() + notes: $notes.val() }; if ($id.val() !== '') { @@ -235,7 +235,7 @@ App.Pages.BlockedPeriods = (function () { $name.val(blockedPeriod.name); App.Utils.UI.setDatetimepickerValue($startDateTime, new Date(blockedPeriod.start_datetime)); App.Utils.UI.setDatetimepickerValue($endDateTime, new Date(blockedPeriod.end_datetime)); - $description.val(blockedPeriod.description); + $notes.val(blockedPeriod.notes); } /**