View | Details | Raw Unified | Return to bug 23681
Collapse All | Expand All

(-)a/Koha/RestrictionType.pm (-3 / +3 lines)
Lines 42-51 sub delete { Link Here
42
    my ( $self ) = @_;
42
    my ( $self ) = @_;
43
43
44
    # Find out what the default is
44
    # Find out what the default is
45
    my $default = Koha::RestrictionTypes->find({ is_system => 1 })->code;
45
    my $default = Koha::RestrictionTypes->find({ default_value => 1 })->code;
46
    # Ensure we're not trying to delete a readonly type (this includes
46
    # Ensure we're not trying to delete a is_system type (this includes
47
    # the default type)
47
    # the default type)
48
    return 0 if $self->readonly == 1;
48
    return 0 if $self->is_system == 1;
49
    # We can't use Koha objects here because Koha::Patron::Debarments
49
    # We can't use Koha objects here because Koha::Patron::Debarments
50
    # is not a Koha object. So we'll do it old skool
50
    # is not a Koha object. So we'll do it old skool
51
    my $rows = C4::Context->dbh->do(
51
    my $rows = C4::Context->dbh->do(
(-)a/admin/restrictions.pl (-2 / +7 lines)
Lines 53-58 if ( $op eq 'add_form') { Link Here
53
} elsif ( $op eq 'add_validate' ) {
53
} elsif ( $op eq 'add_validate' ) {
54
54
55
    my $display_text = $input->param('display_text');
55
    my $display_text = $input->param('display_text');
56
    my $can_be_added_manually = $input->param('can_be_added_manually') || 0;
56
    my $is_a_modif = $input->param("is_a_modif");
57
    my $is_a_modif = $input->param("is_a_modif");
57
58
58
    if ($is_a_modif) {
59
    if ($is_a_modif) {
Lines 66-72 if ( $op eq 'add_form') { Link Here
66
            };
67
            };
67
        } else {
68
        } else {
68
            my $restriction = Koha::RestrictionTypes->find($code);
69
            my $restriction = Koha::RestrictionTypes->find($code);
69
            $restriction->display_text($display_text);
70
            unless ($restriction->is_system) {
71
                $restriction->display_text($display_text);
72
                $restriction->can_be_added_manually($can_be_added_manually);
73
            }
70
            $restriction->store;
74
            $restriction->store;
71
        }
75
        }
72
    } else {
76
    } else {
Lines 79-85 if ( $op eq 'add_form') { Link Here
79
        } else {
83
        } else {
80
            my $restriction = Koha::RestrictionType->new({
84
            my $restriction = Koha::RestrictionType->new({
81
                code => $code,
85
                code => $code,
82
                display_text => $display_text
86
                display_text => $display_text,
87
                can_be_added_manually => $can_be_added_manually
83
            });
88
            });
84
            $restriction->store;
89
            $restriction->store;
85
        }
90
        }
(-)a/installer/data/mysql/atomicupdate/bug_23681_add_PatronRestrictionTypes_syspref.perl (-6 lines)
Lines 1-6 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    $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'); | );
4
    SetVersion( $DBversion );
5
    print "Upgrade to $DBversion done (Bug 23681 - Add PatronRestrictionTypes syspref)\n";
6
}
(-)a/installer/data/mysql/atomicupdate/bug_23681_add_PatronRestrictionTypes_syspref.pl (+14 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "23681",
5
    description => "Add PatronRestrictionTypes syspref",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        # Do you stuffs here
10
        $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');});
11
        # Print useful stuff here
12
        say $out "Update is going well so far";
13
    },
14
};
(-)a/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.perl (-33 lines)
Lines 1-33 Link Here
1
$DBversion = 'XXX';
2
3
if ( CheckVersion( $DBversion ) ) {
4
5
    if ( !TableExists( 'debarment_types' ) ) {
6
        $dbh->do( q|
7
            CREATE TABLE debarment_types (
8
                code varchar(50) NOT NULL PRIMARY KEY,
9
                display_text text NOT NULL,
10
                readonly tinyint(1) NOT NULL DEFAULT 0,
11
                system tinyint(1) NOT NULL DEFAULT 0
12
            ) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
13
        | );
14
        $dbh->do( q|
15
            INSERT INTO debarment_types (code, display_text, readonly, system) VALUES
16
            ('MANUAL', 'Manual', 1, 1),
17
            ('OVERDUES', 'Overdues', 1, 0),
18
            ('SUSPENSION', 'Suspension', 1, 0),
19
            ('DISCHARGE', 'Discharge', 1, 0);
20
        |);
21
        $dbh->do( q|
22
            ALTER TABLE borrower_debarments
23
            MODIFY COLUMN type varchar(50) NOT NULL
24
        | );
25
        $dbh->do( q|
26
            ALTER TABLE borrower_debarments
27
            ADD CONSTRAINT borrower_debarments_ibfk_2 FOREIGN KEY (type) REFERENCES debarment_types(code) ON DELETE NO ACTION ON UPDATE CASCADE;
28
        | );
29
    }
30
31
    SetVersion( $DBversion );
32
    print "Upgrade to $DBversion done (Bug 23681 - Add debarment_types)\n";
33
}
(-)a/installer/data/mysql/atomicupdate/bug_23681_add_debarment_types.pl (+37 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "23681",
5
    description => "Add debarment_types",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        # Do you stuffs here
10
        $dbh->do(q{
11
            CREATE TABLE IF NOT EXISTS debarment_types (
12
                code varchar(50) NOT NULL PRIMARY KEY,
13
                display_text text NOT NULL,
14
                is_system tinyint(1) NOT NULL DEFAULT 0,
15
                default_value tinyint(1) NOT NULL DEFAULT 0,
16
                can_be_added_manually tinyint(1) NOT NULL DEFAULT 0
17
            ) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
18
        });
19
        $dbh->do(q{
20
            INSERT IGNORE INTO debarment_types (code, display_text, is_system, default_value, can_be_added_manually) VALUES
21
            ('MANUAL', 'Manual', 1, 1, 0),
22
            ('OVERDUES', 'Overdues', 1, 0, 0),
23
            ('SUSPENSION', 'Suspension', 1, 0, 0),
24
            ('DISCHARGE', 'Discharge', 1, 0, 0);
25
        });
26
        $dbh->do(q{
27
            ALTER TABLE borrower_debarments
28
            MODIFY COLUMN type varchar(50) NOT NULL
29
        });
30
        $dbh->do(q{
31
            ALTER TABLE borrower_debarments
32
            ADD CONSTRAINT borrower_debarments_ibfk_2 FOREIGN KEY (type) REFERENCES debarment_types(code) ON DELETE NO ACTION ON UPDATE CASCADE;
33
        });
34
        # Print useful stuff here
35
        say $out "Update is going well so far";
36
    },
