Bug 18203: Add per borrower category restrictions on placing ILL requests
Test Plan: - Enable ILLModule sys pref and install any backend, or run bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) - Verify you can place new ILL requests in OPAC and Intranet - Apply patch - In borrower categories, verify there's a new column for 'can place ILL in opac' and is set to 'yes' by default - Edit your borrower's patron category and set 'can place ILL in opac' to 'No' - Verify you can no longer place new ILL requests in OPAC - Verify you also cannot place new ILL requests through URL: :8080/cgi-bin/koha/opac-illrequests.pl?method=create&backend=FreeForm Signed-off-by: Sam Lau <samalau@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
0780ae325d
commit
13720defdd
4 changed files with 53 additions and 11 deletions
|
@ -72,6 +72,7 @@ elsif ( $op eq 'add_validate' ) {
|
|||
my $category_type = $input->param('category_type');
|
||||
my $BlockExpiredPatronOpacActions = $input->param('BlockExpiredPatronOpacActions');
|
||||
my $checkPrevCheckout = $input->param('checkprevcheckout');
|
||||
my $canplaceillopac = $input->param('canplaceillopac');
|
||||
my $default_privacy = $input->param('default_privacy');
|
||||
my $reset_password = $input->param('reset_password');
|
||||
my $change_password = $input->param('change_password');
|
||||
|
@ -105,6 +106,7 @@ elsif ( $op eq 'add_validate' ) {
|
|||
$category->can_be_guarantee($can_be_guarantee);
|
||||
$category->BlockExpiredPatronOpacActions($BlockExpiredPatronOpacActions);
|
||||
$category->checkprevcheckout($checkPrevCheckout);
|
||||
$category->canplaceillopac($canplaceillopac);
|
||||
$category->default_privacy($default_privacy);
|
||||
$category->reset_password($reset_password);
|
||||
$category->change_password($change_password);
|
||||
|
@ -138,6 +140,7 @@ elsif ( $op eq 'add_validate' ) {
|
|||
can_be_guarantee => $can_be_guarantee,
|
||||
BlockExpiredPatronOpacActions => $BlockExpiredPatronOpacActions,
|
||||
checkprevcheckout => $checkPrevCheckout,
|
||||
canplaceillopac => $canplaceillopac,
|
||||
default_privacy => $default_privacy,
|
||||
reset_password => $reset_password,
|
||||
change_password => $change_password,
|
||||
|
|
|
@ -384,6 +384,23 @@
|
|||
</div>
|
||||
</li>
|
||||
[% END %]
|
||||
[% IF ( Koha.Preference('ILLModule') ) %]
|
||||
<li>
|
||||
<label for="canplaceillopac">Can place ILL in OPAC: </label>
|
||||
<select id="canplaceillopac" name="canplaceillopac">
|
||||
[% IF category.canplaceillopac %]
|
||||
<option value="0">No</option>
|
||||
<option value="1" selected="selected">Yes</option>
|
||||
[% ELSE %]
|
||||
<option value="0" selected="selected">No</option>
|
||||
<option value="1">Yes</option>
|
||||
[% END %]
|
||||
</select>
|
||||
<div class="hint">
|
||||
Choose whether patrons of this category can create new interlibrary loan requests.
|
||||
</div>
|
||||
</li>
|
||||
[% END %]
|
||||
<li>
|
||||
<label for="default_privacy">Default privacy: </label>
|
||||
<select id="default_privacy" name="default_privacy">
|
||||
|
@ -487,6 +504,13 @@
|
|||
</tr>
|
||||
[% END %]
|
||||
<tr><th scope="row">Can be guarantee:</th><td>[% IF category.can_be_guarantee %]Yes[% ELSE %]No[% END %]</td></tr>
|
||||
[% IF ( Koha.Preference('ILLModule') ) %]
|
||||
<tr>
|
||||
<th scope="row">Can place ILL in OPAC: </th>
|
||||
<td>[% IF category.canplaceillopac %]Yes[% ELSE %]No[% END %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
<tr><th scope="row">Can be guarantee</th><td>[% IF category.can_be_guarantee %]Yes[% ELSE %]No[% END %]</td></tr>
|
||||
<tr>
|
||||
<th scope="row">Default privacy: </th>
|
||||
<td>
|
||||
|
@ -550,6 +574,9 @@
|
|||
[% IF ( Koha.Preference('CheckPrevCheckout') == 'softyes' || Koha.Preference('CheckPrevCheckout') == 'softno' ) %]
|
||||
<th scope="col">Check previous checkout?</th>
|
||||
[% END %]
|
||||
[% IF ( Koha.Preference('ILLModule') ) %]
|
||||
<th scope="col">Can place ILL in OPAC?</th>
|
||||
[% END %]
|
||||
<th scope="col">Can be guarantee</th>
|
||||
<th scope="col">Default privacy</th>
|
||||
<th scope="col">Exclude from local holds priority</th>
|
||||
|
@ -668,6 +695,9 @@
|
|||
<span>Inherit</span>
|
||||
[% END %]
|
||||
</td>
|
||||
[% END %]
|
||||
[% IF ( Koha.Preference('ILLModule') ) %]
|
||||
<td>[% IF category.canplaceillopac %] Yes [% ELSE %] No [% END %]</td>
|
||||
[% END %]
|
||||
<td>[% IF category.can_be_guarantee %] Yes [% ELSE %] No [% END %]</td>
|
||||
<td>
|
||||
|
|
|
@ -112,6 +112,7 @@
|
|||
<h1>Interlibrary loan requests</h1>
|
||||
[% INCLUDE messages %]
|
||||
|
||||
[% IF canplaceillopac %]
|
||||
<div id="illrequests-create-button" class="dropdown btn-group">
|
||||
[% IF backends.size > 1 %]
|
||||
<button class="btn btn-primary dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
|
||||
|
@ -128,6 +129,7 @@
|
|||
</a>
|
||||
[% END %]
|
||||
</div>
|
||||
[% END %]
|
||||
|
||||
<table id="illrequestlist" class="table table-bordered table-striped">
|
||||
<caption class="sr-only">Requests</caption>
|
||||
|
@ -232,6 +234,7 @@
|
|||
</div>
|
||||
[% END %]
|
||||
</div>
|
||||
[% IF canplaceillopac %]
|
||||
<fieldset class="action illrequest-actions">
|
||||
<input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]" />
|
||||
<input type="hidden" name="method" value="update" />
|
||||
|
@ -243,6 +246,7 @@
|
|||
[% END %]
|
||||
<span class="cancel"><a href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a></span>
|
||||
</fieldset>
|
||||
[% END %]
|
||||
</form>
|
||||
[% ELSIF method == 'availability' %]
|
||||
<h1>Interlibrary loan item availability</h1>
|
||||
|
|
|
@ -58,6 +58,7 @@ my $reduced = C4::Context->preference('ILLOpacbackends');
|
|||
my $backends = Koha::Illrequest::Config->new->available_backends($reduced);
|
||||
my $backends_available = ( scalar @{$backends} > 0 );
|
||||
$template->param( backends_available => $backends_available );
|
||||
my $patron = Koha::Patrons->find($loggedinuser);
|
||||
|
||||
my $op = $params->{'method'} || 'list';
|
||||
|
||||
|
@ -71,6 +72,11 @@ if ( $illrequest_id = $params->{illrequest_id} ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( ( $op eq 'create' || $op eq 'cancreq' || $op eq 'update' ) && !$patron->_result->categorycode->canplaceillopac ) {
|
||||
print $query->redirect('/cgi-bin/koha/errors/403.pl');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ( $op eq 'list' ) {
|
||||
|
||||
my $requests = Koha::Illrequests->search(
|
||||
|
@ -140,9 +146,7 @@ if ( $op eq 'list' ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
$params->{cardnumber} = Koha::Patrons->find({
|
||||
borrowernumber => $loggedinuser
|
||||
})->cardnumber;
|
||||
$params->{cardnumber} = $patron->cardnumber;
|
||||
$params->{opac} = 1;
|
||||
my $backend_result = $request->backend_create($params);
|
||||
|
||||
|
@ -175,6 +179,7 @@ if ( $op eq 'list' ) {
|
|||
}
|
||||
|
||||
$template->param(
|
||||
canplaceillopac => $patron->_result->categorycode->canplaceillopac,
|
||||
message => $params->{message},
|
||||
illrequestsview => 1,
|
||||
method => $op
|
||||
|
|
Loading…
Reference in a new issue