Bugzilla – Attachment 19180 Details for
Bug 8367
How long is a hold waiting for pickup at a more granular level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 8367: Add more granular level for ReservesMaxPickUpDelay
Bug-8367-Add-more-granular-level-for-ReservesMaxPi.patch (text/plain), 38.28 KB, created by
Kyle M Hall (khall)
on 2013-06-21 12:49:10 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 8367: Add more granular level for ReservesMaxPickUpDelay
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-06-21 12:49:10 UTC
Size:
38.28 KB
patch
obsolete
>From 68943861814471cd6ef8a9c405afc2801f2fa3ca Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Mon, 10 Sep 2012 17:06:00 +0200 >Subject: [PATCH] Bug 8367: Add more granular level for ReservesMaxPickUpDelay > >This patch adds: >- a new column in the issuing rules >- a new column reserves.maxpickupdate (+old_reserves) >It contains the waitingdate + the corresponding max pickup delay. >Each time the waitingdate is modified, this value will be modified too. >- a new field issuingrules.holdspickupdelay > >This patch removes the ReservesMaxPickUpDelay syspref. >The update database script will update the issuingrules table with the >correct value before removing it. > >You can now specify a pickup delay for an hold function of a patron >category and/or a item type and/or a library. > >To test: >Check there is no regression with a normal reserve workflow. >Add one or more issuingrules. >Update the new column 'Holds pickup delay' in your issuing rules. >In 4 templates, you can see the max pickup delay for an hold >(circ/circulation.tt, circ/waitingreserves.tt, members/moremember.tt, >opac-user.tt). >According to a library and an item type, the maxpickupdate value will be >equal to the waiting date + the pickup delay defined. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Letters.pm | 3 +- > C4/Reserves.pm | 137 +++++++++++++++++--- > admin/smart-rules.pl | 13 +- > circ/circulation.pl | 3 + > circ/waitingreserves.pl | 56 ++++----- > installer/data/mysql/kohastructure.sql | 3 + > installer/data/mysql/updatedatabase.pl | 28 ++++ > .../en/modules/admin/preferences/circulation.pref | 7 +- > .../prog/en/modules/admin/smart-rules.tt | 6 +- > .../prog/en/modules/circ/circulation.tt | 4 +- > .../prog/en/modules/circ/waitingreserves.tt | 11 +- > .../prog/en/modules/help/circ/waitingreserves.tt | 4 +- > .../prog/en/modules/members/moremember.tt | 2 +- > koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt | 2 +- > members/moremember.pl | 1 + > .../thirdparty/TalkingTech_itiva_outbound.pl | 5 +- > opac/opac-user.pl | 6 +- > 17 files changed, 212 insertions(+), 79 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 0349efe..28bdeb0 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -610,8 +610,7 @@ sub _parseletter { > if ( $table eq 'reserves' && $values->{'waitingdate'} ) { > my @waitingdate = split /-/, $values->{'waitingdate'}; > >- my $dt = dt_from_string(); >- $dt->add( days => C4::Context->preference('ReservesMaxPickUpDelay') ); >+ my $dt = dt_from_string($values->{maxpickupdate}); > $values->{'expirationdate'} = output_pref( $dt, undef, 1 ); > > $values->{'waitingdate'} = output_pref( dt_from_string( $values->{'waitingdate'} ), undef, 1 ); >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 5ff12e4..c209f10 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -23,6 +23,7 @@ package C4::Reserves; > > use strict; > #use warnings; FIXME - Bug 2505 >+use Date::Calc qw( Add_Delta_Days ); > use C4::Context; > use C4::Biblio; > use C4::Members; >@@ -116,7 +117,7 @@ BEGIN { > > &CheckReserves > &CanBookBeReserved >- &CanItemBeReserved >+ &CanItemBeReserved > &CancelReserve > &CancelExpiredReserves > >@@ -130,6 +131,7 @@ BEGIN { > &ReserveSlip > &ToggleSuspend > &SuspendAll >+ &GetReservesControlBranch > ); > @EXPORT_OK = qw( MergeHolds ); > } >@@ -169,35 +171,38 @@ sub AddReserve { > $waitingdate = $resdate; > } > >+ my $item = C4::Items::GetItem( $checkitem ); >+ my $maxpickupdate = GetMaxPickupDate( undef, $item ); >+ > #eval { > # updates take place here > if ( $fee > 0 ) { > my $nextacctno = &getnextacctno( $borrowernumber ); >- my $query = qq/ >+ my $query = q{ > INSERT INTO accountlines > (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding) > VALUES > (?,?,now(),?,?,'Res',?) >- /; >+ }; > my $usth = $dbh->prepare($query); > $usth->execute( $borrowernumber, $nextacctno, $fee, > "Reserve Charge - $title", $fee ); > } > > #if ($const eq 'a'){ >- my $query = qq/ >+ my $query = q{ > INSERT INTO reserves > (borrowernumber,biblionumber,reservedate,branchcode,constrainttype, >- priority,reservenotes,itemnumber,found,waitingdate,expirationdate) >+ priority,reservenotes,itemnumber,found,waitingdate,expirationdate,maxpickupdate) > VALUES > (?,?,?,?,?, >- ?,?,?,?,?,?) >- /; >+ ?,?,?,?,?,?,?) >+ }; > my $sth = $dbh->prepare($query); > $sth->execute( > $borrowernumber, $biblionumber, $resdate, $branch, > $const, $priority, $notes, $checkitem, >- $found, $waitingdate, $expdate >+ $found, $waitingdate, $expdate, $maxpickupdate > ); > > # Send e-mail to librarian if syspref is active >@@ -497,6 +502,76 @@ sub CanItemBeReserved{ > return 0; > } > } >+ >+=head2 GetMaxPickupDate >+ >+$maxpickupdate = &GetMaxPickupDate($reserve [, $item]); >+$reserve->{waitingdate} is a string or a DateTime. >+ >+this function returns the max pickup date (DateTime format). >+(e.g. : the date after which the hold will be considered cancelled) >+ >+=cut >+ >+sub GetMaxPickupDate { >+ my ( $reserve, $item ) = @_; >+ >+ if ( not defined $reserve and not defined $item->{itemnumber} ) { >+ warn "ERROR: GetMaxPickupDate is called without reserve and without itemnumber"; >+ return; >+ } >+ >+ if ( defined $reserve and not defined $item ) { >+ $item = C4::Items::GetItem( $reserve->{itemnumber} ); >+ } >+ >+ unless ( defined $reserve ) { >+ my $reserve = GetReservesFromItemnumber( $item->{itemnumber} ); >+ } >+ return unless $reserve->{waitingdate}; >+ >+ my $borrower = C4::Members::GetMember( 'borrowernumber' => $reserve->{borrowernumber} ); >+ >+ my $controlbranch = GetReservesControlBranch( $borrower, $item ); >+ >+ my $issuingrule = C4::Circulation::GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $controlbranch ); >+ >+ my $date = ref $reserve->{waitingdate} eq 'DateTime' >+ ? $reserve->{waitingdate} >+ : dt_from_string $reserve->{waitingdate}; >+ >+ my $holdspickupdelay = 0; >+ if ( defined($issuingrule) >+ and defined $issuingrule->{holdspickupdelay} ) { >+ $holdspickupdelay = $issuingrule->{holdspickupdelay} >+ } >+ >+ $date->add( days => $holdspickupdelay ); >+ >+ return $date; >+} >+ >+=head2 GetReservesControlBranch >+ >+$branchcode = &GetReservesControlBranch($borrower, $item) >+ >+Returns the branchcode to consider to check hold rules against >+ >+=cut >+ >+sub GetReservesControlBranch { >+ my ( $borrower, $item ) = @_; >+ my $controlbranch = C4::Context->preference('ReservesControlBranch'); >+ my $hbr = C4::Context->preference('HomeOrHoldingBranch') || "homebranch"; >+ my $branchcode = "*"; >+ if ( $controlbranch eq "ItemHomeLibrary" ) { >+ $branchcode = $item->{$hbr}; >+ } elsif ( $controlbranch eq "PatronLibrary" ) { >+ $branchcode = $borrower->{branchcode}; >+ } >+ return $branchcode; >+} >+ > #-------------------------------------------------------------------------------- > =head2 GetReserveCount > >@@ -711,7 +786,7 @@ sub GetReservesToBranch { > sub GetReservesForBranch { > my ($frombranch) = @_; > my $dbh = C4::Context->dbh; >- my $query = "SELECT borrowernumber,reservedate,itemnumber,waitingdate >+ my $query = "SELECT borrowernumber,reservedate,itemnumber,waitingdate,maxpickupdate > FROM reserves > WHERE priority='0' > AND found='W' "; >@@ -906,15 +981,14 @@ sub CancelExpiredReserves { > while ( my $res = $sth->fetchrow_hashref() ) { > CancelReserve( $res->{'biblionumber'}, '', $res->{'borrowernumber'} ); > } >- >+ > # Cancel reserves that have been waiting too long > if ( C4::Context->preference("ExpireReservesMaxPickUpDelay") ) { >- my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); > my $charge = C4::Context->preference("ExpireReservesMaxPickUpDelayCharge"); > >- my $query = "SELECT * FROM reserves WHERE TO_DAYS( NOW() ) - TO_DAYS( waitingdate ) > ? AND found = 'W' AND priority = 0"; >+ my $query = "SELECT * FROM reserves WHERE NOW() > maxpickupdate AND found = 'W' AND priority = 0"; > $sth = $dbh->prepare( $query ); >- $sth->execute( $max_pickup_delay ); >+ $sth->execute(); > > while (my $res = $sth->fetchrow_hashref ) { > if ( $charge ) { >@@ -1221,9 +1295,28 @@ sub ModReserveStatus { > my ($itemnumber, $newstatus) = @_; > my $dbh = C4::Context->dbh; > >- my $query = "UPDATE reserves SET found = ?, waitingdate = NOW() WHERE itemnumber = ? AND found IS NULL AND priority = 0"; >+ my $now = dt_from_string; >+ my $reserve = $dbh->selectrow_hashref(q{ >+ SELECT * >+ FROM reserves >+ WHERE itemnumber = ? >+ AND found IS NULL >+ AND priority = 0 >+ }, {}, $itemnumber); >+ return unless $reserve; >+ >+ my $maxpickupdate = GetMaxPickupDate( $reserve ); >+ my $query = q{ >+ UPDATE reserves >+ SET found = ?, >+ waitingdate = ?, >+ maxpickupdate = ? >+ WHERE itemnumber = ? >+ AND found IS NULL >+ AND priority = 0 >+ }; > my $sth_set = $dbh->prepare($query); >- $sth_set->execute( $newstatus, $itemnumber ); >+ $sth_set->execute( $newstatus, $now, $maxpickupdate, $itemnumber ); > > if ( C4::Context->preference("ReturnToShelvingCart") && $newstatus ) { > CartToShelf( $itemnumber ); >@@ -1271,21 +1364,26 @@ sub ModReserveAffect { > WHERE borrowernumber = ? > AND biblionumber = ? > "; >+ $sth = $dbh->prepare($query); >+ $sth->execute( $itemnumber, $borrowernumber,$biblionumber); > } > else { > # affect the reserve to Waiting as well. >+ my $item = C4::Items::GetItem( $itemnumber ); >+ my $maxpickupdate = GetMaxPickupDate( undef, $item ); > $query = " > UPDATE reserves > SET priority = 0, > found = 'W', > waitingdate = NOW(), >+ maxpickupdate = ?, > itemnumber = ? > WHERE borrowernumber = ? > AND biblionumber = ? > "; >+ $sth = $dbh->prepare($query); >+ $sth->execute( $maxpickupdate, $itemnumber, $borrowernumber,$biblionumber); > } >- $sth = $dbh->prepare($query); >- $sth->execute( $itemnumber, $borrowernumber,$biblionumber); > _koha_notify_reserve( $itemnumber, $borrowernumber, $biblionumber ) if ( !$transferToDo && !$already_on_shelf ); > > if ( C4::Context->preference("ReturnToShelvingCart") ) { >@@ -1361,6 +1459,7 @@ sub GetReserveInfo { > reserves.biblionumber, > reserves.branchcode, > reserves.waitingdate, >+ reserves.maxpickupdate, > notificationdate, > reminderdate, > priority, >@@ -1815,6 +1914,7 @@ sub _Findgroupreserve { > reserves.borrowernumber AS borrowernumber, > reserves.reservedate AS reservedate, > reserves.waitingdate AS waitingdate, >+ reserves.maxpickupdate AS maxpickupdate, > reserves.branchcode AS branchcode, > reserves.cancellationdate AS cancellationdate, > reserves.found AS found, >@@ -2130,7 +2230,8 @@ sub RevertWaitingStatus { > SET > priority = 1, > found = NULL, >- waitingdate = NULL >+ waitingdate = NULL, >+ maxpickupdate = NULL, > WHERE > reserve_id = ? > "; >diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl >index 5d4166d..6f5145b 100755 >--- a/admin/smart-rules.pl >+++ b/admin/smart-rules.pl >@@ -101,9 +101,9 @@ elsif ($op eq 'delete-branch-item') { > # save the values entered > elsif ($op eq 'add') { > my $sth_search = $dbh->prepare('SELECT COUNT(*) AS total FROM issuingrules WHERE branchcode=? AND categorycode=? AND itemtype=?'); >- my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, renewalperiod, reservesallowed, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); >- my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, reservesallowed=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); >- >+ my $sth_insert = $dbh->prepare('INSERT INTO issuingrules (branchcode, categorycode, itemtype, maxissueqty, renewalsallowed, renewalperiod, reservesallowed, holdspickupdelay, issuelength, lengthunit, hardduedate, hardduedatecompare, fine, finedays, firstremind, chargeperiod,rentaldiscount, overduefinescap) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)'); >+ my $sth_update=$dbh->prepare("UPDATE issuingrules SET fine=?, finedays=?, firstremind=?, chargeperiod=?, maxissueqty=?, renewalsallowed=?, renewalperiod=?, reservesallowed=?, holdspickupdelay=?, issuelength=?, lengthunit = ?, hardduedate=?, hardduedatecompare=?, rentaldiscount=?, overduefinescap=? WHERE branchcode=? AND categorycode=? AND itemtype=?"); >+ > my $br = $branch; # branch > my $bor = $input->param('categorycode'); # borrower category > my $cat = $input->param('itemtype'); # item type >@@ -115,6 +115,7 @@ elsif ($op eq 'add') { > my $renewalsallowed = $input->param('renewalsallowed'); > my $renewalperiod = $input->param('renewalperiod'); > my $reservesallowed = $input->param('reservesallowed'); >+ my $holdspickupdelay = $input->param('holdspickupdelay'); > $maxissueqty =~ s/\s//g; > $maxissueqty = undef if $maxissueqty !~ /^\d+/; > my $issuelength = $input->param('issuelength'); >@@ -129,11 +130,11 @@ elsif ($op eq 'add') { > $sth_search->execute($br,$bor,$cat); > my $res = $sth_search->fetchrow_hashref(); > if ($res->{total}) { >- $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $reservesallowed, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat); >+ $sth_update->execute($fine, $finedays,$firstremind, $chargeperiod, $maxissueqty, $renewalsallowed, $renewalperiod, $reservesallowed, $holdspickupdelay, $issuelength,$lengthunit, $hardduedate,$hardduedatecompare,$rentaldiscount,$overduefinescap, $br,$bor,$cat); > } else { >- $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $reservesallowed,$issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap); >+ $sth_insert->execute($br,$bor,$cat,$maxissueqty,$renewalsallowed, $renewalperiod, $reservesallowed, $holdspickupdelay, $issuelength,$lengthunit,$hardduedate,$hardduedatecompare,$fine,$finedays,$firstremind,$chargeperiod,$rentaldiscount,$overduefinescap); > } >-} >+} > elsif ($op eq "set-branch-defaults") { > my $categorycode = $input->param('categorycode'); > my $maxissueqty = $input->param('maxissueqty'); >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 52823f4..de656dc 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -373,6 +373,9 @@ if ($borrowernumber) { > if ( $num_res->{'found'} && $num_res->{'found'} eq 'W' ) { > $getreserv{color} = 'reserved'; > $getreserv{waiting} = 1; >+ $getWaitingReserveInfo{maxpickupdate} = $num_res->{maxpickupdate}; >+ $getreserv{maxpickupdate} = $num_res->{maxpickupdate}; >+ > # genarate information displaying only waiting reserves > $getWaitingReserveInfo{title} = $getiteminfo->{'title'}; > $getWaitingReserveInfo{biblionumber} = $getiteminfo->{'biblionumber'}; >diff --git a/circ/waitingreserves.pl b/circ/waitingreserves.pl >index 1ec6b2d..cb4d7b3 100755 >--- a/circ/waitingreserves.pl >+++ b/circ/waitingreserves.pl >@@ -21,23 +21,20 @@ > use strict; > use warnings; > use CGI; >+use DateTime; > use C4::Context; > use C4::Output; > use C4::Branch; # GetBranchName > use C4::Auth; > use C4::Dates qw/format_date/; > use C4::Circulation; >+use C4::Reserves; > use C4::Members; > use C4::Biblio; > use C4::Items; >- >-use Date::Calc qw( >- Today >- Add_Delta_Days >- Date_to_Days >-); > use C4::Reserves; > use C4::Koha; >+use Koha::DateUtils; > > my $input = new CGI; > >@@ -86,31 +83,44 @@ my ($reservcount, $overcount); > my @getreserves = $all_branches ? GetReservesForBranch() : GetReservesForBranch($default); > # get reserves for the branch we are logged into, or for all branches > >-my $today = Date_to_Days(&Today); >+my $today = dt_from_string; > foreach my $num (@getreserves) { > next unless ($num->{'waitingdate'} && $num->{'waitingdate'} ne '0000-00-00'); > > my $itemnumber = $num->{'itemnumber'}; > my $gettitle = GetBiblioFromItemNumber( $itemnumber ); >- my $borrowernum = $num->{'borrowernumber'}; >+ my $borrowernumber = $num->{'borrowernumber'}; > my $holdingbranch = $gettitle->{'holdingbranch'}; > my $homebranch = $gettitle->{'homebranch'}; > > my %getreserv = ( > itemnumber => $itemnumber, >- borrowernum => $borrowernum, >+ borrowernum => $borrowernumber, > ); > > # fix up item type for display > $gettitle->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $gettitle->{'itype'} : $gettitle->{'itemtype'}; > my $getborrower = GetMember(borrowernumber => $num->{'borrowernumber'}); > my $itemtypeinfo = getitemtypeinfo( $gettitle->{'itemtype'} ); # using the fixed up itype/itemtype >- $getreserv{'waitingdate'} = format_date( $num->{'waitingdate'} ); >- my ( $waiting_year, $waiting_month, $waiting_day ) = split (/-/, $num->{'waitingdate'}); >- ( $waiting_year, $waiting_month, $waiting_day ) = >- Add_Delta_Days( $waiting_year, $waiting_month, $waiting_day, >- C4::Context->preference('ReservesMaxPickUpDelay')); >- my $calcDate = Date_to_Days( $waiting_year, $waiting_month, $waiting_day ); >+ >+ if ( $num->{waitingdate} ) { >+ my $maxpickupdate = dt_from_string($num->{maxpickupdate}); >+ $getreserv{waitingdate} = $num->{waitingdate}; >+ $getreserv{maxpickupdate} = $num->{maxpickupdate}; >+ if ( DateTime->compare( $today, $maxpickupdate ) == 1 ) { >+ if ($cancelall) { >+ my $res = cancel( $itemnumber, $borrowernumber, $holdingbranch, $homebranch, !$transfer_when_cancel_all ); >+ push @cancel_result, $res if $res; >+ next; >+ } else { >+ push @overloop, \%getreserv; >+ $overcount++; >+ } >+ }else{ >+ push @reservloop, \%getreserv; >+ $reservcount++; >+ } >+ } > > $getreserv{'itemtype'} = $itemtypeinfo->{'description'}; > $getreserv{'title'} = $gettitle->{'title'}; >@@ -131,21 +141,6 @@ foreach my $num (@getreserves) { > if ( $getborrower->{'emailaddress'} ) { > $getreserv{'borrowermail'} = $getborrower->{'emailaddress'}; > } >- >- if ($today > $calcDate) { >- if ($cancelall) { >- my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all ); >- push @cancel_result, $res if $res; >- next; >- } else { >- push @overloop, \%getreserv; >- $overcount++; >- } >- }else{ >- push @reservloop, \%getreserv; >- $reservcount++; >- } >- > } > > $template->param(cancel_result => \@cancel_result) if @cancel_result; >@@ -155,7 +150,6 @@ $template->param( > overloop => \@overloop, > overcount => $overcount, > show_date => format_date(C4::Dates->today('iso')), >- ReservesMaxPickUpDelay => C4::Context->preference('ReservesMaxPickUpDelay') > ); > > if ($cancelall) { >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index d7eebdd..a6fe3f7 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1129,6 +1129,7 @@ CREATE TABLE `issuingrules` ( -- circulation and fine rules > `renewalsallowed` smallint(6) NOT NULL default "0", -- how many renewals are allowed > `renewalperiod` int(4) default NULL, -- renewal period in the unit set in issuingrules.lengthunit > `reservesallowed` smallint(6) NOT NULL default "0", -- how many holds are allowed >+ `holdspickupdelay` int(11) default NULL, -- after how many days a hold is problematic (in days) > `branchcode` varchar(10) NOT NULL default '', -- the branch this rule is for (branches.branchcode) > overduefinescap decimal default NULL, -- the maximum amount of an overdue fine > PRIMARY KEY (`branchcode`,`categorycode`,`itemtype`), >@@ -1590,6 +1591,7 @@ CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b > `lowestPriority` tinyint(1) NOT NULL, -- has this hold been pinned to the lowest priority in the holds queue (1 for yes, 0 for no) > `suspend` BOOLEAN NOT NULL DEFAULT 0, -- in this hold suspended (1 for yes, 0 for no) > `suspend_until` DATETIME NULL DEFAULT NULL, -- the date this hold is suspended until (NULL for infinitely) >+ `maxpickupdate` date NULL DEFAULT NULL, -- the max pickup date for this reserves > PRIMARY KEY (`reserve_id`), > KEY `old_reserves_borrowernumber` (`borrowernumber`), > KEY `old_reserves_biblionumber` (`biblionumber`), >@@ -1789,6 +1791,7 @@ CREATE TABLE `reserves` ( -- information related to holds/reserves in Koha > `lowestPriority` tinyint(1) NOT NULL, > `suspend` BOOLEAN NOT NULL DEFAULT 0, > `suspend_until` DATETIME NULL DEFAULT NULL, >+ `maxpickupdate` date NULL DEFAULT NULL, -- the max pickup date for this reserves > PRIMARY KEY (`reserve_id`), > KEY priorityfoundidx (priority,found), > KEY `borrowernumber` (`borrowernumber`), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 5963d24..5978d18 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -7010,6 +7010,34 @@ CREATE TABLE IF NOT EXISTS borrower_files ( > SetVersion($DBversion); > } > >+ >+$DBversion = "3.11.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ my $maxpickupdelay = C4::Context->preference('ReservesMaxPickUpDelay') || 0; >+ $dbh->do(q{ >+ DELETE FROM systempreferences WHERE variable='ReservesMaxPickUpDelay'; >+ }); >+ $dbh->do(qq{ >+ ALTER TABLE issuingrules ADD COLUMN holdspickupdelay INT(11) NULL default NULL AFTER reservesallowed; >+ }); >+ my $sth = $dbh->prepare(q{ >+ UPDATE issuingrules SET holdspickupdelay = ? >+ }); >+ $sth->execute( $maxpickupdelay ); >+ $dbh->do(q{ >+ ALTER TABLE reserves ADD COLUMN maxpickupdate DATE NULL default NULL AFTER suspend_until; >+ }); >+ $sth = $dbh->prepare(q{ >+ UPDATE reserves SET maxpickupdate = ADDDATE(waitingdate, INTERVAL ? DAY); >+ }); >+ $sth->execute( $maxpickupdelay ); >+ $dbh->do(q{ >+ ALTER TABLE old_reserves ADD COLUMN maxpickupdate DATE NULL default NULL AFTER suspend_until; >+ }); >+ print "Upgrade to $DBversion done (8367: Add colum issuingrules.holdspickupdelay and reserves.maxpickupdate. Delete the ReservesMaxPickUpDelay syspref)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($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 64cf338..8b589c5 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 >@@ -365,16 +365,11 @@ Circulation: > PatronLibrary: "patron's home library" > - to see if the patron can place a hold on the item. > - >- - Mark a hold as problematic if it has been waiting for more than >- - pref: ReservesMaxPickUpDelay >- class: integer >- - days. >- - > - pref: ExpireReservesMaxPickUpDelay > choices: > yes: Allow > no: "Don't allow" >- - "holds to expire automatically if they have not been picked by within the time period specified in ReservesMaxPickUpDelay" >+ - "holds to expire automatically if they have not been picked by within the time period specified in hold pickup delay defined in the issuing rules" > - > - If using ExpireReservesMaxPickUpDelay, charge a borrower who allows his or her waiting hold to expire a fee of > - pref: ExpireReservesMaxPickUpDelayCharge >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >index 1c83cc0..2d2a285 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt >@@ -151,8 +151,10 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <th>Renewals allowed (count)</th> > <th>Renewal period</th> > <th>Holds allowed (count)</th> >+ <th>Holds pickup delay (day)</th> > <th>Rental discount (%)</th> >- <th colspan="2"> </th> >+ <th> </th> >+ <th> </th> > </tr> > </thead> > <tbody> >@@ -208,6 +210,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <td>[% rule.renewalsallowed %]</td> > <td>[% rule.renewalperiod %]</td> > <td>[% rule.reservesallowed %]</td> >+ <td>[% rule.holdspickupdelay %]</td> > <td>[% rule.rentaldiscount %]</td> > <td><a href="#" class="editrule">Edit</a></td> > <td> >@@ -257,6 +260,7 @@ for="tobranch"><strong>Clone these rules to:</strong></label> <input type="hidde > <td><input type="text" name="renewalsallowed" id="renewalsallowed" size="2" /></td> > <td><input type="text" name="renewalperiod" id="renewalperiod" size="3" /></td> > <td><input type="text" name="reservesallowed" id="reservesallowed" size="2" /></td> >+ <td><input type="text" name="holdspickupdelay" id="holdspickupdelay" size="2" /></td> > <td><input type="text" name="rentaldiscount" id="rentaldiscount" size="2" /></td> > <td colspan="2"> > <input type="hidden" name="branch" value="[% current_branch %]"/> >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 95252e7..66db55b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -710,7 +710,7 @@ No patron matched <span class="ex">[% message %]</span> > <h4>Holds waiting:</h4> > [% FOREACH WaitingReserveLoo IN WaitingReserveLoop %] > <ul> >- <li> <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% WaitingReserveLoo.biblionumber %]">[% WaitingReserveLoo.title |html %]</a> ([% WaitingReserveLoo.itemtype %]), [% IF ( WaitingReserveLoo.author ) %]by [% WaitingReserveLoo.author %][% END %] [% IF ( WaitingReserveLoo.itemcallnumber ) %][[% WaitingReserveLoo.itemcallnumber %]] [% END %]Hold placed on [% WaitingReserveLoo.reservedate %]. >+ <li> <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% WaitingReserveLoo.biblionumber %]">[% WaitingReserveLoo.title |html %]</a> ([% WaitingReserveLoo.itemtype %]), [% IF ( WaitingReserveLoo.author ) %]by [% WaitingReserveLoo.author %][% END %] [% IF ( WaitingReserveLoo.itemcallnumber ) %][[% WaitingReserveLoo.itemcallnumber %]] [% END %]Hold placed on [% WaitingReserveLoo.reservedate %] waiting until [% WaitingReserveLoo.maxpickupdate | $KohaDates %]. > [% IF ( WaitingReserveLoo.waitingat ) %] > <br />[% IF ( WaitingReserveLoo.waitinghere ) %]<strong class="waitinghere">[% ELSE %]<strong>[% END %]Waiting at [% WaitingReserveLoo.waitingat %]</strong> > [% END %] >@@ -1115,7 +1115,7 @@ No patron matched <span class="ex">[% message %]</span> > <td><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% reservloo.biblionumber %]"><strong>[% reservloo.title |html %]</strong></a>[% IF ( reservloo.author ) %], by [% reservloo.author %][% END %]</td> > <td>[% reservloo.itemcallnumber %]</td> > <td><em>[% IF ( reservloo.barcodereserv ) %]Item [% reservloo.barcodereserv %] >- [% END %][% IF ( reservloo.waiting ) %] <strong>waiting at [% reservloo.waitingat %]</strong> >+ [% END %][% IF ( reservloo.waiting ) %] <strong>waiting at [% reservloo.waitingat %][% IF reservloo.maxpickupdate %] until [% reservloo.maxpickupdate | $KohaDates %][% END %]</strong> > [% END %] > [% IF ( reservloo.transfered ) %] <strong>in transit</strong> from > [% reservloo.frombranch %] since [% reservloo.datesent %] >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 10c6b8c..5bfe60e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt >@@ -1,3 +1,4 @@ >+[% USE KohaDates %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Circulation › Holds awaiting pickup</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -81,7 +82,7 @@ dt_add_type_uk_date(); > [% IF ( reserveloop ) %] > <table id="holdst"> > <thead><tr> >- <th>Available since</th> >+ <th>Available since-until</th> > <th>Title</th> > <th>Patron</th> > <th>Location</th> >@@ -91,7 +92,7 @@ dt_add_type_uk_date(); > </tr></thead> > <tbody>[% FOREACH reserveloo IN reserveloop %] > <tr> >- <td><p>[% reserveloo.waitingdate %]</p></td> >+ <td><p>[% reserveloo.waitingdate | $KohaDates %] - [% reserveloo.maxpickupdate | $KohaDates %]</p></td> > <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = reserveloo.biblionumber %] > [% reserveloo.title |html %] [% reserveloo.subtitle |html %] > </a> >@@ -126,7 +127,7 @@ dt_add_type_uk_date(); > [% END %] > </div> > <div id="holdsover"> >- <p>Holds listed here have been awaiting pickup for more than [% ReservesMaxPickUpDelay %] days.</p> >+ <p>Holds listed here have been awaiting pickup for too many days.</p> > [% IF ( overloop ) %] > <p> > <form name="cancelAllReserve" action="waitingreserves.pl" method="post"> >@@ -141,7 +142,7 @@ dt_add_type_uk_date(); > <br/> > <table id="holdso"> > <thead><tr> >- <th>Available since</th> >+ <th>Available since-until</th> > <th>Title</th> > <th>Patron</th> > <th>Location</th> >@@ -151,7 +152,7 @@ dt_add_type_uk_date(); > </tr></thead> > <tbody>[% FOREACH overloo IN overloop %] > <tr> >- <td><p>[% overloo.waitingdate %]</p></td> >+ <td><p>[% overloo.waitingdate | $KohaDates %] - [% overloo.maxpickupdate | $KohaDates %]</p></td> > <td>[% INCLUDE 'biblio-default-view.inc' biblionumber = overloo.biblionumber %][% overloo.title |html %] [% overloo.subtitle |html %] > </a> > [% UNLESS ( item_level_itypes ) %][% IF ( overloo.itemtype ) %] (<b>[% overloo.itemtype %]</b>)[% END %][% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/circ/waitingreserves.tt >index be0e509..8ce7b9c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/circ/waitingreserves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/circ/waitingreserves.tt >@@ -4,8 +4,8 @@ > > <p>This report will show all of the holds that are waiting for patrons to pick them up.</p> > >-<p>Items that have been on the hold shelf longer than you normally allow (based on the ReservesMaxPickUpDelay preference value) will appear on the 'Holds Over' tab, they will not automatically be cancelled unless you have set the cron job to do that for you, but you can cancel all holds using the button at the top of the list.</p> >+<p>Items that have been on the hold shelf longer than you normally allow (based on the holds pickup delay defined in the issuing rules) will appear on the 'Holds Over' tab, they will not automatically be cancelled.</p> > > <p><strong>See the full documentation for Holds Awaiting Pickup in the <a href="http://manual.koha-community.org/3.12/en/circreports.html#holdspickup">manual</a> (online).</strong></p> > >-[% INCLUDE 'help-bottom.inc' %] >\ No newline at end of file >+[% INCLUDE 'help-bottom.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 1566a32..05f9570 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -637,7 +637,7 @@ function validate1(date) { > </td> > <td>[% reservloo.itemcallnumber %]</td> > <td>[% IF ( reservloo.waiting ) %] >- <em>Item is <strong>waiting</strong></em> >+ <em>Item is <strong>waiting</strong>[% IF reservloo.maxpickupdate %] until [% reservloo.maxpickupdate %][% END %]</em> > [% END %] > [% IF ( reservloo.transfered ) %] > <em>Item <strong>in transit</strong> from >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >index 41ab539..9f67ccb 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt >@@ -395,7 +395,7 @@ $.tablesorter.addParser({ > [% IF ( RESERVE.wait ) %] > [% IF ( RESERVE.atdestination ) %] > [% IF ( RESERVE.found ) %] >- Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %][% END %] >+ Item waiting at <b> [% RESERVE.wbrname %]</b>[% IF ( RESERVE.waitingdate ) %] since [% RESERVE.waitingdate | $KohaDates %] until [% RESERVE.maxpickupdate | $KohaDates %][% END %] > <input type="hidden" name="pickup" value="[% RESERVE.wbrcd %]" /> > [% ELSE %] > Item waiting to be pulled from <b> [% RESERVE.wbrname %]</b> >diff --git a/members/moremember.pl b/members/moremember.pl >index 598b07d..1310b03 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -285,6 +285,7 @@ if ($borrowernumber) { > if ( $num_res->{'found'} eq 'W' ) { > $getreserv{color} = 'reserved'; > $getreserv{waiting} = 1; >+ $getreserv{maxpickupdate} = $num_res->{maxpickupdate}; > } > > # check transfers with the itemnumber foud in th reservation loop >diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >index b4d4e9c..a052e31 100755 >--- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >+++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >@@ -284,7 +284,7 @@ sub GetPredueIssues { > sub GetWaitingHolds { > my $query = > "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, >- borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate, >+ borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate,reserves.maxpickupdate, > reserves.branchcode AS site, branches.branchname AS site_name, > TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting > FROM borrowers JOIN reserves USING (borrowernumber) >@@ -298,7 +298,6 @@ sub GetWaitingHolds { > AND message_transport_type = 'phone' > AND message_name = 'Hold_Filled' > "; >- my $pickupdelay = C4::Context->preference("ReservesMaxPickUpDelay"); > my $sth = $dbh->prepare($query); > $sth->execute(); > my @results; >@@ -306,7 +305,7 @@ sub GetWaitingHolds { > my @waitingdate = split( /-/, $issue->{'waitingdate'} ); > my @date_due = > Add_Delta_Days( $waitingdate[0], $waitingdate[1], $waitingdate[2], >- $pickupdelay ); >+ $issue->{maxpickupdate} ); > $issue->{'date_due'} = > sprintf( "%04d-%02d-%02d", $date_due[0], $date_due[1], $date_due[2] ); > $issue->{'level'} = 1; # only one level for Hold Waiting notifications >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 5c01ae2..1a70d6a 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -257,7 +257,11 @@ foreach my $res (@reserves) { > $res->{'expirationdate'} = ''; > } > >- $res->{'waiting'} = 1 if $res->{'found'} eq 'W'; >+ my $publictype = $res->{'publictype'}; >+ $res->{$publictype} = 1; >+ if ( $res->{found} eq 'W' ) { >+ $res->{waiting} = 1; >+ } > $res->{'branch'} = $branches->{ $res->{'branchcode'} }->{'branchname'}; > my $biblioData = GetBiblioData($res->{'biblionumber'}); > $res->{'reserves_title'} = $biblioData->{'title'}; >-- >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 8367
:
12130
|
13139
|
13602
|
13603
|
13604
|
13624
|
15334
|
15335
|
15369
|
15498
|
15613
|
15658
|
15659
|
19093
|
19094
|
19095
|
19096
|
19104
|
19105
|
19107
|
19108
|
19116
|
19180
|
19181
|
19182
|
19360
|
19361
|
19362
|
20300
|
20301
|
20302
|
20303
|
20304
|
32786
|
32826
|
32884
|
32885
|
32916
|
32930
|
42706
|
42754
|
79790
|
79791
|
79798
|
79799
|
79800
|
79853
|
79854
|
79855
|
79859
|
92412
|
92413
|
92414
|
92415
|
92416
|
92417
|
92418
|
92419
|
92420
|
92421
|
92422
|
92423
|
92424
|
92425
|
92426
|
92427
|
92428
|
92958
|
92959
|
92960
|
92961
|
103425
|
113211
|
117284
|
118017
|
118021
|
124568
|
125087
|
131299
|
131300
|
131301
|
131302
|
131646
|
131647
|
131718
|
131719
|
131720
|
131722
|
131723
|
131724
|
133089
|
133090
|
133091
|
133092
|
133093
|
133094
|
142897
|
142898
|
142899
|
142900
|
142901
|
142902
|
142903
|
144097
|
144098
|
144099
|
144100
|
144101
|
144102
|
144103
|
144146
|
145644
|
145657
|
147798
|
147799
|
147800
|
147801
|
147802
|
147803
|
147804
|
147805
|
147806
|
147807
|
148536
|
148537
|
148538
|
148539
|
148540
|
148541
|
148542
|
148543
|
148544
|
148545
|
150437
|
150438
|
150439
|
153235
|
153237
|
153238
|
153239
|
153240
|
153241
|
153242
|
153243
|
153244
|
153245
|
153246
|
157138
|
157139
|
157140
|
157141
|
157142
|
157143
|
157144
|
157145
|
157146
|
157147
|
157148
|
157149
|
157150
|
157298
|
157343
|
157344
|
157345
|
157346
|
157347
|
157348
|
157349
|
157350
|
157351
|
157352
|
157354
|
157355
|
157356
|
157697
|
157698
|
157699
|
157700
|
157701
|
157702
|
157703
|
157704
|
157705
|
157706
|
157707
|
157708
|
157709
|
157715
|
158023
|
158024
|
158025
|
158026
|
158027
|
158028
|
158029
|
158030
|
158031
|
158032
|
158033
|
158034
|
158035
|
158254
|
158255