From 57235da13cba71411a81baf6cc0520d493ccd0ee Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Mon, 28 Mar 2022 12:40:55 +0100
Subject: [PATCH 15/18] Bug 23681: (QA follow-up) Rename columns

Renames ronly to readonly and dflt to is_system.
---
 .../bug_23681_add_debarment_types.perl        |  6 +++---
 .../en/mandatory/patron_restrictions.sql      |  2 +-
 installer/data/mysql/kohastructure.sql        |  4 ++--
 .../prog/en/modules/admin/restrictions.tt     |  4 ++--
 t/db_dependent/RestrictionType.t              | 16 +++++++--------
 t/db_dependent/RestrictionTypes.t             | 20 +++++++++----------
 6 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl b/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl
index 0050b230eb..7380e141b2 100644
--- a/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl
+++ b/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl
@@ -7,12 +7,12 @@ if ( CheckVersion( $DBversion ) ) {
             CREATE TABLE debarment_types (
                 code varchar(50) NOT NULL PRIMARY KEY,
                 display_text text NOT NULL,
-                ronly tinyint(1) NOT NULL DEFAULT 0,
-                dflt tinyint(1) NOT NULL DEFAULT 0
+                readonly tinyint(1) NOT NULL DEFAULT 0,
+                system tinyint(1) NOT NULL DEFAULT 0
             ) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
         | );
         $dbh->do( q|
-            INSERT INTO debarment_types (code, display_text, ronly, dflt) VALUES
+            INSERT INTO debarment_types (code, display_text, readonly, system) VALUES
             ('MANUAL', 'Manual', 1, 1),
             ('OVERDUES', 'Overdues', 1, 0),
             ('SUSPENSION', 'Suspension', 1, 0),
diff --git a/installer/data/mysql/en/mandatory/patron_restrictions.sql b/installer/data/mysql/en/mandatory/patron_restrictions.sql
index a6eedf27a9..c3e61322ad 100644
--- a/installer/data/mysql/en/mandatory/patron_restrictions.sql
+++ b/installer/data/mysql/en/mandatory/patron_restrictions.sql
@@ -1,4 +1,4 @@
-INSERT INTO debarment_types (code, display_text, ronly, dflt) VALUES
+INSERT INTO debarment_types (code, display_text, readonly, system) VALUES
     ('MANUAL', 'Manual', 1, 1),
     ('OVERDUES', 'Overdues', 1, 0),
     ('SUSPENSION', 'Suspension', 1, 0),
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index 184a7cb3de..5a359e4bc6 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -2025,8 +2025,8 @@ DROP TABLE IF EXISTS `debarment_types`;
 CREATE TABLE debarment_types (
     code varchar(50) NOT NULL PRIMARY KEY,
     display_text text NOT NULL,
-    ronly tinyint(1) NOT NULL DEFAULT 0,
-    dflt tinyint(1) NOT NULL DEFAULT 0
+    readonly tinyint(1) NOT NULL DEFAULT 0,
+    is_system tinyint(1) NOT NULL DEFAULT 0
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
 
 --
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt
index c9b463061f..ff7375cda2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt
@@ -170,11 +170,11 @@
                             [% restriction.display_text | html %]
                         </td>
                         <td>
-                            [% IF restriction.dflt %]Yes[% END %]
+                            [% IF restriction.is_system %]Yes[% END %]
                         </td>
                         <td class="actions">
                             <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=add_form&amp;code=[% restriction.code | uri %]"><i class="fa fa-pencil"></i> Edit</a>
-                            [% IF !restriction.ronly %]
+                            [% IF !restriction.readonly %]
                                 <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=delete_confirm&amp;code=[% restriction.code | uri %]"><i class="fa fa-trash"></i> Delete</a>
                             [% END %]
                         </td>
diff --git a/t/db_dependent/RestrictionType.t b/t/db_dependent/RestrictionType.t
index 28bc464e19..aea33a5800 100755
--- a/t/db_dependent/RestrictionType.t
+++ b/t/db_dependent/RestrictionType.t
@@ -24,8 +24,8 @@ $builder->build({
     value  => {
         code         => 'ONE',
         display_text => 'One',
-        ronly        => 1,
-        dflt         => 0
+        readonly     => 1,
+        is_system    => 0
     }
 });
 $builder->build({
@@ -33,8 +33,8 @@ $builder->build({
     value  => {
         code         => 'TWO',
         display_text => 'Two',
-        ronly        => 1,
-        dflt         => 1
+        readonly     => 1,
+        is_system    => 1
     }
 });
 
@@ -44,14 +44,14 @@ my $expecting = {
     ONE => {
         code         => 'ONE',
         display_text => 'One',
-        ronly        => 1,
-        dflt         => 0
+        readonly     => 1,
+        is_system    => 0
     },
     TWO => {
         code         => 'TWO',
         display_text => 'Two',
-        ronly        => 1,
-        dflt         => 1
+        readonly     => 1,
+        is_system    => 1
     }
 };
 
diff --git a/t/db_dependent/RestrictionTypes.t b/t/db_dependent/RestrictionTypes.t
index 567631a8a7..1251846579 100755
--- a/t/db_dependent/RestrictionTypes.t
+++ b/t/db_dependent/RestrictionTypes.t
@@ -24,8 +24,8 @@ $builder->build({
     value  => {
         code         => 'ONE',
         display_text => 'One',
-        ronly        => 1,
-        dflt         => 0
+        readonly     => 1,
+        is_system    => 0
     }
 });
 $builder->build({
@@ -33,8 +33,8 @@ $builder->build({
     value  => {
         code         => 'TWO',
         display_text => 'Two',
-        ronly        => 1,
-        dflt         => 1
+        readonly     => 1,
+        is_system    => 1
     }
 });
 $builder->build({
@@ -42,8 +42,8 @@ $builder->build({
     value  => {
         code         => 'THREE',
         display_text => 'Three',
-        ronly        => 1,
-        dflt         => 0
+        readonly     => 1,
+        is_system    => 0
     }
 });
 $builder->build({
@@ -51,8 +51,8 @@ $builder->build({
     value  => {
         code         => 'FOUR',
         display_text => 'Four',
-        ronly        => 0,
-        dflt         => 0
+        readonly     => 0,
+        is_system    => 0
     }
 });
 $builder->build({
@@ -60,8 +60,8 @@ $builder->build({
     value  => {
         code         => 'FIVE',
         display_text => 'Five',
-        ronly        => 0,
-        dflt         => 0
+        readonly     => 0,
+        is_system    => 0
     }
 });
 
-- 
2.25.1