37
};
(-)a/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.perl (-9 lines)
Lines 1-9 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        INSERT IGNORE INTO permissions (module_bit, code, description) VALUES
5
           ( 3, 'manage_patron_restrictions', 'Manage patron restrictions')
6
    });
7
    SetVersion( $DBversion );
8
    print "Upgrade to $DBversion done (Bug 23681 - Add manage_patron_restrictions_permission)\n";
9
}
(-)a/installer/data/mysql/atomicupdate/bug_23681_add_manage_patron_restrictions_perm.pl (+14 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "23681",
5
    description => "Add manage_patron_restrictions_permission",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        # Do you stuffs here
10
        $dbh->do(q{ INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ( 3, 'manage_patron_restrictions', 'Manage patron restrictions')});
11
        # Print useful stuff here
12
        say $out "Update is going well so far";
13
    },
14
};
(-)a/installer/data/mysql/en/mandatory/patron_restrictions.sql (-5 lines)
Lines 1-5 Link Here
1
INSERT INTO debarment_types (code, display_text, readonly, system) VALUES
2
    ('MANUAL', 'Manual', 1, 1),
3
    ('OVERDUES', 'Overdues', 1, 0),
4
    ('SUSPENSION', 'Suspension', 1, 0),
5
    ('DISCHARGE', 'Discharge', 1, 0);
(-)a/installer/data/mysql/en/mandatory/patron_restrictions.txt (-1 lines)
Line 1 Link Here
1
Default Koha system patron restriction types
(-)a/installer/data/mysql/en/mandatory/patron_restrictions.yml (+50 lines)
Line 0 Link Here
1
---
2
#
3
#  Copyright 2020 Koha Development Team
4
#
5
#  This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
description:
21
  - "Default Koha system patron restriction types"
22
23
tables:
24
  - debarment_types:
25
      translatable: [ display_text ]
26
      multiline: []
27
      rows:
28
        - code: "MANUAL"
29
          display_text: "Manual"
30
          is_system: 1
31
          default: 1
