Bugzilla – Attachment 104197 Details for
Bug 24159
Allow daysMode for calculating due and renewal dates to be set at the circulation rules level
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24159: Set days_mode according to circ rules in 3 other places
Bug-24159-Set-daysmode-according-to-circ-rules-in-.patch (text/plain), 5.21 KB, created by
Jonathan Druart
on 2020-05-02 14:07:35 UTC
(
hide
)
Description:
Bug 24159: Set days_mode according to circ rules in 3 other places
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-05-02 14:07:35 UTC
Size:
5.21 KB
patch
obsolete
>From bd6f35d74f27c3a680e28cc3610163ee16a12c54 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 12 Mar 2020 08:29:27 +0100 >Subject: [PATCH] Bug 24159: Set days_mode according to circ rules in 3 other > places > >There are 3 other occurrences where the new circ rule can be used: > * C4::Circulation::checkHighHolds > * Koha::Hold->set_waiting > * misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl > >Test plan: >* checkHighHolds >Enable decreaseLoanHighHolds and fill decreaseLoanHighHoldsDuration >Setup things to hit a "high demand" alert with a shortened due date >Check an item out >=> The due date must be recalculated depending on the circ rule useDaysMode. > >* set_waiting >Set ExcludeHolidaysFromMaxPickUpDelay to "1" (note that there is currently >a bug in the description of the syspref, see bug 22381 comment 19) >Mark a hold waiting >The expiration date should have been set depending on the value of the >circ rule. > >* TalkingTech cronjob >Cannot test this >--- > C4/Circulation.pm | 11 +++++++++-- > Koha/Hold.pm | 11 ++++++++++- > .../thirdparty/TalkingTech_itiva_outbound.pl | 13 +++++++++++-- > 3 files changed, 30 insertions(+), 5 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 349a802bd3..b6ebee266c 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1238,9 +1238,16 @@ sub checkHighHolds { > > my $issuedate = dt_from_string(); > >- my $calendar = Koha::Calendar->new( branchcode => $branchcode ); >- > my $itype = $item_object->effective_itemtype; >+ my $useDaysMode_value = Koha::CirculationRules->get_useDaysMode_effective_value( >+ { >+ categorycode => $borrower->{categorycode}, >+ itemtype => $itype, >+ branchcode => $branchcode, >+ } >+ ); >+ my $calendar = Koha::Calendar->new( branchcode => $branchcode, days_mode => $useDaysMode_value ); >+ > my $orig_due = C4::Circulation::CalcDateDue( $issuedate, $itype, $branchcode, $borrower ); > > my $decreaseLoanHighHoldsDuration = C4::Context->preference('decreaseLoanHighHoldsDuration'); >diff --git a/Koha/Hold.pm b/Koha/Hold.pm >index 6896f5e94d..aa1c4d8057 100644 >--- a/Koha/Hold.pm >+++ b/Koha/Hold.pm >@@ -178,12 +178,21 @@ sub set_waiting { > > my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay"); > my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays'); >- my $calendar = Koha::Calendar->new( branchcode => $self->branchcode ); > > my $expirationdate = $today->clone; > $expirationdate->add(days => $max_pickup_delay); > > if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { >+ my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype; >+ my $useDaysMode_value = Koha::CirculationRules->get_useDaysMode_effective_value( >+ { >+ categorycode => $self->borrower->categorycode, >+ itemtype => $itemtype, >+ branchcode => $self->branchcode, >+ } >+ ); >+ my $calendar = Koha::Calendar->new( branchcode => $self->branchcode, days_mode => $useDaysMode_value ); >+ > $expirationdate = $calendar->days_forward( dt_from_string(), $max_pickup_delay ); > } > >diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >index 1131da61e2..cbab04947d 100755 >--- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >+++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl >@@ -311,7 +311,7 @@ sub GetWaitingHolds { > > my $patron_branchcode_filter = $patron_branchcode ? "AND borrowers.branchcode = '$patron_branchcode'" : q{}; > >- my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, >+ my $query = "SELECT borrowers.borrowernumber, borrowers.cardnumber, borrowers.title as patron_title, borrowers.firstname, borrowers.surname, borrowers.categorycode, > borrowers.phone, borrowers.email, borrowers.branchcode, biblio.biblionumber, biblio.title, items.barcode, reserves.waitingdate, > reserves.branchcode AS site, branches.branchname AS site_name, > TO_DAYS(NOW())-TO_DAYS(reserves.waitingdate) AS days_since_waiting >@@ -332,7 +332,16 @@ sub GetWaitingHolds { > $sth->execute(); > my @results; > while ( my $issue = $sth->fetchrow_hashref() ) { >- my $calendar = Koha::Calendar->new( branchcode => $issue->{'site'} ); >+ my $item = Koha::Items->find({ barcode => $issue->{barcode} }); >+ my $useDaysMode_value = Koha::CirculationRules->get_useDaysMode_effective_value( >+ { >+ categorycode => $issue->{categorycode}, >+ itemtype => $item->effective_itemtype, >+ branchcode => $issue->{site}, >+ } >+ ); >+ >+ my $calendar = Koha::Calendar->new( branchcode => $issue->{'site'}, days_mode => $useDaysMode_value ); > > my $waiting_date = dt_from_string( $issue->{waitingdate}, 'sql' ); > my $pickup_date = $waiting_date->clone->add( days => $pickupdelay ); >-- >2.20.1
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 24159
:
99758
|
99759
|
99760
|
99761
|
99762
|
100608
|
100609
|
100610
|
100611
|
100612
|
100613
|
100614
|
100615
|
101053
|
101054
|
101556
|
101649
|
101698
|
102009
|
102148
|
102303
|
102554
|
102555
|
102556
|
102557
|
102558
|
102559
|
102560
|
102561
|
102562
|
102563
|
104197
|
104198
|
104199
|
104200
|
104201
|
104202
|
104203
|
104204
|
106007
|
106008
|
106013
|
106014
|
106015
|
106016
|
106017
|
106018
|
106019
|
106020
|
106021
|
106022