Bugzilla – Attachment 153977 Details for
Bug 34117
Duplicate patron sets dateenrolled incorrectly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34117: Remove side effect from get_expiry_date
Bug-34117-Remove-side-effect-from-getexpirydate.patch (text/plain), 1.69 KB, created by
Emily Lamancusa (emlam)
on 2023-07-27 13:43:16 UTC
(
hide
)
Description:
Bug 34117: Remove side effect from get_expiry_date
Filename:
MIME Type:
Creator:
Emily Lamancusa (emlam)
Created:
2023-07-27 13:43:16 UTC
Size:
1.69 KB
patch
obsolete
>From a09679a262ef9441b155c5e84a9bed9b7cef28a9 Mon Sep 17 00:00:00 2001 >From: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Date: Thu, 20 Jul 2023 13:41:15 -0400 >Subject: [PATCH] Bug 34117: Remove side effect from get_expiry_date > >If get_expiry_date is passed a DateTime object as a parameter, >it modifies and returns the original object. When memberentry.pl >prefills the input fields for duplicating a patron, it passes the >enrollment date object to get_expiry_date. This causes the enrollment >date object to be modified with the expiry date value. > >This patch modifies get_expiry_date to clone the DateTime object that it >receives as a parameter and return the clone, so that references to an >enrollment date object can be passed in safely. > >To test: >1. Have or make a patron >2. Duplicate that patron >3. Before saving the new patron, scroll down to Registration Date and > see that it's defaulting to a date in the future. >4. Apply patch and restart_all >5. Try duplicating a patron again >6. Registration Date should correctly set to today >--- > Koha/Patron/Category.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/Koha/Patron/Category.pm b/Koha/Patron/Category.pm >index 9eb6d26edc..335367b825 100644 >--- a/Koha/Patron/Category.pm >+++ b/Koha/Patron/Category.pm >@@ -106,7 +106,7 @@ sub get_expiry_date { > my ($self, $date ) = @_; > if ( $self->enrolmentperiod ) { > $date ||= dt_from_string; >- $date = dt_from_string( $date ) unless ref $date; >+ $date = ref $date ? $date->clone() : dt_from_string( $date ); > return $date->add( months => $self->enrolmentperiod, end_of_month => 'limit' ); > } else { > return $self->enrolmentperioddate; >-- >2.34.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 34117
:
152656
|
152657
|
153977
|
153982
|
153991
|
153992
|
154061
|
154062