32
          can_be_added_manually: 0
33
34
        - code: "OVERDUES"
35
          display_text: "Overdues"
36
          is_system: 1
37
          default: 0
38
          can_be_added_manually: 0
39
40
        - code: "SUSPENSION"
41
          display_text: "Suspension"
42
          is_system: 1
43
          default: 0
44
          can_be_added_manually: 0
45
46
        - code: "DISCHARGE"
47
          display_text: "Discharge"
48
          is_system: 1
49
          default: 0
50
          can_be_added_manually: 0
(-)a/installer/data/mysql/kohastructure.sql (-2 / +3 lines)
Lines 2025-2032 DROP TABLE IF EXISTS `debarment_types`; Link Here
2025
CREATE TABLE debarment_types (
2025
CREATE TABLE debarment_types (
2026
    code varchar(50) NOT NULL PRIMARY KEY,
2026
    code varchar(50) NOT NULL PRIMARY KEY,
2027
    display_text text NOT NULL,
2027
    display_text text NOT NULL,
2028
    readonly tinyint(1) NOT NULL DEFAULT 0,
2028
    is_system tinyint(1) NOT NULL DEFAULT 0,
2029
    is_system tinyint(1) NOT NULL DEFAULT 0
2029
    default_value tinyint(1) NOT NULL DEFAULT 0,
2030
    can_be_added_manually tinyint(1) NOT NULL DEFAULT 0
2030
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2031
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
2031
2032
2032
--
2033
--
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc (-1 / +3 lines)
Lines 64-70 Link Here
64
                        <label for="debarred_type">Type:</label>
64
                        <label for="debarred_type">Type:</label>
65
                        <select name="debarred_type">
65
                        <select name="debarred_type">
66
                            [% FOREACH code IN restriction_types.keys %]
66
                            [% FOREACH code IN restriction_types.keys %]
67
                                <option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option>
67
                                [% IF restriction_types.$code.can_be_added_manually %]
68
                                    <option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option>
69
                                [% END %]
68
                            [% END %]
70
                            [% END %]
69
                        </select>
71
                        </select>
70
                    </li>
72
                    </li>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/accounting.pref (+6 lines)
Lines 48-50 Accounting: Link Here
48
                branchyyyymmincr: 'Automatically generate credit numbers in the form <branchcode>yyyymm0001'
48
                branchyyyymmincr: 'Automatically generate credit numbers in the form <branchcode>yyyymm0001'
49
                incremental: 'Automatically generate credit numbers in the form 1, 2, 3'
49
                incremental: 'Automatically generate credit numbers in the form 1, 2, 3'
50
            - Automatic generation also has to be enabled for each credit type (<a href="/cgi-bin/koha/admin/credit_types.pl">Configure credit types</a>)
50
            - Automatic generation also has to be enabled for each credit type (<a href="/cgi-bin/koha/admin/credit_types.pl">Configure credit types</a>)
51
        -
52
         - pref: PatronRestrictionTypes
53
           choices:
54
               1: Allow
55
               0: Don't allow
56
         - "the type of patron restriction to be specified when applying manually."
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-6 lines)
Lines 329-340 Patrons: Link Here
329
               1: Allow
329
               1: Allow
330
               0: "Don't allow"
330
               0: "Don't allow"
331
         - staff to set the ability for a patron's fines to be viewed by linked patrons in the OPAC.
331
         - staff to set the ability for a patron's fines to be viewed by linked patrons in the OPAC.
332
     -
333
         - pref: PatronRestrictionTypes
334
           choices:
335
               1: Allow
336
               0: Don't allow
337
         - "the type of patron restriction to be specified when applying manually."
338
332
339
    Privacy:
333
    Privacy:
340
     -
334
     -
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/restrictions.tt (-6 / +33 lines)
Lines 21-39 Link Here
21
    <li>
21
    <li>
22
        <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
22
        <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
23
    </li>
23
    </li>
24
    <li>
25
        <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a>
26
    </li>
27
24
28
    [% IF op == 'list' %]
25
    [% IF op == 'list' %]
29
        <li>
26
        <li>
30
            <a href="#" aria-current="page">
27
            <a href="#" aria-current="page">
31
                All restrictions
28
                Patron restrictions
32
            </a>
29
            </a>
33
        </li>
30
        </li>
34
    [% END %]
31
    [% END %]
35
32
36
    [% IF op == 'add_form' %]
33
    [% IF op == 'add_form' %]
34
        <li>
35
            <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a>
36
        </li>
37
        [% IF restriction %]
37
        [% IF restriction %]
38
            <li>
38
            <li>
39
                <a href="#" aria-current="page">
39
                <a href="#" aria-current="page">
Lines 50-55 Link Here
50
    [% END %]
50
    [% END %]
51
51
52
    [% IF op == 'delete_confirm' %]
52
    [% IF op == 'delete_confirm' %]
53
        <li>
54
            <a href="/cgi-bin/koha/admin/restrictions.pl">Patron restrictions</a>
55
        </li>
53
        <li>
56
        <li>
54
            <a href="#" aria-current="page">
57
            <a href="#" aria-current="page">
55
                Delete restriction?
58
                Delete restriction?
Lines 99-104 Link Here
99
                        <input type="text" value="[% restriction.display_text | html %]" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
102
                        <input type="text" value="[% restriction.display_text | html %]" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
100
                        <span class="required">Required</span>
103
                        <span class="required">Required</span>
101
                    </li>
104
                    </li>
105
                    <li>
106
                        <label for="can_be_added_manually">Can be manually added?</label>
107
                        [% IF restriction && restriction.is_system %]
108
                            [% IF restriction.can_be_added_manually %]Yes[% ELSE %]No[% END %]
109
                        [% ELSIF restriction.can_be_added_manually %]
110
                            <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
111
                        [% ELSE %]
112
                            <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
113
                        [% END %]
114
                    </li>
102
                [% ELSE %]
115
                [% ELSE %]
103
                    <li>
116
                    <li>
104
                        <label for="code" class="required">Code: </label>
117
                        <label for="code" class="required">Code: </label>
Lines 110-115 Link Here
110
                        <input type="text" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
123
                        <input type="text" name="display_text" id="display_text" size="50" maxlength="50" class="required" required="required" />
111
                        <span class="required">Required</span>
124
                        <span class="required">Required</span>
112
                    </li>
125
                    </li>
126
                    <li>
127
                        <label for="can_be_added_manually">Can be manually added?</label>
128
                        [% IF restriction && restriction.is_system %]
129
                            [% IF restriction.can_be_added_manually %]Yes[% ELSE %]No[% END %]
130
                        [% ELSIF restriction.can_be_added_manually %]
131
                            <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" checked="checked" value="1" />
132
                        [% ELSE %]
133
                            <input type="checkbox" name="can_be_added_manually" id="can_be_added_manually" value="1" />
134
                        [% END %]
135
                    </li>
113
                [% END %]
136
                [% END %]
114
            </ol>
137
            </ol>
115
        </fieldset>
138
        </fieldset>
Lines 156-161 Link Here
156
                <tr>
179
                <tr>
157
                    <th scope="col">Code</th>
180
                    <th scope="col">Code</th>
158
                    <th scope="col">Label</th>
181
                    <th scope="col">Label</th>
182
                    <th scope="col">Manual</th>
159
                    <th scope="col">Default</th>
183
                    <th scope="col">Default</th>
160
                    <th scope="col">Actions</th>
184
                    <th scope="col">Actions</th>
161
                </tr>
185
                </tr>
Lines 170-180 Link Here
170
                            [% restriction.display_text | html %]
194
                            [% restriction.display_text | html %]
171
                        </td>
195
                        </td>
172
                        <td>
196
                        <td>
173
                            [% IF restriction.is_system %]Yes[% END %]
197
                            [% IF restriction.can_be_added_manually %]Yes[% END %]
198
                        </td>
199
                        <td>
200
                            [% IF restriction.default_value %]Yes[% END %]
174
                        </td>
201
                        </td>
175
                        <td class="actions">
202
                        <td class="actions">
176
                            <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>
203
                            <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>
177
                            [% IF !restriction.readonly %]
204
                            [% IF !restriction.is_system %]
178
                                <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>
205
                                <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>
179
                            [% END %]
206
                            [% END %]
180
                        </td>
207
                        </td>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +3 lines)
