Bug 34435: Remove side effect from get_password_expiry_date
authoremlam <emily.lamancusa@montgomerycountymd.gov>
Thu, 27 Jul 2023 16:36:34 +0000 (16:36 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 17 Aug 2023 20:12:27 +0000 (10:12 -1000)
commitf067a82e3aa2d45b92415cc6cfb0fea71b0866c2
tree5be9d0d2c203e8d37d83b8a66387327d27f63df2
parentef24af8da3bc1221cb952c27aa9fe02c86b6444c
Bug 34435: Remove side effect from get_password_expiry_date

If get_password_expiry_date is passed a DateTime object
as a parameter, it modifies and returns the original
object. This can create possible side effects.

This patch modifies get_password_expiry_date to clone the
DateTime object that it receives as a parameter and
return the modified clone, so that object references can
be passed in safely.

To test:
prove t/db_dependent/Koha/Patron/Category.t

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit dae5607fd184c2e4b19b197cca313aca92975e47)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Patron/Category.pm