Bugzilla – Attachment 134596 Details for
Bug 23681
Make patron restrictions user definable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23681: Fix QA issues
Bug-23681-Fix-QA-issues.patch (text/plain), 25.98 KB, created by
Martin Renvoize (ashimema)
on 2022-05-04 11:43:36 UTC
(
hide
)
Description:
Bug 23681: Fix QA issues
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-05-04 11:43:36 UTC
Size:
25.98 KB
patch
obsolete
>From 7ee5849a8230a5e695873ed0e704579755ab7b2d Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Mon, 2 May 2022 15:40:35 +0300 >Subject: [PATCH] Bug 23681: Fix QA issues > >This patch fixes following QA issues: >- convert intaller files as .yml >- change column name readonly as is_system >- change column name is_system as default_value >- add column can_be_added_manually (testplan for this below) >- move syspref "PatronRestrictionTypes" to "Accounting > Features" tab >- tweak page title >- tweak tests to apply these changes > >Also atomicupdate files have been updated. Issues with delete and tests >is fixed with adding additional schema change file. > >To test: >1) Add new restriction type and make it manual. >2) Navigate to patron details page. >3) Add new restriction to patron. >=> Only selectable restriction should be the one >you just created. > >Also prove t/db_dependent/RestrictionTypes.t. > >Sponsored-by: Koha-Suomi Oy >--- > Koha/RestrictionType.pm | 6 +-- > admin/restrictions.pl | 9 +++- > ...81_add_PatronRestrictionTypes_syspref.perl | 6 --- > ...3681_add_PatronRestrictionTypes_syspref.pl | 14 ++++++ > .../bug_23681_add_debarment_types.perl | 33 ------------ > .../bug_23681_add_debarment_types.pl | 37 ++++++++++++++ > ...1_add_manage_patron_restrictions_perm.perl | 9 ---- > ...681_add_manage_patron_restrictions_perm.pl | 14 ++++++ > .../en/mandatory/patron_restrictions.sql | 5 -- > .../en/mandatory/patron_restrictions.txt | 1 - > .../en/mandatory/patron_restrictions.yml | 50 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 5 +- > .../prog/en/includes/borrower_debarments.inc | 4 +- > .../modules/admin/preferences/accounting.pref | 6 +++ > .../en/modules/admin/preferences/patrons.pref | 6 --- > .../prog/en/modules/admin/restrictions.tt | 39 ++++++++++++--- > .../prog/en/modules/members/memberentrygen.tt | 4 +- > t/db_dependent/RestrictionTypes.t | 32 ++++++------ > 18 files changed, 191 insertions(+), 89 deletions(-) > delete mode 100644 installer/data/mysql/atomicupdate/bug_23681_add_PatronRestrictionTypes_syspref.perl > create mode 100644 installer/data/mysql/atomicupdate/bug_23681_add_PatronRestrictionTypes_syspref.pl > delete mode 100644 installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl > create mode 100644 installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.pl > delete mode 100644 installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.perl > create mode 100644 installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.pl > delete mode 100644 installer/data/mysql/en/mandatory/patron_restrictions.sql > delete mode 100644 installer/data/mysql/en/mandatory/patron_restrictions.txt > create mode 100644 installer/data/mysql/en/mandatory/patron_restrictions.yml > >diff --git a/Koha/RestrictionType.pm b/Koha/RestrictionType.pm >index 70946a6ff4..4d43f20609 100644 >--- a/Koha/RestrictionType.pm >+++ b/Koha/RestrictionType.pm >@@ -42,10 +42,10 @@ sub delete { > my ( $self ) = @_; > > # Find out what the default is >- my $default = Koha::RestrictionTypes->find({ is_system => 1 })->code; >- # Ensure we're not trying to delete a readonly type (this includes >+ my $default = Koha::RestrictionTypes->find({ default_value => 1 })->code; >+ # Ensure we're not trying to delete a is_system type (this includes > # the default type) >- return 0 if $self->readonly == 1; >+ return 0 if $self->is_system == 1; > # We can't use Koha objects here because Koha::Patron::Debarments > # is not a Koha object. So we'll do it old skool > my $rows = C4::Context->dbh->do( >diff --git a/admin/restrictions.pl b/admin/restrictions.pl >index 634cc065a7..d3449269a5 100755 >--- a/admin/restrictions.pl >+++ b/admin/restrictions.pl >@@ -53,6 +53,7 @@ if ( $op eq 'add_form') { > } elsif ( $op eq 'add_validate' ) { > > my $display_text = $input->param('display_text'); >+ my $can_be_added_manually = $input->param('can_be_added_manually') || 0; > my $is_a_modif = $input->param("is_a_modif"); > > if ($is_a_modif) { >@@ -66,7 +67,10 @@ if ( $op eq 'add_form') { > }; > } else { > my $restriction = Koha::RestrictionTypes->find($code); >- $restriction->display_text($display_text); >+ unless ($restriction->is_system) { >+ $restriction->display_text($display_text); >+ $restriction->can_be_added_manually($can_be_added_manually); >+ } > $restriction->store; > } > } else { >@@ -79,7 +83,8 @@ if ( $op eq 'add_form') { > } else { > my $restriction = Koha::RestrictionType->new({ > code => $code, >- display_text => $display_text >+ display_text => $display_text, >+ can_be_added_manually => $can_be_added_manually > }); > $restriction->store; > } >diff --git a/installer/data/mysql/atomicupdate/bug_23681_add_PatronRestrictionTypes_syspref.perl b/installer/data/mysql/atomicupdate/bug_23681_add_PatronRestrictionTypes_syspref.perl >deleted file mode 100644 >index a4d6323554..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_23681_add_PatronRestrictionTypes_syspref.perl >+++ /dev/null >@@ -1,6 +0,0 @@ >-$DBversion = 'XXX'; # will be replaced by the RM >-if( CheckVersion( $DBversion ) ) { >- $dbh->do( q| INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('PatronRestrictionTypes', '0', 'If enabled, it is possible to specify the "type" of patron restriction being applied.', '', 'YesNo'); | ); >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 23681 - Add PatronRestrictionTypes syspref)\n"; >-} >diff --git a/installer/data/mysql/atomicupdate/bug_23681_add_PatronRestrictionTypes_syspref.pl b/installer/data/mysql/atomicupdate/bug_23681_add_PatronRestrictionTypes_syspref.pl >new file mode 100644 >index 0000000000..51940e5c65 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23681_add_PatronRestrictionTypes_syspref.pl >@@ -0,0 +1,14 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "23681", >+ description => "Add PatronRestrictionTypes syspref", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ # Do you stuffs here >+ $dbh->do(q{INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type) VALUES ('PatronRestrictionTypes', '0', 'If enabled, it is possible to specify the "type" of patron restriction being applied.', '', 'YesNo');}); >+ # Print useful stuff here >+ say $out "Update is going well so far"; >+ }, >+}; >\ No newline at end of file >diff --git a/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl b/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl >deleted file mode 100644 >index 7380e141b2..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl >+++ /dev/null >@@ -1,33 +0,0 @@ >-$DBversion = 'XXX'; >- >-if ( CheckVersion( $DBversion ) ) { >- >- if ( !TableExists( 'debarment_types' ) ) { >- $dbh->do( q| >- CREATE TABLE debarment_types ( >- code varchar(50) NOT NULL PRIMARY KEY, >- display_text text NOT NULL, >- 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, readonly, system) VALUES >- ('MANUAL', 'Manual', 1, 1), >- ('OVERDUES', 'Overdues', 1, 0), >- ('SUSPENSION', 'Suspension', 1, 0), >- ('DISCHARGE', 'Discharge', 1, 0); >- |); >- $dbh->do( q| >- ALTER TABLE borrower_debarments >- MODIFY COLUMN type varchar(50) NOT NULL >- | ); >- $dbh->do( q| >- ALTER TABLE borrower_debarments >- ADD CONSTRAINT borrower_debarments_ibfk_2 FOREIGN KEY (type) REFERENCES debarment_types(code) ON DELETE NO ACTION ON UPDATE CASCADE; >- | ); >- } >- >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 23681 - Add debarment_types)\n"; >-} >diff --git a/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.pl b/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.pl >new file mode 100644 >index 0000000000..4aac79cb8c >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.pl >@@ -0,0 +1,37 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "23681", >+ description => "Add debarment_types", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ # Do you stuffs here >+ $dbh->do(q{ >+ CREATE TABLE IF NOT EXISTS debarment_types ( >+ code varchar(50) NOT NULL PRIMARY KEY, >+ display_text text NOT NULL, >+ is_system tinyint(1) NOT NULL DEFAULT 0, >+ default_value tinyint(1) NOT NULL DEFAULT 0, >+ can_be_added_manually tinyint(1) NOT NULL DEFAULT 0 >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ }); >+ $dbh->do(q{ >+ INSERT IGNORE INTO debarment_types (code, display_text, is_system, default_value, can_be_added_manually) VALUES >+ ('MANUAL', 'Manual', 1, 1, 0), >+ ('OVERDUES', 'Overdues', 1, 0, 0), >+ ('SUSPENSION', 'Suspension', 1, 0, 0), >+ ('DISCHARGE', 'Discharge', 1, 0, 0); >+ }); >+ $dbh->do(q{ >+ ALTER TABLE borrower_debarments >+ MODIFY COLUMN type varchar(50) NOT NULL >+ }); >+ $dbh->do(q{ >+ ALTER TABLE borrower_debarments >+ ADD CONSTRAINT borrower_debarments_ibfk_2 FOREIGN KEY (type) REFERENCES debarment_types(code) ON DELETE NO ACTION ON UPDATE CASCADE; >+ }); >+ # Print useful stuff here >+ say $out "Update is going well so far"; >+ }, >+}; >\ No newline at end of file >diff --git a/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.perl b/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.perl >deleted file mode 100644 >index 283791ba8a..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.perl >+++ /dev/null >@@ -1,9 +0,0 @@ >-$DBversion = 'XXX'; >-if( CheckVersion( $DBversion ) ) { >- $dbh->do(q{ >- INSERT IGNORE INTO permissions (module_bit, code, description) VALUES >- ( 3, 'manage_patron_restrictions', 'Manage patron restrictions') >- }); >- SetVersion( $DBversion ); >- print "Upgrade to $DBversion done (Bug 23681 - Add manage_patron_restrictions_permission)\n"; >-} >diff --git a/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.pl b/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.pl >new file mode 100644 >index 0000000000..396ca8f26b >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.pl >@@ -0,0 +1,14 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "23681", >+ description => "Add manage_patron_restrictions_permission", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ # Do you stuffs here >+ $dbh->do(q{ INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ( 3, 'manage_patron_restrictions', 'Manage patron restrictions')}); >+ # Print useful stuff here >+ say $out "Update is going well so far"; >+ }, >+}; >\ No newline at end of file >diff --git a/installer/data/mysql/en/mandatory/patron_restrictions.sql b/installer/data/mysql/en/mandatory/patron_restrictions.sql >deleted file mode 100644 >index c3e61322ad..0000000000 >--- a/installer/data/mysql/en/mandatory/patron_restrictions.sql >+++ /dev/null >@@ -1,5 +0,0 @@ >-INSERT INTO debarment_types (code, display_text, readonly, system) VALUES >- ('MANUAL', 'Manual', 1, 1), >- ('OVERDUES', 'Overdues', 1, 0), >- ('SUSPENSION', 'Suspension', 1, 0), >- ('DISCHARGE', 'Discharge', 1, 0); >diff --git a/installer/data/mysql/en/mandatory/patron_restrictions.txt b/installer/data/mysql/en/mandatory/patron_restrictions.txt >deleted file mode 100644 >index b17a7c1270..0000000000 >--- a/installer/data/mysql/en/mandatory/patron_restrictions.txt >+++ /dev/null >@@ -1 +0,0 @@ >-Default Koha system patron restriction types >diff --git a/installer/data/mysql/en/mandatory/patron_restrictions.yml b/installer/data/mysql/en/mandatory/patron_restrictions.yml >new file mode 100644 >index 0000000000..c0aeb7a396 >--- /dev/null >+++ b/installer/data/mysql/en/mandatory/patron_restrictions.yml >@@ -0,0 +1,50 @@ >+--- >+# >+# Copyright 2020 Koha Development Team >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+description: >+ - "Default Koha system patron restriction types" >+ >+tables: >+ - debarment_types: >+ translatable: [ display_text ] >+ multiline: [] >+ rows: >+ - code: "MANUAL" >+ display_text: "Manual" >+ is_system: 1 >+ default: 1 >+ can_be_added_manually: 0 >+ >+ - code: "OVERDUES" >+ display_text: "Overdues" >+ is_system: 1 >+ default: 0 >+ can_be_added_manually: 0 >+ >+ - code: "SUSPENSION" >+ display_text: "Suspension" >+ is_system: 1 >+ default: 0 >+ can_be_added_manually: 0 >+ >+ - code: "DISCHARGE" >+ display_text: "Discharge" >+ is_system: 1 >+ default: 0 >+ can_be_added_manually: 0 >\ No newline at end of file >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index b36514fd38..359109ae75 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2025,8 +2025,9 @@ DROP TABLE IF EXISTS `debarment_types`; > CREATE TABLE debarment_types ( > code varchar(50) NOT NULL PRIMARY KEY, > display_text text NOT NULL, >- readonly tinyint(1) NOT NULL DEFAULT 0, >- is_system tinyint(1) NOT NULL DEFAULT 0 >+ is_system tinyint(1) NOT NULL DEFAULT 0, >+ default_value tinyint(1) NOT NULL DEFAULT 0, >+ can_be_added_manually tinyint(1) NOT NULL DEFAULT 0 > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc >index ebf9f0d538..b489c64123 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc >@@ -64,7 +64,9 @@ > <label for="debarred_type">Type:</label> > <select name="debarred_type"> > [% FOREACH code IN restriction_types.keys %] >- <option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option> >+ [% IF restriction_types.$code.can_be_added_manually %] >+ <option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option> >+ [% END %] > [% END %] > </select> > </li> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref >index b23880179b..d0fced732d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref >@@ -41,3 +41,9 @@ Accounting: > branchyyyymmincr: 'Automatically generate credit numbers in the form <branchcode>yyyymm0001' > incremental: 'Automatically generate credit numbers in the form 1, 2, 3' > - Automatic generation also has to be enabled for each credit type (<a href="/cgi-bin/koha/admin/credit_types.pl">Configure credit types</a>) >+ - >+ - pref: PatronRestrictionTypes >+ choices: >+ 1: Allow >+ 0: Don't allow >+ - "the type of patron restriction to be specified when applying manually." >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 67c054747b..8a7c7c585f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -329,12 +329,6 @@ Patrons: > 1: Allow > 0: "Don't allow" > - staff to set the ability for a patron's fines to be viewed by linked patrons in the OPAC. >- - >- - pref: PatronRestrictionTypes >- choices: >- 1: Allow >- 0: Don't allow >- - "the type of patron restriction to be specified when applying manually." > > Privacy: > - >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 ff7375cda2..82dcc485d7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt >@@ -21,19 +21,19 @@ > <li> > <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> > </li> >- <li> >- <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a> >- </li> > > [% IF op == 'list' %] > <li> > <a href="#" aria-current="page"> >- All restrictions >+ Patron restrictions > </a> > </li> > [% END %] > > [% IF op == 'add_form' %] >+ <li> >+ <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a> >+ </li> > [% IF restriction %] > <li> > <a href="#" aria-current="page"> >@@ -50,6 +50,9 @@ > [% END %] > > [% IF op == 'delete_confirm' %] >+ <li> >+ <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a> >+ </li> > <li> > <a href="#" aria-current="page"> > Delete restriction? >@@ -99,6 +102,16 @@ > <input type="text" value="[% restriction.display_text | html %]" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" /> > <span class="required">Required</span> > </li> >+ <li> >+ <label for="can_be_added_manually">Can be manually added?</label> >+ [% IF restriction && restriction.is_system %] >+ [% IF restriction.can_be_added_manually %]Yes[% ELSE %]No[% END %] >+ [% ELSIF restriction.can_be_added_manually %] >+ <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" /> >+ [% ELSE %] >+ <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" /> >+ [% END %] >+ </li> > [% ELSE %] > <li> > <label for="code" class="required">Code: </label> >@@ -110,6 +123,16 @@ > <input type="text" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" /> > <span class="required">Required</span> > </li> >+ <li> >+ <label for="can_be_added_manually">Can be manually added?</label> >+ [% IF restriction && restriction.is_system %] >+ [% IF restriction.can_be_added_manually %]Yes[% ELSE %]No[% END %] >+ [% ELSIF restriction.can_be_added_manually %] >+ <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" /> >+ [% ELSE %] >+ <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" /> >+ [% END %] >+ </li> > [% END %] > </ol> > </fieldset> >@@ -156,6 +179,7 @@ > <tr> > <th scope="col">Code</th> > <th scope="col">Label</th> >+ <th scope="col">Manual</th> > <th scope="col">Default</th> > <th scope="col">Actions</th> > </tr> >@@ -170,11 +194,14 @@ > [% restriction.display_text | html %] > </td> > <td> >- [% IF restriction.is_system %]Yes[% END %] >+ [% IF restriction.can_be_added_manually %]Yes[% END %] >+ </td> >+ <td> >+ [% IF restriction.default_value %]Yes[% END %] > </td> > <td class="actions"> > <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=add_form&code=[% restriction.code | uri %]"><i class="fa fa-pencil"></i> Edit</a> >- [% IF !restriction.readonly %] >+ [% IF !restriction.is_system %] > <a class="btn btn-default btn-xs" href="/cgi-bin/koha/admin/restrictions.pl?op=delete_confirm&code=[% restriction.code | uri %]"><i class="fa fa-trash"></i> Delete</a> > [% END %] > </td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 8c17a5ee8d..38a0686dd8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1373,7 +1373,9 @@ legend:hover { > <label for="debarred_type">Type:</label> > <select name="debarred_type"> > [% FOREACH code IN restriction_types.keys %] >- <option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option> >+ [% IF restriction_types.$code.can_be_added_manually %] >+ <option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option> >+ [% END %] > [% END %] > </select> > </li> >diff --git a/t/db_dependent/RestrictionTypes.t b/t/db_dependent/RestrictionTypes.t >index 1251846579..2c8b0519a4 100755 >--- a/t/db_dependent/RestrictionTypes.t >+++ b/t/db_dependent/RestrictionTypes.t >@@ -17,15 +17,16 @@ use_ok('Koha::RestrictionType'); > use_ok('Koha::RestrictionTypes'); > > $dbh->do(q|DELETE FROM borrower_debarments|); >-Koha::RestrictionTypes->search->delete; >+$dbh->do(q|DELETE FROM debarment_types|); > > $builder->build({ > source => 'DebarmentType', > value => { > code => 'ONE', > display_text => 'One', >- readonly => 1, >- is_system => 0 >+ is_system => 1, >+ default_value => 0, >+ can_be_added_manually => 0 > } > }); > $builder->build({ >@@ -33,8 +34,9 @@ $builder->build({ > value => { > code => 'TWO', > display_text => 'Two', >- readonly => 1, >- is_system => 1 >+ is_system => 1, >+ default_value => 1, >+ can_be_added_manually => 0 > } > }); > $builder->build({ >@@ -42,8 +44,9 @@ $builder->build({ > value => { > code => 'THREE', > display_text => 'Three', >- readonly => 1, >- is_system => 0 >+ is_system => 1, >+ default_value => 0, >+ can_be_added_manually => 0 > } > }); > $builder->build({ >@@ -51,8 +54,9 @@ $builder->build({ > value => { > code => 'FOUR', > display_text => 'Four', >- readonly => 0, >- is_system => 0 >+ is_system => 0, >+ default_value => 0, >+ can_be_added_manually => 0 > } > }); > $builder->build({ >@@ -60,8 +64,9 @@ $builder->build({ > value => { > code => 'FIVE', > display_text => 'Five', >- readonly => 0, >- is_system => 0 >+ is_system => 0, >+ default_value => 0, >+ can_be_added_manually => 0 > } > }); > >@@ -71,10 +76,9 @@ ok( $created->display_text eq 'One', 'Restrictions created'); > > # Can we delete RestrictionTypes, when appropriate > my $deleted = Koha::RestrictionTypes->find({ code => 'FOUR' })->delete; >-ok( $deleted == 1, 'Restriction deleted'); >+ok( $deleted, 'Restriction deleted'); > my $not_deleted = Koha::RestrictionTypes->find({ code => 'TWO' })->delete; >-ok( $not_deleted == 0, 'Read only restriction not deleted'); >- >+ok( !$not_deleted, 'Read only restriction not deleted'); > > # Add a patron with a debarment > my $library = $builder->build({ source => 'Branch' }); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23681
:
93769
|
93770
|
93771
|
93772
|
93773
|
93774
|
93775
|
93776
|
93777
|
93778
|
93779
|
93780
|
93781
|
93782
|
93783
|
93784
|
93785
|
93786
|
94862
|
94863
|
94864
|
94865
|
94866
|
94867
|
94868
|
94869
|
94870
|
94896
|
94897
|
94898
|
94899
|
94900
|
94901
|
94902
|
94903
|
94904
|
95148
|
95255
|
95256
|
95257
|
95258
|
95259
|
95260
|
95261
|
95262
|
95263
|
95264
|
99893
|
99894
|
99895
|
99896
|
99897
|
99898
|
99899
|
99900
|
99901
|
99902
|
130373
|
130374
|
130375
|
130376
|
130377
|
130378
|
130379
|
130380
|
130381
|
130382
|
130383
|
130384
|
132302
|
132303
|
132304
|
132305
|
132306
|
132307
|
132308
|
132309
|
132310
|
132311
|
132312
|
132313
|
132314
|
132315
|
132316
|
132318
|
132319
|
132320
|
134512
|
134513
|
134514
|
134515
|
134516
|
134517
|
134518
|
134519
|
134520
|
134521
|
134522
|
134523
|
134524
|
134525
|
134526
|
134527
|
134528
|
134529
|
134580
|
134581
|
134582
|
134583
|
134584
|
134585
|
134586
|
134587
|
134588
|
134589
|
134590
|
134591
|
134592
|
134593
|
134594
|
134595
|
134596
|
134597
|
134598
|
134599
|
134600
|
134601
|
134602
|
134684
|
134685
|
134686
|
134687
|
134688
|
134689
|
134690
|
134691
|
134692
|
134693
|
134694
|
134696
|
134697
|
134698
|
134699
|
134700
|
134701
|
134702
|
134703
|
134704
|
134705
|
134706
|
134707
|
134708
|
136716
|
136717
|
136718
|
136719
|
136720
|
136721
|
136722
|
136723
|
136724
|
136725
|
136726
|
136727
|
136728
|
136729
|
136730
|
136731
|
136732
|
136733
|
136734
|
136735
|
136736
|
136737
|
136738
|
136739
|
137066
|
137067
|
137068
|
137069
|
137070
|
137071
|
137072
|
137073
|
137074
|
137075
|
137076
|
137077
|
137078
|
137079
|
137080
|
137081
|
137082
|
137083
|
137084
|
137085
|
137086
|
137087
|
137088
|
137089
|
137090
|
137091
|
137092
|
137093
|
137094
|
137102
|
137103
|
137104
|
137105
|
137106
|
137107
|
137108
|
137109
|
137110
|
137111
|
137112
|
137113
|
137114
|
137115
|
137116
|
137117
|
137118
|
137119
|
137120
|
137121
|
137122
|
137123
|
137124
|
137125
|
137126
|
137127
|
137128
|
137129
|
137130
|
139250
|
139251
|
139252
|
139253
|
139254
|
139255
|
139256
|
139257
|
139258
|
139259
|
139260
|
139261
|
139262
|
139263
|
139264
|
139265
|
139266
|
139267
|
139268
|
139269
|
139270
|
139271
|
139272
|
139273
|
139509
|
139512
|
139649
|
139717
|
139768
|
139769
|
139770
|
139771
|
139772
|
139773
|
139774
|
139775
|
139776
|
139777
|
139778
|
139779
|
139780
|
139781
|
139782
|
139783
|
139784
|
139785
|
139786
|
139787
|
139788
|
139789
|
139790
|
139791
|
139792
|
139793
|
139794
|
139795