Lines 1373-1379 legend:hover { Link Here
1373
                                                        <label for="debarred_type">Type:</label>
1373
                                                        <label for="debarred_type">Type:</label>
1374
                                                        <select name="debarred_type">
1374
                                                        <select name="debarred_type">
1375
                                                            [% FOREACH code IN restriction_types.keys %]
1375
                                                            [% FOREACH code IN restriction_types.keys %]
1376
                                                                <option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option>
1376
                                                                [% IF restriction_types.$code.can_be_added_manually %]
1377
                                                                    <option value="[% code | html %]">[% restriction_types.$code.display_text | html %]</option>
1378
                                                                [% END %]
1377
                                                            [% END %]
1379
                                                            [% END %]
1378
                                                        </select>
1380
                                                        </select>
1379
                                                    </li>
1381
                                                    </li>
(-)a/t/db_dependent/RestrictionTypes.t (-15 / +18 lines)
Lines 17-31 use_ok('Koha::RestrictionType'); Link Here
17
use_ok('Koha::RestrictionTypes');
17
use_ok('Koha::RestrictionTypes');
18
18
19
$dbh->do(q|DELETE FROM borrower_debarments|);
19
$dbh->do(q|DELETE FROM borrower_debarments|);
20
Koha::RestrictionTypes->search->delete;
20
$dbh->do(q|DELETE FROM debarment_types|);
21
21
22
$builder->build({
22
$builder->build({
23
    source => 'DebarmentType',
23
    source => 'DebarmentType',
24
    value  => {
24
    value  => {
25
        code         => 'ONE',
25
        code         => 'ONE',
26
        display_text => 'One',
26
        display_text => 'One',
27
        readonly     => 1,
27
        is_system     => 1,
28
        is_system    => 0
28
        default_value    => 0,
29
        can_be_added_manually => 0
29
    }
30
    }
30
});
31
});
31
$builder->build({
32
$builder->build({
Lines 33-40 $builder->build({ Link Here
33
    value  => {
34
    value  => {
34
        code         => 'TWO',
35
        code         => 'TWO',
35
        display_text => 'Two',
36
        display_text => 'Two',
36
        readonly     => 1,
37
        is_system     => 1,
37
        is_system    => 1
38
        default_value    => 1,
39
        can_be_added_manually => 0
38
    }
40
    }
39
});
41
});
40
$builder->build({
42
$builder->build({
Lines 42-49 $builder->build({ Link Here
42
    value  => {
44
    value  => {
43
        code         => 'THREE',
45
        code         => 'THREE',
44
        display_text => 'Three',
46
        display_text => 'Three',
45
        readonly     => 1,
47
        is_system     => 1,
46
        is_system    => 0
48
        default_value    => 0,
49
        can_be_added_manually => 0
47
    }
50
    }
48
});
51
});
49
$builder->build({
52
$builder->build({
Lines 51-58 $builder->build({ Link Here
51
    value  => {
54
    value  => {
52
        code         => 'FOUR',
55
        code         => 'FOUR',
53
        display_text => 'Four',
56
        display_text => 'Four',
54
        readonly     => 0,
57
        is_system     => 0,
55
        is_system    => 0
58
        default_value    => 0,
59
        can_be_added_manually => 0
56
    }
60
    }
57
});
61
});
58
$builder->build({
62
$builder->build({
Lines 60-67 $builder->build({ Link Here
60
    value  => {
64
    value  => {
61
        code         => 'FIVE',
65
        code         => 'FIVE',
62
        display_text => 'Five',
66
        display_text => 'Five',
63
        readonly     => 0,
67
        is_system     => 0,
64
        is_system    => 0
68
        default_value    => 0,
69
        can_be_added_manually => 0
65
    }
70
    }
66
});
71
});
67
72
Lines 71-80 ok( $created->display_text eq 'One', 'Restrictions created'); Link Here
71
76
72
# Can we delete RestrictionTypes, when appropriate
77
# Can we delete RestrictionTypes, when appropriate
73
my $deleted = Koha::RestrictionTypes->find({ code => 'FOUR' })->delete;
78
my $deleted = Koha::RestrictionTypes->find({ code => 'FOUR' })->delete;
74
ok( $deleted == 1, 'Restriction deleted');
79
ok( $deleted, 'Restriction deleted');
75
my $not_deleted = Koha::RestrictionTypes->find({ code => 'TWO' })->delete;
80
my $not_deleted = Koha::RestrictionTypes->find({ code => 'TWO' })->delete;
76
ok( $not_deleted == 0, 'Read only restriction not deleted');
81
ok( !$not_deleted, 'Read only restriction not deleted');
77
78
82
79
# Add a patron with a debarment
83
# Add a patron with a debarment
80
my $library = $builder->build({ source => 'Branch' });
84
my $library = $builder->build({ source => 'Branch' });
81
- 

Return to bug 23681