Bugzilla – Attachment 36608 Details for
Bug 13479
Add option to add/remove biblios from list of books with forced item holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13479: Enable/disable forced item holds on biblio level
Bug-13479-Enabledisable-forced-item-holds-on-bibli.patch (text/plain), 6.60 KB, created by
Marcel de Rooy
on 2015-03-05 14:30:15 UTC
(
hide
)
Description:
Bug 13479: Enable/disable forced item holds on biblio level
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2015-03-05 14:30:15 UTC
Size:
6.60 KB
patch
obsolete
>From e3e38193b6665073d84413af7c9a3905081b25ac Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 5 Mar 2015 15:24:06 +0100 >Subject: [PATCH] Bug 13479: Enable/disable forced item holds on biblio level >Content-Type: text/plain; charset=utf-8 > >This is a follow-up of report 13478. >If you set OPACItemHolds to 'selectiveforce', you can now enable or disable >forced item holds on biblio level on the Holds tab of the staff detail >page. >--- > C4/Reserves.pm | 12 +++++ > .../prog/en/modules/reserve/request.tt | 44 ++++++++++++++++++ > reserve/request.pl | 1 + > reserve/update_forceitemholds.pl | 49 ++++++++++++++++++++ > 4 files changed, 106 insertions(+), 0 deletions(-) > create mode 100755 reserve/update_forceitemholds.pl > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 476f366..010d8d5 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -2451,6 +2451,18 @@ sub CheckBiblioForceItemHolds { > return 1 if $rec && $rec->force_item_holds; > } > >+=head2 ModBiblioForceItemHolds >+ >+=cut >+ >+sub ModBiblioForceItemHolds { >+ my ( $biblionumber, $newmode ) = @_; >+ my $rec = Koha::Database->new()->schema()->resultset('Biblio')->find( $biblionumber ); >+ return 0 if !$rec; >+ my $rv = $rec->update({ force_item_holds => $newmode? 1: 0 }); >+ return $rv ? 1 : 0; >+} >+ > =head1 AUTHOR > > Koha Development Team <http://koha-community.org/> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >index db044b5..b974ee5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt >@@ -1,3 +1,4 @@ >+[% USE Koha %] > [% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > [% UNLESS ( multi_hold ) %] >@@ -24,6 +25,12 @@ $(document).ready(function() { > [% IF AutoResumeSuspendedHolds %] > $(".suspend_until_datepicker, .datepickerfrom, .datepickerto").datepicker("option", "minDate", 1); > [% END %] >+ [% IF biblioloop && biblioloop.0.forceitemhold %] >+ [%# we only check the first biblio (0) because we do not show the form for multiple biblios %] >+ $("#forceitemhold_enabled").toggle(); >+ [% ELSE %] >+ $("#forceitemhold_disabled").toggle(); >+ [% END %] > }); > > function check() { >@@ -98,6 +105,27 @@ function checkMultiHold() { > return true; > } > >+function UpdateForceItemHold(biblio,mode) { >+ $(".forceitemholdbtn").prop("disabled",true); >+ var url = 'update_forceitemholds.pl?biblio=' + biblio+ "&mode=" + mode; >+ var req = $.ajax({ >+ url: url, >+ type: "GET", >+ dataType: "text" >+ }); >+ req.done( function( data, status, obj ) { >+ if( obj.responseText == '1' ) { >+ $("#forceitemhold_disabled").toggle(); >+ $("#forceitemhold_enabled").toggle(); >+ } >+ $(".forceitemholdbtn").prop("disabled",false); >+ }); >+ req.fail( function( obj, status, err ) { >+ alert('Something went wrong. Please try again later.'); >+ $(".forceitemholdbtn").prop("disabled",false); >+ }); >+} >+ > $(document).ready(function() { > $("input.needsoverride").click(function() { // This must be before the radio button/checkbox switch logic > var itemnumber = this.value; >@@ -207,6 +235,22 @@ function checkMultiHold() { > </div> > [% END %] > >+ [% IF !multi_hold && Koha.Preference('OPACItemHolds')=='selectiveforce' %] >+ <form> >+ <fieldset class="brief"> >+ <label>Force item holds</label> >+ <span id="forceitemhold_disabled" style="display:none;"> >+ <div class="hint">Currently, forced item holds for this biblio are disabled in OPAC.</div> >+ <input type="button" class="forceitemholdbtn" value="Enable" onclick="javascript:return UpdateForceItemHold([% biblioloop.0.biblionumber %],1);" /> >+ </span> >+ <span id="forceitemhold_enabled" style="display:none;"> >+ <div class="hint">Currently, forced item holds for this biblio are enabled in OPAC.</div> >+ <input type="button" class="forceitemholdbtn" value="Disable" onclick="javascript:return UpdateForceItemHold([% biblioloop.0.biblionumber %],0);" /> >+ </span> >+ </fieldset> >+ </form> >+ [% END %] >+ > [% UNLESS ( multi_hold ) %] > <h1>Place a hold on [% INCLUDE 'biblio-default-view.inc' %][% title |html %]</a></h1> > [% ELSE %] >diff --git a/reserve/request.pl b/reserve/request.pl >index ce0e70f..ca0bb89 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -582,6 +582,7 @@ foreach my $biblionumber (@biblionumbers) { > $biblioloopiter{title} = $dat->{title}; > $biblioloopiter{rank} = $fixedRank; > $biblioloopiter{reserveloop} = \@reserveloop; >+ $biblioloopiter{forceitemhold} = C4::Reserves::CheckBiblioForceItemHolds( $biblionumber ); > > if (@reserveloop) { > $template->param( reserveloop => \@reserveloop ); >diff --git a/reserve/update_forceitemholds.pl b/reserve/update_forceitemholds.pl >new file mode 100755 >index 0000000..c604f0a >--- /dev/null >+++ b/reserve/update_forceitemholds.pl >@@ -0,0 +1,49 @@ >+#!/usr/bin/perl >+ >+# Copyright 2015 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 2 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, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use CGI qw ( -utf8 ); >+#use C4::Context; >+use C4::Auth; >+use C4::Output; >+use C4::Reserves qw//; >+ >+=head1 DESCRIPTION >+ >+Update force item holds for a specific biblio >+ >+=cut >+ >+my $input = new CGI; >+my $biblio = $input->param('biblio'); >+my $mode = $input->param('mode'); >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { template_name => "acqui/ajax.tt", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ } >+); >+ >+my $rv = C4::Reserves::ModBiblioForceItemHolds( $biblio, $mode ); >+print $input->header(-type => 'text/plain', -charset => 'UTF-8'); >+print $rv//0; >+#output_html_with_http_headers $input, $cookie, $template->output; >-- >1.7.7.6
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 13479
:
36606
|
36608
|
36921