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

(-)a/Koha/Schema/Result/Category.pm (-2 / +13 lines)
Lines 162-167 Default privacy setting for this patron category Link Here
162
162
163
produce a warning for this patron category if this item has previously been checked out to this patron if 'yes', not if 'no', defer to syspref setting if 'inherit'.
163
produce a warning for this patron category if this item has previously been checked out to this patron if 'yes', not if 'no', defer to syspref setting if 'inherit'.
164
164
165
=head2 canplaceillopac
166
167
  data_type: 'tinyint'
168
  default_value: 0
169
  is_nullable: 0
170
171
can this patron category place interlibrary loan requests
172
165
=head2 can_be_guarantee
173
=head2 can_be_guarantee
166
174
167
  data_type: 'tinyint'
175
  data_type: 'tinyint'
Lines 259-264 __PACKAGE__->add_columns( Link Here
259
    is_nullable => 0,
267
    is_nullable => 0,
260
    size => 7,
268
    size => 7,
261
  },
269
  },
270
  "canplaceillopac",
271
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
262
  "can_be_guarantee",
272
  "can_be_guarantee",
263
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
273
  { data_type => "tinyint", default_value => 0, is_nullable => 0 },
264
  "reset_password",
274
  "reset_password",
Lines 378-385 __PACKAGE__->has_many( Link Here
378
);
388
);
379
389
380
390
381
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2022-11-08 17:35:26
391
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2023-03-31 03:27:07
382
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:B89OgAY/KnJbQaHpu5Xdfg
392
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YYc52oTevOT+WXnDsG2mrQ
383
393
384
sub koha_object_class {
394
sub koha_object_class {
385
    'Koha::Patron::Category';
395
    'Koha::Patron::Category';
Lines 389-394 sub koha_objects_class { Link Here
389
}
399
}
390
400
391
__PACKAGE__->add_columns(
401
__PACKAGE__->add_columns(
402
    '+canplaceillopac'                   => { is_boolean => 1 },
392
    '+can_be_guarantee'                  => { is_boolean => 1 },
403
    '+can_be_guarantee'                  => { is_boolean => 1 },
393
    '+exclude_from_local_holds_priority' => { is_boolean => 1 },
404
    '+exclude_from_local_holds_priority' => { is_boolean => 1 },
394
    '+require_strong_password'           => { is_boolean => 1 },
405
    '+require_strong_password'           => { is_boolean => 1 },
(-)a/admin/categories.pl (+3 lines)
Lines 72-77 elsif ( $op eq 'add_validate' ) { Link Here
72
    my $category_type = $input->param('category_type');
72
    my $category_type = $input->param('category_type');
73
    my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions');
73
    my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions');
74
    my $checkPrevCheckout = $input->param('checkprevcheckout');
74
    my $checkPrevCheckout = $input->param('checkprevcheckout');
75
    my $canplaceillopac = $input->param('canplaceillopac');
75
    my $default_privacy = $input->param('default_privacy');
76
    my $default_privacy = $input->param('default_privacy');
76
    my $reset_password = $input->param('reset_password');
77
    my $reset_password = $input->param('reset_password');
77
    my $change_password = $input->param('change_password');
78
    my $change_password = $input->param('change_password');
Lines 105-110 elsif ( $op eq 'add_validate' ) { Link Here
105
        $category->can_be_guarantee($can_be_guarantee);
106
        $category->can_be_guarantee($can_be_guarantee);
106
        $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
107
        $category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
107
        $category->checkprevcheckout($checkPrevCheckout);
108
        $category->checkprevcheckout($checkPrevCheckout);
109
        $category->canplaceillopac($canplaceillopac);
108
        $category->default_privacy($default_privacy);
110
        $category->default_privacy($default_privacy);
109
        $category->reset_password($reset_password);
111
        $category->reset_password($reset_password);
110
        $category->change_password($change_password);
112
        $category->change_password($change_password);
Lines 138-143 elsif ( $op eq 'add_validate' ) { Link Here
138
            can_be_guarantee => $can_be_guarantee,
140
            can_be_guarantee => $can_be_guarantee,
139
            BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
141
            BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
140
            checkprevcheckout => $checkPrevCheckout,
142
            checkprevcheckout => $checkPrevCheckout,
143
            canplaceillopac => $canplaceillopac,
141
            default_privacy => $default_privacy,
144
            default_privacy => $default_privacy,
142
            reset_password => $reset_password,
145
            reset_password => $reset_password,
143
            change_password => $change_password,
146
            change_password => $change_password,
(-)a/installer/data/mysql/atomicupdate/bug_18203.pl (+17 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "18203",
5
    description => "Add per borrower category restrictions on ILL placement",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        unless ( column_exists('categories', 'canplaceillopac') ) {
10
            $dbh->do(q{
11
                ALTER TABLE `categories`
12
                ADD COLUMN `canplaceillopac` TINYINT(1) NOT NULL DEFAULT 1 COMMENT 'can this patron category place interlibrary loan requests'
13
                AFTER `checkprevcheckout`;
14
            });
15
        }
16
    },
17
};
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 1676-1681 CREATE TABLE `categories` ( Link Here
1676
  `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL DEFAULT -1 COMMENT 'wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions',
1676
  `BlockExpiredPatronOpacActions` tinyint(1) NOT NULL DEFAULT -1 COMMENT 'wheither or not a patron of this category can renew books or place holds once their card has expired. 0 means they can, 1 means they cannot, -1 means use syspref BlockExpiredPatronOpacActions',
1677
  `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1677
  `default_privacy` enum('default','never','forever') NOT NULL DEFAULT 'default' COMMENT 'Default privacy setting for this patron category',
1678
  `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron category if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to syspref setting if ''inherit''.',
1678
  `checkprevcheckout` varchar(7) NOT NULL DEFAULT 'inherit' COMMENT 'produce a warning for this patron category if this item has previously been checked out to this patron if ''yes'', not if ''no'', defer to syspref setting if ''inherit''.',
1679
  `canplaceillopac` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'can this patron category place interlibrary loan requests',
1679
  `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees',
1680
  `can_be_guarantee` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'if patrons of this category can be guarantees',
1680
  `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,',
1681
  `reset_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can do the password reset flow,',
1681
  `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC',
1682
  `change_password` tinyint(1) DEFAULT NULL COMMENT 'if patrons of this category can change their passwords in the OAPC',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt (+29 lines)
Lines 405-410 Link Here
405
                      </div>
405
                      </div>
406
                  </li>
406
                  </li>
407
                [% END %]
407
                [% END %]
408
                [% IF ( Koha.Preference('ILLModule') ) %]
409
                    <li>
410
                        <label for="canplaceillopac">Can place ILL in OPAC: </label>
411
                        <select id="canplaceillopac" name="canplaceillopac">
412
                            [% IF category.canplaceillopac %]
413
                                <option value="0">No</option>
414
                                <option value="1" selected="selected">Yes</option>
415
                            [% ELSE %]
416
                                <option value="0" selected="selected">No</option>
417
                                <option value="1">Yes</option>
418
                            [% END %]
419
                        </select>
420
                        <div class="hint">
421
                            Choose whether patrons of this category can create new interlibrary loan requests.
422
                        </div>
423
                    </li>
424
                [% END %]
408
                <li>
425
                <li>
409
                    <label for="default_privacy">Default privacy: </label>
426
                    <label for="default_privacy">Default privacy: </label>
410
                    <select id="default_privacy" name="default_privacy">
427
                    <select id="default_privacy" name="default_privacy">
Lines 509-514 Link Here
509
                      </td>
526
                      </td>
510
                  </tr>
527
                  </tr>
511
                [% END %]
528
                [% END %]
529
                [% IF ( Koha.Preference('ILLModule') ) %]
530
                    <tr>
531
                        <th scope="row">Can place ILL in OPAC: </th>
532
                        <td>[% IF category.canplaceillopac %]Yes[% ELSE %]No[% END %]</td>
533
                    </tr>
534
                [% END %]
512
                <tr><th scope="row">Can be guarantee</th><td>[% IF category.can_be_guarantee %]Yes[% ELSE %]No[% END %]</td></tr>
535
                <tr><th scope="row">Can be guarantee</th><td>[% IF category.can_be_guarantee %]Yes[% ELSE %]No[% END %]</td></tr>
513
                <tr>
536
                <tr>
514
                    <th scope="row">Default privacy: </th>
537
                    <th scope="row">Default privacy: </th>
Lines 571-576 Link Here
571
                    [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
594
                    [% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
572
                    <th scope="col">Check previous checkout?</th>
595
                    <th scope="col">Check previous checkout?</th>
573
                    [% END %]
596
                    [% END %]
597
                    [% IF ( Koha.Preference('ILLModule') ) %]
598
                    <th scope="col">Can place ILL in OPAC?</th>
599
                    [% END %]
574
                    <th scope="col">Can be guarantee</th>
600
                    <th scope="col">Can be guarantee</th>
575
                    <th scope="col">Default privacy</th>
601
                    <th scope="col">Default privacy</th>
576
                    <th scope="col">Exclude from local holds priority</th>
602
                    <th scope="col">Exclude from local holds priority</th>
Lines 689-694 Link Here
689
                              <span>Inherit</span>
715
                              <span>Inherit</span>
690
                              [% END %]
716
                              [% END %]
691
                          </td>
717
                          </td>
718
                        [% END %]
719
                         [% IF ( Koha.Preference('ILLModule') ) %]
720
                            <td>[% IF category.canplaceillopac %] Yes [% ELSE %] No [% END %]</td>
692
                        [% END %]
721
                        [% END %]
693
                        <td>[% IF category.can_be_guarantee %] Yes [% ELSE %] No [% END %]</td>
722
                        <td>[% IF category.can_be_guarantee %] Yes [% ELSE %] No [% END %]</td>
694
                        <td>
723
                        <td>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt (-8 / +12 lines)
Lines 112-119 Link Here
112
                            <h1>Interlibrary loan requests</h1>
112
                            <h1>Interlibrary loan requests</h1>
113
                            [% INCLUDE messages %]
113
                            [% INCLUDE messages %]
114
114
115
                            <div id="illrequests-create-button" class="dropdown btn-group">
115
                            [% IF canplaceillopac %]
116
                                [% IF backends.size > 1 %]
116
                                <div id="illrequests-create-button" class="dropdown btn-group">
117
                                    [% IF backends.size > 1 %]
117
                                        <button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
118
                                        <button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
118
                                            <i class="fa fa-plus" aria-hidden="true"></i> Create a new request <span class="caret"></span>
119
                                            <i class="fa fa-plus" aria-hidden="true"></i> Create a new request <span class="caret"></span>
119
                                        </button>
120
                                        </button>
Lines 122-133 Link Here
122
                                                <a class="dropdown-item" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backend | uri %]">[% backend | html %]</a>
123
                                                <a class="dropdown-item" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backend | uri %]">[% backend | html %]</a>
123
                                            [% END %]
124
                                            [% END %]
124
                                        </div>
125
                                        </div>
125
                                [% ELSE %]
126
                                    [% ELSE %]
126
                                    <a id="ill-new" class="btn btn-primary" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backends.0 | html %]">
127
                                        <a id="ill-new" class="btn btn-primary" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backends.0 | html %]">
127
                                        <i class="fa fa-plus" aria-hidden="true"></i> Create a new request
128
                                            <i class="fa fa-plus" aria-hidden="true"></i> Create a new request
128
                                    </a>
129
                                        </a>
129
                                [% END %]
130
                                    [% END %]
130
                            </div>
131
                                </div>
132
                            [% END %]
131
133
132
                            <table id="illrequestlist" class="table table-bordered table-striped">
134
                            <table id="illrequestlist" class="table table-bordered table-striped">
133
                                <caption class="sr-only">Requests</caption>
135
                                <caption class="sr-only">Requests</caption>
Lines 232-237 Link Here
232
                                        </div>
234
                                        </div>
233
                                    [% END %]
235
                                    [% END %]
234
                                </div>
236
                                </div>
237
                            [% IF canplaceillopac %]
235
                                <fieldset class="action illrequest-actions">
238
                                <fieldset class="action illrequest-actions">
236
                                    <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
239
                                    <input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
237
                                    <input type="hidden" name="method" value="update" />
240
                                    <input type="hidden" name="method" value="update" />
Lines 243-248 Link Here
243
                                    [% END %]
246
                                    [% END %]
244
                                    <span class="cancel"><a href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a></span>
247
                                    <span class="cancel"><a href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a></span>
245
                                </fieldset>
248
                                </fieldset>
249
                            [% END %]
246
                            </form>
250
                            </form>
247
                        [% ELSIF method == 'availability' %]
251
                        [% ELSIF method == 'availability' %]
248
                            <h1>Interlibrary loan item availability</h1>
252
                            <h1>Interlibrary loan item availability</h1>
(-)a/opac/opac-illrequests.pl (-4 / +8 lines)
Lines 56-64 my $reduced = C4::Context->preference('ILLOpacbackends'); Link Here
56
my $backends = Koha::Illrequest::Config->new->available_backends($reduced);
56
my $backends = Koha::Illrequest::Config->new->available_backends($reduced);
57
my $backends_available = ( scalar @{$backends} > 0 );
57
my $backends_available = ( scalar @{$backends} > 0 );
58
$template->param( backends_available => $backends_available );
58
$template->param( backends_available => $backends_available );
59
my $patron = Koha::Patrons->find($loggedinuser);
59
60
60
my $op = $params->{'method'} || 'list';
61
my $op = $params->{'method'} || 'list';
61
62
63
if( ($op eq 'create' || $op eq 'cancreq' || $op eq 'update') && !$patron->_result->categorycode->canplaceillopac ) {
64
        print $query->redirect('/cgi-bin/koha/errors/403.pl');
65
        exit;
66
}
67
62
if ( $op eq 'list' ) {
68
if ( $op eq 'list' ) {
63
69
64
    my $requests = Koha::Illrequests->search(
70
    my $requests = Koha::Illrequests->search(
Lines 154-162 if ( $op eq 'list' ) { Link Here
154
            }
160
            }
155
        }
161
        }
156
162
157
        $params->{cardnumber} = Koha::Patrons->find({
163
        $params->{cardnumber} = $patron->cardnumber;
158
            borrowernumber => $loggedinuser
159
        })->cardnumber;
160
        $params->{opac} = 1;
164
        $params->{opac} = 1;
161
        my $backend_result = $request->backend_create($params);
165
        my $backend_result = $request->backend_create($params);
162
        if ($backend_result->{stage} eq 'copyrightclearance') {
166
        if ($backend_result->{stage} eq 'copyrightclearance') {
Lines 181-186 if ( $op eq 'list' ) { Link Here
181
}
185
}
182
186
183
$template->param(
187
$template->param(
188
    canplaceillopac => $patron->_result->categorycode->canplaceillopac,
184
    message         => $params->{message},
189
    message         => $params->{message},
185
    illrequestsview => 1,
190
    illrequestsview => 1,
186
    method          => $op
191
    method          => $op
187
- 

Return to bug 18203