Bugzilla – Attachment 40031 Details for
Bug 14310
Add ability to suspend and resume individual holds from the patron holds table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14310 - Suspend and resume indvidual holds from patron holds table
Bug-14310---Suspend-and-resume-indvidual-holds-fro.patch (text/plain), 27.44 KB, created by
Kyle M Hall (khall)
on 2015-06-09 16:59:22 UTC
(
hide
)
Description:
Bug 14310 - Suspend and resume indvidual holds from patron holds table
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-06-09 16:59:22 UTC
Size:
27.44 KB
patch
obsolete
>From 9709e2fa1191fb99cc05109b50a3ad31172da0fe Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 1 Jun 2015 09:02:21 -0400 >Subject: [PATCH] Bug 14310 - Suspend and resume indvidual holds from patron holds table > >This enhancment adds the ability to suspend and resume individual holds >from the holds table on circulation.pl and moremember.pl. > >The interface is inspired/cribbed from the same feature already >available in the opac. > >Test Plan: >1) Apply this patch >2) Find a patron with holds >3) Suspend a hold with no resume date >4) Resume the suspended hold >5) Suspend a hold with a resume date >6) Resume the suspended hold >--- > Koha/Biblio.pm | 13 +++ > Koha/Hold.pm | 68 +++++++++++++++- > koha-tmpl/intranet-tmpl/prog/en/js/holds.js | 87 ++++++++++++++++++-- > .../prog/en/modules/circ/circulation.tt | 1 + > .../prog/en/modules/members/moremember.tt | 1 + > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 54 +++++++----- > opac/opac-user.pl | 79 ++---------------- > svc/hold/resume | 48 +++++++++++ > svc/hold/suspend | 51 ++++++++++++ > 9 files changed, 300 insertions(+), 102 deletions(-) > create mode 100755 svc/hold/resume > create mode 100755 svc/hold/suspend > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index 9c467d7..2145a04 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -21,6 +21,8 @@ use Modern::Perl; > > use Carp; > >+use C4::Biblio qw( GetRecordValue GetMarcBiblio GetFrameworkCode ); >+ > use Koha::Database; > > use base qw(Koha::Object); >@@ -35,6 +37,17 @@ Koha::Biblio - Koha Biblio Object class > > =cut > >+=head3 subtitle >+ >+=cut >+ >+sub subtitle { >+ my ( $self ) = @_; >+ >+ return GetRecordValue( 'subtitle', GetMarcBiblio( $self->id() ), GetFrameworkCode( $self->id() ) ); >+} >+ >+ > =head3 type > > =cut >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 1b743e8..9f5eabd 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -41,6 +41,47 @@ Koha::Hold - Koha Hold object class > > =cut > >+=head3 suspend_hold >+ >+my $hold = $hold->suspend_hold( $suspend_until_dt ); >+ >+=cut >+ >+sub suspend_hold { >+ my ( $self, $dt ) = @_; >+ >+ if ( $self->is_waiting ) { # We can't suspend waiting holds >+ carp "Unable to suspend waiting hold!"; >+ return $self; >+ } >+ >+ $dt ||= undef; >+ >+ $self->suspend(1); >+ $self->suspend_until( $dt ); >+ >+ $self->store(); >+ >+ return $self; >+} >+ >+=head3 resume >+ >+my $hold = $hold->resume(); >+ >+=cut >+ >+sub resume { >+ my ( $self ) = @_; >+ >+ $self->suspend(0); >+ $self->suspend_until( undef ); >+ >+ $self->store(); >+ >+ return $self; >+} >+ > =head3 waiting_expires_on > > Returns a DateTime for the date a waiting holds expires on. >@@ -52,7 +93,7 @@ Returns undef if the hold is not waiting ( found = 'W' ). > sub waiting_expires_on { > my ($self) = @_; > >- return unless $self->found() eq 'W'; >+ return unless $self->found() && $self->found() eq 'W'; > > my $ReservesMaxPickUpDelay = C4::Context->preference('ReservesMaxPickUpDelay'); > return unless $ReservesMaxPickUpDelay; >@@ -91,6 +132,19 @@ sub is_waiting { > return $self->found() eq 'W'; > } > >+=head3 is_cancelable >+ >+Returns true if hold is a cancelable hold >+ >+=cut >+ >+sub is_cancelable { >+ my ($self) = @_; >+ >+ return ( $self->is_waiting() && !$self->is_found() ) >+ || ( !$self->is_waiting() && !$self->is_in_transit() ); >+} >+ > =head3 is_in_transit > > Returns true if hold is a in_transit hold >@@ -104,6 +158,18 @@ sub is_in_transit { > return $self->found() eq 'T'; > } > >+=head3 is_at_destination >+ >+Returns true if hold is a in_transit hold >+ >+=cut >+ >+sub is_at_destination { >+ my ($self) = @_; >+ >+ return $self->is_waiting() && ( $self->branchcode() eq $self->item()->holdingbranch() ); >+} >+ > =head3 biblio > > Returns the related Koha::Biblio object for this hold >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js >index 077b3b6..bf7ea44 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/holds.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/holds.js >@@ -8,11 +8,12 @@ $(document).ready(function() { > if ( $("#holds-tab").parent().hasClass('ui-state-active') ) { load_holds_table() } > > function load_holds_table() { >+ var holds = new Array(); > if ( ! holdsTable ) { > holdsTable = $("#holds-table").dataTable({ > "bAutoWidth": false, > "sDom": "rt", >- "aoColumns": [ >+ "columns": [ > { > "mDataProp": "reservedate_formatted" > }, >@@ -119,21 +120,53 @@ $(document).ready(function() { > + "<input type='hidden' name='borrowernumber' value='" + borrowernumber + "'>" > + "<input type='hidden' name='reserve_id' value='" + oObj.reserve_id + "'>"; > } >+ }, >+ { >+ "bSortable": false, >+ "mDataProp": function( oObj ) { >+ holds[oObj.reserve_id] = oObj; //Store holds for later use >+ >+ if ( oObj.found ) { >+ return ""; >+ } else if ( oObj.suspend == 1 ) { >+ return "<a class='hold-resume btn btn-link' id='resume" + oObj.reserve_id + "' style='display: inline; white-space: nowrap;'>" >+ + "<i class='icon-play'></i> " + _("Resume") + "</a>"; >+ } else { >+ return "<a class='hold-suspend btn btn-link' id='suspend" + oObj.reserve_id + "' style='display: inline; white-space: nowrap;'>" >+ + "<i class='icon-pause'></i> " + _("Suspend") + "</a>"; >+ } >+ } > } > ], > "bPaginate": false, > "bProcessing": true, > "bServerSide": false, >- "sAjaxSource": '/cgi-bin/koha/svc/holds', >- "fnServerData": function ( sSource, aoData, fnCallback ) { >- aoData.push( { "name": "borrowernumber", "value": borrowernumber } ); >- >- $.getJSON( sSource, aoData, function (json) { >- fnCallback(json) >- } ); >+ "ajax": { >+ "url": '/cgi-bin/koha/svc/holds', >+ "data": function ( d ) { >+ d.borrowernumber = borrowernumber; >+ } > }, > }); > >+ $('#holds-table').on( 'draw.dt', function () { >+ $(".hold-suspend").on( "click", function() { >+ var id = $(this).attr("id").replace("suspend", ""); >+ var hold = holds[id]; >+ $("#suspend-modal-title").html( hold.title ); >+ $("#suspend-modal-reserve_id").val( hold.reserve_id ); >+ $('#suspend-modal').modal('show'); >+ }); >+ >+ $(".hold-resume").on( "click", function() { >+ var id = $(this).attr("id").replace("resume", ""); >+ var hold = holds[id]; >+ $.post('/cgi-bin/koha/svc/hold/resume', { "reserve_id": hold.reserve_id }, function( data ){ >+ holdsTable.api().ajax.reload(); >+ }); >+ }); >+ }); >+ > if ( $("#holds-table").length ) { > $("#holds-table_processing").position({ > of: $( "#holds-table" ), >@@ -142,4 +175,42 @@ $(document).ready(function() { > } > } > } >+ >+ $("body").append("\ >+ <div id='suspend-modal' class='modal hide fade' tabindex='-1' role='dialog' aria-hidden='true'>\ >+ <form id='suspend-modal-form' class='form-inline'>\ >+ <div class='modal-header'>\ >+ <button type='button' class='closebtn' data-dismiss='modal' aria-hidden='true'>Ã</button>\ >+ <h3 id='suspend-modal-label'>" + _("Suspend hold on") + " <i><span id='suspend-modal-title'></span></i></h3>\ >+ </div>\ >+\ >+ <div class='modal-body'>\ >+ <input type='hidden' id='suspend-modal-reserve_id' name='reserve_id' />\ >+\ >+ <label for='suspend-modal-until'>Suspend until:</label>\ >+ <input name='suspend_until' id='suspend-modal-until' class='suspend-until' size='10' />\ >+\ >+ <p/><a class='btn btn-link' id='suspend-modal-clear-date' >" + _("Clear date to suspend indefinitely") + "</a></p>\ >+\ >+ </div>\ >+\ >+ <div class='modal-footer'>\ >+ <button id='suspend-modal-submit' class='btn btn-primary' type='submit' name='submit'>" + _("Suspend") + "</button>\ >+ <a href='#' data-dismiss='modal' aria-hidden='true' class='cancel'>" + _("Cancel") + "</a>\ >+ </div>\ >+ </form>\ >+ </div>\ >+ "); >+ >+ $("#suspend-modal-until").datepicker({ minDate: 1 }); // Require that "until date" be in the future >+ $("#suspend-modal-clear-date").on( "click", function() { $("#suspend-modal-until").val(""); } ); >+ >+ $("#suspend-modal-submit").on( "click", function( e ) { >+ e.preventDefault(); >+ $.post('/cgi-bin/koha/svc/hold/suspend', $('#suspend-modal-form').serialize(), function( data ){ >+ $('#suspend-modal').modal('hide'); >+ holdsTable.api().ajax.reload(); >+ }); >+ }); >+ > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 9b58f2c..594d225 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -895,6 +895,7 @@ No patron matched <span class="ex">[% message %]</span> > <th>Expiration</th> > <th>Priority</th> > <th>Delete?</th> >+ <th>Suspend?</th> > </tr> > </thead> > </table> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 8ddb526..ecce9c7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -484,6 +484,7 @@ function validate1(date) { > <th>Expiration</th> > <th>Priority</th> > <th>Delete?</th> >+ <th>Suspend?</th> > </tr> > </thead> > </table> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 85c985d..a489cdb 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -511,9 +511,9 @@ > </thead> > <tbody> > [% FOREACH RESERVE IN RESERVES %] >- [% IF ( RESERVE.wait ) %] >- [% IF ( RESERVE.atdestination ) %] >- [% IF ( RESERVE.found ) %] >+ [% IF ( RESERVE.is_waiting ) %] >+ [% IF ( RESERVE.is_at_destination ) %] >+ [% IF ( RESERVE.is_found ) %] > <tr class="reserved"> > [% ELSE %] > <tr> >@@ -526,13 +526,13 @@ > [% END %] > <td class="title"> > <a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% RESERVE.biblionumber %]"> >- [% RESERVE.reserves_title %] >- [% FOREACH subtitl IN RESERVE.subtitle %] >+ [% RESERVE.biblio.title %] >+ [% FOREACH subtitl IN RESERVE.biblio.subtitle %] > [% subtitl.subfield %] > [% END %] >- [% RESERVE.enumchron %] >+ [% RESERVE.item.enumchron %] > </a> >- [% RESERVE.author %] >+ [% RESERVE.biblio.author %] > </td> > <td class="reservedate"> > <span title="[% RESERVE.reservedate %]"> >@@ -541,19 +541,23 @@ > </span> > </td> > <td class="expirationdate"> >- [% IF ( RESERVE.expirationdate ) %] >- <span> >+ [% IF ! RESERVE.found %] >+ [% IF ( RESERVE.expirationdate ) %] >+ <span> >+ <span class="tdlabel">Expiration:</span> >+ [% RESERVE.expirationdate | $KohaDates %] >+ </span> >+ [% ELSE %] > <span class="tdlabel">Expiration:</span> >- [% RESERVE.expirationdate | $KohaDates %] >- </span> >+ Never expires >+ [% END %] > [% ELSE %] >- <span class="tdlabel">Expiration:</span> >- Never expires >+ - > [% END %] > </td> > <td class="branch"> > <span class="tdlabel">Pick up location:</span> >- [% RESERVE.branch %] >+ [% RESERVE.branch.branchname %] > </td> > [% IF ( showpriority ) %] > <td class="priority"> >@@ -563,11 +567,17 @@ > [% END %] > <td class="status"> > <span class="tdlabel">Status:</span> >- [% IF ( RESERVE.wait ) %] >- [% IF ( RESERVE.atdestination ) %] >+ [% IF ( RESERVE.is_waiting ) %] >+ [% IF ( RESERVE.is_at_destination ) %] > [% IF ( RESERVE.found ) %] >- Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %] >- <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" /> >+ Item waiting at <b> [% RESERVE.branch.branchname %]</b> >+ [% IF ( RESERVE.waitingdate ) %] >+ since [% RESERVE.waitingdate | $KohaDates %] >+ [% IF RESERVE.waiting_expires_on %] >+ until [% RESERVE.waiting_expires_on | $KohaDates %] >+ [% END %] >+ [% END %] >+ <input type="hidden" name="pickup" value="[% RESERVE.branchcode %]" /> > [% ELSE %] > Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b> > [% END %] >@@ -575,7 +585,7 @@ > Item in transit to <b> [% RESERVE.wbrname %]</b> <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" /> > [% END %] > [% ELSE %] >- [% IF ( RESERVE.intransit ) %] >+ [% IF ( RESERVE.is_in_transit ) %] > Item in transit from <b> [% RESERVE.frombranch %]</b> since > [% RESERVE.datesent | $KohaDates %] > [% ELSIF ( RESERVE.suspend ) %] >@@ -587,7 +597,7 @@ > </td> > [% IF SuspendHoldsOpac %] > <td> >- [% IF ( RESERVE.cancelable ) %] >+ [% IF ( RESERVE.is_cancelable ) %] > [% IF RESERVE.suspend %] > <form class="form-inline" action="/cgi-bin/koha/opac-modrequest-suspend.pl" method="post"> > <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" /> >@@ -628,11 +638,11 @@ > </form> > [% END # / IF AutoResumeSuspendedHolds %] > [% END # / IF RESERVE.suspend %] >- [% END # / IF ( RESERVE.cancelable )%] >+ [% END # / IF ( RESERVE.is_cancelable )%] > </td> > [% END # / IF SuspendHoldsOpac %] > <td class="modify"> >- [% IF ( RESERVE.cancelable ) %] >+ [% IF ( RESERVE.is_cancelable ) %] > <form action="/cgi-bin/koha/opac-modrequest.pl" method="post"> > <input type="hidden" name="biblionumber" value="[% RESERVE.biblionumber %]" /> > <input type="hidden" name="reserve_id" value="[% RESERVE.reserve_id %]" /> >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index d4fbbe3..37325a5 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -36,6 +36,7 @@ use C4::Letters; > use C4::Branch; # GetBranches > use Koha::DateUtils; > use Koha::Borrower::Debarments qw(IsDebarred); >+use Koha::Holds; > > use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; > >@@ -276,77 +277,14 @@ for my $branch_hash ( sort keys %{$branches} ) { > $template->param( branchloop => \@branch_loop ); > > # now the reserved items.... >-my @reserves = GetReservesFromBorrowernumber( $borrowernumber ); >-foreach my $res (@reserves) { >+my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } ); > >- if ( $res->{'expirationdate'} eq '0000-00-00' ) { >- $res->{'expirationdate'} = ''; >- } >- $res->{'subtitle'} = GetRecordValue('subtitle', GetMarcBiblio($res->{'biblionumber'}), GetFrameworkCode($res->{'biblionumber'})); >- $res->{'waiting'} = 1 if $res->{'found'} eq 'W'; >- $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'}; >- my $biblioData = GetBiblioData($res->{'biblionumber'}); >- $res->{'reserves_title'} = $biblioData->{'title'}; >- $res->{'author'} = $biblioData->{'author'}; >- >- if ($show_priority) { >- $res->{'priority'} ||= ''; >- } >- $res->{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref") if ( $res->{'suspend_until'} ); >-} >- >-# use Data::Dumper; >-# warn Dumper(@reserves); >- >-$template->param( RESERVES => \@reserves ); >-$template->param( reserves_count => $#reserves+1 ); >-$template->param( showpriority=>$show_priority ); >- >-my @waiting; >-my $wcount = 0; >-foreach my $res (@reserves) { >- if ( $res->{'itemnumber'} ) { >- my $item = GetItem( $res->{'itemnumber'}); >- $res->{'holdingbranch'} = >- $branches->{ $item->{'holdingbranch'} }->{'branchname'}; >- $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'}; >- $res->{'enumchron'} = $item->{'enumchron'} if $item->{'enumchron'}; >- # get document reserve status >- my $biblioData = GetBiblioData($res->{'biblionumber'}); >- $res->{'waiting_title'} = $biblioData->{'title'}; >- if ( ( $res->{'found'} eq 'W' ) ) { >- my $item = $res->{'itemnumber'}; >- $item = GetBiblioFromItemNumber($item,undef); >- $res->{'wait'}= 1; >- $res->{'holdingbranch'}=$item->{'holdingbranch'}; >- $res->{'biblionumber'}=$item->{'biblionumber'}; >- $res->{'barcode'} = $item->{'barcode'}; >- $res->{'wbrcode'} = $res->{'branchcode'}; >- $res->{'itemnumber'} = $res->{'itemnumber'}; >- $res->{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'}; >- if($res->{'holdingbranch'} eq $res->{'wbrcode'}){ >- $res->{'atdestination'} = 1; >- } >- # set found to 1 if reserve is waiting for patron pickup >- $res->{'found'} = 1 if $res->{'found'} eq 'W'; >- } else { >- my ($transfertwhen, $transfertfrom, $transfertto) = GetTransfers( $res->{'itemnumber'} ); >- if ($transfertwhen) { >- $res->{intransit} = 1; >- $res->{datesent} = $transfertwhen; >- $res->{frombranch} = GetBranchName($transfertfrom); >- } >- } >- push @waiting, $res; >- $wcount++; >- } >- # can be cancelled >- #$res->{'cancelable'} = 1 if ($res->{'wait'} && $res->{'atdestination'} && $res->{'found'} ne "1"); >- $res->{'cancelable'} = 1 if ($res->{wait} and not $res->{found}) or (not $res->{wait} and not $res->{intransit}); >- >-} >- >-$template->param( WAITING => \@waiting ); >+$template->param( >+ RESERVES => $reserves, >+ reserves_count => $reserves->count(), >+ showpriority => $show_priority, >+ WAITING => $reserves->waiting() >+); > > # current alert subscriptions > my $alerts = getalert($borrowernumber); >@@ -384,7 +322,6 @@ if ( $borr->{'opacnote'} ) { > > $template->param( > bor_messages_loop => GetMessages( $borrowernumber, 'B', 'NONE' ), >- waiting_count => $wcount, > patronupdate => $patronupdate, > OpacRenewalAllowed => C4::Context->preference("OpacRenewalAllowed"), > userview => 1, >diff --git a/svc/hold/resume b/svc/hold/resume >new file mode 100755 >index 0000000..03cd017 >--- /dev/null >+++ b/svc/hold/resume >@@ -0,0 +1,48 @@ >+#!/usr/bin/perl >+ >+# Copyright 2015 ByWater Solutions >+# >+# 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, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use CGI; >+use JSON qw(to_json); >+ >+use C4::Context; >+use C4::Auth qw(check_cookie_auth); >+use Koha::DateUtils qw(dt_from_string); >+use Koha::Holds; >+ >+my $input = new CGI; >+ >+my ( $auth_status, $sessionID ) = >+ check_cookie_auth( $input->cookie('CGISESSID'), >+ { circulate => 'circulate_remaining_permissions' } ); >+ >+if ( $auth_status ne "ok" ) { >+ exit 0; >+} >+ >+binmode STDOUT, ":encoding(UTF-8)"; >+print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); >+ >+my $reserve_id = $input->param('reserve_id'); >+ >+my $hold = Koha::Holds->find( $reserve_id ); >+$hold->resume(); >+ >+print to_json( { success => !$hold->suspend() } ); >diff --git a/svc/hold/suspend b/svc/hold/suspend >new file mode 100755 >index 0000000..880e41a >--- /dev/null >+++ b/svc/hold/suspend >@@ -0,0 +1,51 @@ >+#!/usr/bin/perl >+ >+# Copyright 2015 ByWater Solutions >+# >+# 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, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use CGI; >+use JSON qw(to_json); >+ >+use C4::Context; >+use C4::Auth qw(check_cookie_auth); >+use Koha::DateUtils qw(dt_from_string); >+use Koha::Holds; >+ >+my $input = new CGI; >+ >+my ( $auth_status, $sessionID ) = >+ check_cookie_auth( $input->cookie('CGISESSID'), >+ { circulate => 'circulate_remaining_permissions' } ); >+ >+if ( $auth_status ne "ok" ) { >+ exit 0; >+} >+ >+binmode STDOUT, ":encoding(UTF-8)"; >+print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); >+ >+my $reserve_id = $input->param('reserve_id'); >+ >+my $suspend_until = $input->param('suspend_until') || undef; >+$suspend_until = dt_from_string( $suspend_until ) if $suspend_until; >+ >+my $hold = Koha::Holds->find( $reserve_id ); >+$hold->suspend_hold( $suspend_until ); >+ >+print to_json( { success => $hold->suspend() } ); >-- >1.7.2.5
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 14310
:
39750
|
39751
|
39752
|
39753
|
39754
|
40024
|
40030
|
40031
|
40034
|
43525
|
43526
|
43830
|
43831
|
43832
|
43978
|
44203
|
44204
|
44205
|
44206
|
44207
|
46857
|
46858
|
46859
|
46860
|
46861
|
46862
|
46870
|
46871
|
46872
|
46873
|
46874
|
46875
|
46876