Bugzilla – Attachment 9183 Details for
Bug 7641
Add ability to suspend reserves.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7641 - Followup - Suspend Until not set on by suspend button.
Bug-7641---Followup---Suspend-Until-not-set-on-by-.patch (text/plain), 6.96 KB, created by
Liz Rea
on 2012-04-13 16:31:31 UTC
(
hide
)
Description:
Bug 7641 - Followup - Suspend Until not set on by suspend button.
Filename:
MIME Type:
Creator:
Liz Rea
Created:
2012-04-13 16:31:31 UTC
Size:
6.96 KB
patch
obsolete
>From 7eca0c431db827f861b30a1f6c950e29912d1250 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 13 Apr 2012 10:11:00 -0400 >Subject: [PATCH] Bug 7641 - Followup - Suspend Until not set on by suspend button. >Content-Type: text/plain; charset="utf-8" > >For request.pl, there are two ways to suspend a reserve, either >by using the 'suspend' button for an individual reserve, or by >using the 'Update hold(s)' button with suspend until dates set. > >If the 'suspend' button is used, any date in the 'suspend until' >field is ignored. This commit fixes this issue. > > * Add suspend_until date to suspend button link via jquery > * Add optional date to ToggleSuspend() > * Add KohaDates plugin where necessary > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> >passes tests, tested: >* suspend all holds from circ.pl >* suspend one hold from circ.pl >* suspend all holds from moremember.pl >* suspend one hold from moremember.pl > --- NOTE: clicking suspend all holds without setting a date will mean the holds must be manually unsuspended. I'm not sure this is intentional? >* suspend a specific hold using the in-table button on reserves >* suspend a specific hold using the "update hold" button > >500 error is gone. >--- > C4/Reserves.pm | 20 ++++++++++++++------ > .../prog/en/modules/circ/circulation.tt | 1 + > .../prog/en/modules/members/moremember.tt | 1 + > .../prog/en/modules/reserve/request.tt | 5 +++-- > reserve/request.pl | 5 +++-- > 5 files changed, 22 insertions(+), 10 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 930d524..33644a1 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -1054,6 +1054,7 @@ itemnumber and supplying itemnumber. > sub ModReserve { > #subroutine to update a reserve > my ( $rank, $biblio, $borrower, $branch , $itemnumber, $suspend_until) = @_; >+ warn "ModReserve( $rank, $biblio, $borrower, $branch , $itemnumber, $suspend_until)"; > return if $rank eq "W"; > return if $rank eq "n"; > my $dbh = C4::Context->dbh; >@@ -1517,20 +1518,27 @@ be cleared when it is unsuspended. > =cut > > sub ToggleSuspend { >- my ( $borrowernumber, $biblionumber ) = @_; >+ my ( $borrowernumber, $biblionumber, $suspend_until ) = @_; >+ >+ $suspend_until = C4::Dates->new( $suspend_until )->output('iso') if ( $suspend_until ); >+ >+ my $do_until = ( $suspend_until ) ? '?' : 'NULL'; > > my $dbh = C4::Context->dbh; > > my $sth = $dbh->prepare( > "UPDATE reserves SET suspend = NOT suspend, >- suspend_until = CASE WHEN suspend = 0 THEN NULL ELSE suspend_until END >+ suspend_until = CASE WHEN suspend = 0 THEN NULL ELSE $do_until END > WHERE biblionumber = ? > AND borrowernumber = ? > "); >- $sth->execute( >- $biblionumber, >- $borrowernumber, >- ); >+ >+ my @params; >+ push( @params, $suspend_until ) if ( $suspend_until ); >+ push( @params, $biblionumber ); >+ push( @params, $borrowernumber ); >+ >+ $sth->execute( @params ); > $sth->finish; > } > >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 e79cef1..b41184e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -1,3 +1,4 @@ >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Circulation [% IF ( borrowernumber ) %] › Checking out to [% INCLUDE 'patron-title.inc' %] [% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] >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 27c7a2f..202c9d3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -1,3 +1,4 @@ >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Patrons › > [% IF ( unknowuser ) %] >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 0d16ce0..effeb7a 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 KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > [% UNLESS ( multi_hold ) %] > <title>Koha › Circulation › Holds › Place a hold on [% title |html %]</title> >@@ -731,11 +732,11 @@ function checkMultiHold() { > > <td> > [% UNLESS ( reserveloo.wait ) %] >- <input type="button" value="[% IF ( reserveloo.suspend ) %]Unsuspend[% ELSE %]Suspend[% END %]" onclick="window.location.href='request.pl?action=toggleSuspend&borrowernumber=[% reserveloo.borrowernumber %]&biblionumber=[% reserveloo.biblionumber %]&date=[% reserveloo.date %]'" /> >+ <input type="button" value="[% IF ( reserveloo.suspend ) %]Unsuspend[% ELSE %]Suspend[% END %]" onclick="window.location.href='request.pl?action=toggleSuspend&borrowernumber=[% reserveloo.borrowernumber %]&biblionumber=[% reserveloo.biblionumber %]&date=[% reserveloo.date %]&suspend_until=' + $('#suspend_until_[% reserveloo.borrowernumber %]').val()" /> > > [% IF AutoResumeSuspendedHolds %] > <label for="suspend_until_[% reserveloo.borrowernumber %]">[% IF ( reserveloo.suspend ) %] on [% ELSE %] until [% END %]</label> >- <input name="suspend_until" id="suspend_until_[% reserveloo.borrowernumber %]" size="10" readonly="readonly" value="[% reserveloo.suspend_until %]" /> >+ <input name="suspend_until" id="suspend_until_[% reserveloo.borrowernumber %]" size="10" readonly="readonly" value="[% reserveloo.suspend_until | $KohaDates %]" /> > <img src="[% themelang %]/lib/calendar/cal.gif" alt="Show calendar" border="0" id="SuspendUntilDate_[% reserveloo.borrowernumber %]" style="cursor: pointer;" /> > <script language="JavaScript" type="text/javascript"> > //<![CDATA[ >diff --git a/reserve/request.pl b/reserve/request.pl >index ff01850..d9e5904 100755 >--- a/reserve/request.pl >+++ b/reserve/request.pl >@@ -113,7 +113,8 @@ if ( $action eq 'move' ) { > } elsif ( $action eq 'toggleSuspend' ) { > my $borrowernumber = $input->param('borrowernumber'); > my $biblionumber = $input->param('biblionumber'); >- ToggleSuspend( $borrowernumber, $biblionumber ); >+ my $suspend_until = $input->param('suspend_until'); >+ ToggleSuspend( $borrowernumber, $biblionumber, $suspend_until ); > } > > if ($findborrower) { >@@ -573,7 +574,7 @@ foreach my $biblionumber (@biblionumbers) { > $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'}); > $reserve{'optionloop'} = \@optionloop; > $reserve{'suspend'} = $res->{'suspend'}; >- $reserve{'suspend_until'} = C4::Dates->new( $res->{'suspend_until'}, "iso")->output("syspref"); >+ $reserve{'suspend_until'} = $res->{'suspend_until'}; > push( @reserveloop, \%reserve ); > } > >-- >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 7641
:
7991
|
7992
|
8695
|
8697
|
8698
|
8795
|
8881
|
9178
|
9183
|
9225
|
9440
|
9444