Bugzilla – Attachment 167949 Details for
Bug 34440
Add warm-up and cool-down periods to bookings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34440: Take preparation period into account at checkout
Bug-34440-Take-preparation-period-into-account-at-.patch (text/plain), 3.24 KB, created by
Martin Renvoize (ashimema)
on 2024-06-21 11:26:47 UTC
(
hide
)
Description:
Bug 34440: Take preparation period into account at checkout
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-21 11:26:47 UTC
Size:
3.24 KB
patch
obsolete
>From 71250a68cee3dd79c210fd148db39c3318b1ba4a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 27 Mar 2024 17:29:00 +0000 >Subject: [PATCH] Bug 34440: Take preparation period into account at checkout > >This patch ensures we catch checkouts that would interfer with the >preparation period set for an existing booking by adding said period to >the bookings search. > >We also reduce the proposed due date for the checkout to be confirmed by >the preparation period for the item. > >Test plan >1) Set a booking preparation period for an itemtype >2) Add a booking for an item with that itemtype to fall beyond the due > date that the item would be assigned if you were to check it out now > to your test user, but within the number of days you've set for your > preparation period. >3) Attempt to check the item out to your test user. >4) Note that we catch the booking and warn and that the latest return > date suggested take the preparation period into account. >--- > Koha/Item.pm | 10 ++++++++++ > circ/circulation.pl | 12 +++++++++++- > 2 files changed, 21 insertions(+), 1 deletion(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 91c15b22d55..9a91938adfe 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -599,6 +599,16 @@ sub find_booking { > my $due_date = $params->{due_date}; > my $biblio = $self->biblio; > >+ my $rule = Koha::CirculationRules->get_effective_rule( >+ { >+ rule_name => 'bookings_lead_period', >+ itemtype => $self->effective_itemtype, >+ branchcode => "*" >+ } >+ ); >+ my $preparation_period = $rule ? $rule->rule_value : 0; >+ $due_date = $due_date->clone->add( days => $preparation_period ); >+ > my $dtf = Koha::Database->new->schema->storage->datetime_parser; > my $bookings = $biblio->bookings( > [ >diff --git a/circ/circulation.pl b/circ/circulation.pl >index d1c2b3b0cfb..0fa5df34a6e 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -52,6 +52,7 @@ use Koha::Plugins; > use Koha::Database; > use Koha::BiblioFrameworks; > use Koha::Items; >+use Koha::CirculationRules; > use Koha::SearchEngine; > use Koha::SearchEngine::Search; > use Koha::Patron::Modifications; >@@ -482,8 +483,17 @@ if (@$barcodes && $op eq 'cud-checkout') { > $template_params->{NEEDSCONFIRMATION} = 1; > $confirm_required = 1; > if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) { >+ my $rule = Koha::CirculationRules->get_effective_rule( >+ { >+ rule_name => 'bookings_lead_period', >+ itemtype => $item->effective_itemtype, >+ branchcode => "*" >+ } >+ ); >+ my $preparation_period = $rule ? $rule->rule_value : 1; > my $reduceddue = >- dt_from_string( $$needsconfirmation{$needsconfirmation_key}->start_date )->subtract( days => 1 ); >+ dt_from_string( $$needsconfirmation{$needsconfirmation_key}->start_date ) >+ ->subtract( days => $preparation_period ); > $template_params->{reduceddue} = $reduceddue; > } > } >-- >2.45.2
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 34440
:
167948
|
167949
|
167950
|
167951
|
167952
|
167953
|
167954
|
167955
|
168941
|
168942
|
168943
|
168944
|
168945
|
168946
|
168947
|
168948
|
168949
|
168998
|
168999
|
169000
|
169001
|
169002
|
169003
|
169004
|
169005
|
169006
|
169007
|
169571
|
169572
|
169573
|
169574
|
169575
|
169576
|
169577
|
169578
|
169579
|
169580
|
169581
|
169587
|
169588
|
170032
|
170033
|
170034
|
170035
|
170036
|
170037
|
170038
|
170039
|
170040
|
170041
|
170042
|
170046
|
170047
|
170048
|
170049
|
170050
|
170051
|
170052
|
170053
|
170054
|
170055
|
170056
|
170589
|
170590
|
170591
|
170592
|
170593
|
170594
|
170595
|
170596
|
170597
|
170598
|
170599
|
170600
|
170603
|
170610
|
170951