Bugzilla – Attachment 7550 Details for
Bug 6039
Cancel all waiting holds button
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
0001-bug-6039-Cancel-All-waiting-holds-button.patch (text/plain), 13.01 KB, created by
Srdjan Jankovic
on 2012-02-10 01:07:11 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2012-02-10 01:07:11 UTC
Size:
13.01 KB
patch
obsolete
>From 2ee7b31f81fcce89e82f0b5a94288f131f742589 Mon Sep 17 00:00:00 2001 >From: Srdjan Jankovic <srdjan@catalyst.net.nz> >Date: Fri, 10 Feb 2012 14:02:03 +1300 >Subject: [PATCH] bug 6039: Cancel All waiting holds button > >TransferWhenCancelAllWaitingHolds syspref >--- > circ/waitingreserves.pl | 102 +++++++++++++------- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 8 ++ > .../en/modules/admin/preferences/circulation.pref | 6 + > .../prog/en/modules/circ/waitingreserves.tt | 20 +++- > 5 files changed, 100 insertions(+), 37 deletions(-) > >diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl >index 128d1eb..17b7be6 100755 >--- a/circ/waitingreserves.pl >+++ b/circ/waitingreserves.pl >@@ -46,6 +46,7 @@ my $borrowernumber = $input->param('borrowernumber'); > my $fbr = $input->param('fbr') || ''; > my $tbr = $input->param('tbr') || ''; > my $all_branches = $input->param('allbranches') || ''; >+my $cancelall = $input->param('cancelall'); > > my $cancel; > >@@ -62,42 +63,23 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > > my $default = C4::Context->userenv->{'branch'}; > >+my $transfer_when_cancel_all = C4::Context->preference('TransferWhenCancelAllWaitingHolds'); >+$template->param( TransferWhenCancelAllWaitingHolds => 1 ) if $transfer_when_cancel_all; >+ >+my @cancel_result; > # if we have a return from the form we launch the subroutine CancelReserve > if ($item) { >- my ( $messages, $nextreservinfo ) = ModReserveCancelAll( $item, $borrowernumber ); >- # if we have a result >- if ($nextreservinfo) { >- my $borrowerinfo = GetMemberDetails( $nextreservinfo ); >- my $iteminfo = GetBiblioFromItemNumber($item); >- if ( $messages->{'transfert'} ) { >- $template->param( >- messagetransfert => $messages->{'transfert'}, >- branchname => GetBranchName($messages->{'transfert'}), >- ); >- } >- >- $template->param( >- message => 1, >- nextreservnumber => $nextreservinfo, >- nextreservsurname => $borrowerinfo->{'surname'}, >- nextreservfirstname => $borrowerinfo->{'firstname'}, >- nextreservitem => $item, >- nextreservtitle => $iteminfo->{'title'}, >- waiting => ($messages->{'waiting'}) ? 1 : 0, >- ); >- } >- >-# if the document is not in his homebranch location and there is not reservation after, we transfer it >- if ($fbr ne $tbr and not $nextreservinfo) { >- ModItemTransfer( $item, $fbr, $tbr ); >- } >+ my $res = cancel( $item, $borrowernumber, $fbr, $tbr ); >+ push @cancel_result, $res if $res; > } >+ > if ( C4::Context->preference('IndependantBranches') ) { > undef $all_branches; > } else { >- $template->param( all_branches_link => $input->url . '?allbranches=1&' . $input->query_string ) >+ $template->param( all_branches_link => $input->url . '?allbranches=1' ) > unless $all_branches; > } >+$template->param( all_branches => 1 ) if $all_branches; > > my (@reservloop, @overloop); > my ($reservcount, $overcount); >@@ -107,8 +89,24 @@ my @getreserves = $all_branches ? GetReservesForBranch() : GetReservesForBranch( > my $today = Date_to_Days(&Today); > foreach my $num (@getreserves) { > next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00'); >- my %getreserv; >- my $gettitle = GetBiblioFromItemNumber( $num->{'itemnumber'} ); >+ >+ my $itemnumber = $num->{'itemnumber'}; >+ my $gettitle = GetBiblioFromItemNumber( $itemnumber ); >+ my $borrowernum = $num->{'borrowernumber'}; >+ my $holdingbranch = $gettitle->{'holdingbranch'}; >+ my $homebranch = $gettitle->{'homebranch'}; >+ >+ if ($cancelall) { >+ my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all ); >+ push @cancel_result, $res if $res; >+ next; >+ } >+ >+ my %getreserv = ( >+ itemnumber => $itemnumber, >+ borrowernum => $borrowernum, >+ ); >+ > # fix up item type for display > $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'}; > my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'}); >@@ -122,17 +120,15 @@ foreach my $num (@getreserves) { > > $getreserv{'itemtype'} = $itemtypeinfo->{'description'}; > $getreserv{'title'} = $gettitle->{'title'}; >- $getreserv{'itemnumber'} = $gettitle->{'itemnumber'}; > $getreserv{'biblionumber'} = $gettitle->{'biblionumber'}; > $getreserv{'barcode'} = $gettitle->{'barcode'}; > $getreserv{'branchname'} = GetBranchName($gettitle->{'homebranch'}); > $getreserv{'homebranch'} = $gettitle->{'homebranch'}; > $getreserv{'holdingbranch'} = $gettitle->{'holdingbranch'}; > $getreserv{'itemcallnumber'} = $gettitle->{'itemcallnumber'}; >- if ( $gettitle->{'homebranch'} ne $gettitle->{'holdingbranch'} ) { >+ if ( $homebranch ne $holdingbranch ) { > $getreserv{'dotransfer'} = 1; > } >- $getreserv{'borrowernum'} = $getborrower->{'borrowernumber'}; > $getreserv{'borrowername'} = $getborrower->{'surname'}; > $getreserv{'borrowerfirstname'} = $getborrower->{'firstname'}; > $getreserv{'borrowerphone'} = $getborrower->{'phone'}; >@@ -150,6 +146,7 @@ foreach my $num (@getreserves) { > > } > >+$template->param(cancel_result => \@cancel_result) if @cancel_result; > $template->param( > reserveloop => \@reservloop, > reservecount => $reservcount, >@@ -161,3 +158,42 @@ $template->param( > ); > > output_html_with_http_headers $input, $cookie, $template->output; >+ >+exit; >+ >+sub cancel { >+ my ($item, $borrowernumber, $fbr, $tbr, $skip_transfers ) = @_; >+ >+ my $transfer = $fbr ne $tbr; # XXX && !$nextreservinfo; >+ >+ return if $transfer && $skip_transfers; >+ >+ my ( $messages, $nextreservinfo ) = ModReserveCancelAll( $item, $borrowernumber ); >+ >+# if the document is not in his homebranch location and there is not reservation after, we transfer it >+ if ($transfer && !$nextreservinfo) { >+ ModItemTransfer( $item, $fbr, $tbr ); >+ } >+ # if we have a result >+ if ($nextreservinfo) { >+ my %res; >+ my $borrowerinfo = GetMemberDetails( $nextreservinfo ); >+ my $iteminfo = GetBiblioFromItemNumber($item); >+ if ( $messages->{'transfert'} ) { >+ $res{messagetransfert} = $messages->{'transfert'}; >+ $res{branchname} = GetBranchName($messages->{'transfert'}); >+ } >+ >+ $res{message} = 1; >+ $res{nextreservnumber} = $nextreservinfo; >+ $res{nextreservsurname} = $borrowerinfo->{'surname'}; >+ $res{nextreservfirstname} = $borrowerinfo->{'firstname'}; >+ $res{nextreservitem} = $item; >+ $res{nextreservtitle} = $iteminfo->{'title'}; >+ $res{waiting} = $messages->{'waiting'} ? 1 : 0; >+ >+ return \%res; >+ } >+ >+ return; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 5e3d79d..d9e04d5 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -330,6 +330,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo'); >+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('TransferWhenCancelAllWaitingHolds','0','Transfer items when cancelling all waiting holds',NULL,'YesNo'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OPACLocalCoverImages','0','Display local cover images on OPAC search and details pages.','1','YesNo'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('LocalCoverImages','0','Display local cover images on intranet details pages.','1','YesNo'); > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('AllowMultipleCovers','0','Allow multiple cover images to be attached to each bibliographic record.','1','YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 099dfb9..ef81848 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4663,6 +4663,14 @@ ENDOFRENEWAL > print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n"; > SetVersion($DBversion); > } >+ >+$DBversion = "3.07.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('TransferWhenCancelAllWaitingHolds','0','Transfer items when cancelling all waiting holds',NULL,'YesNo')"); >+ print "Upgrade to $DBversion done (Add sysprefs to control transfer when cancel all waiting holds)\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 30bcb9b..7d7d682 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -317,6 +317,12 @@ Circulation: > yes: Enable > no: "Don't enable" > - "the ability to place holds on multiple biblio from the search results" >+ - >+ - pref: TransferWhenCancelAllWaitingHolds >+ choices: >+ yes: Transfer >+ no: "Don't transfer" >+ - items when cancelling all waiting holds. > Fines Policy: > - > - Calculate fines based on days overdue >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >index 7ecc3a1..c141ae7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >@@ -44,7 +44,8 @@ $.tablesorter.addParser({ > View all branches</a></span> > [% END %] > </h2> >- [% IF ( messagetransfert ) %] >+ [% IF ( cancel_result ) %] >+ [% IF ( cancel_result.messagetransfert ) %] > <div> > <h2>Hold find for ([% nextreservtitle %]), must be transferred</h2> > <p>This hold placed by : <b> [% nextreservsurname %] [% nextreservfirstname %]</b> at the library : <b> [% branchname %] </b>, Please transfer this hold. >@@ -54,7 +55,7 @@ $.tablesorter.addParser({ > </form> > </div> > [% END %] >- [% IF ( waiting ) %] >+ [% IF ( cancel_result.waiting ) %] > <div id="bloc25"> > <h2>This hold is waiting</h2> > <p>This hold ([% nextreservtitle %]) was placed by <b> : [% nextreservsurname %] [% nextreservfirstname %]</b>, >@@ -65,7 +66,7 @@ $.tablesorter.addParser({ > </form> > </div> > [% END %] >- [% UNLESS ( message ) %] >+ [% ELSE %] > <div id="resultlist" class="toptabs"> > <ul> > <li><a href="/cgi-bin/koha/circ/waitingreserves.pl#holdswaiting">[% reservecount %] Hold(s) waiting</a></li> >@@ -117,7 +118,18 @@ $.tablesorter.addParser({ > </div> > <div id="holdsover"> > <p>Holds listed here have been awaiting pickup for more than [% ReservesMaxPickUpDelay %] days.</p> >- [% IF ( overloop ) %] >+ [% IF ( overloop ) %] >+ <p> >+ <form name="cancelAllReserve" action="waitingreserves.pl" method="post"> >+ <input type="hidden" name="cancelall" value="1" /> >+ <input type="hidden" name="allbranches" value="[% allbranches %]" /> >+ <input type="submit" value="Cancel [% IF TransferWhenCancelAllWaitingHolds %]and Transfer [% END %]All" /> >+ </form> >+ [% UNLESS TransferWhenCancelAllWaitingHolds %] >+ Only items that need not be transferred will be cancelled (TransferWhenCancelAllWaitingHolds sypref) >+ [% END %] >+ </p> >+ <br/> > <table id="holdso"> > <thead><tr> > <th>Available since</th> >-- >1.6.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 6039
:
3608
|
7282
|
7550
|
7778
|
7779
|
7781