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)
committerPedro Amorim <pedro.amorim@ptfs-europe.com>
Fri, 18 Aug 2023 13:50:43 +0000 (13:50 +0000)
commit148eec6bb363c44b763753cc242048c704070b33
tree76b9b5a056065939929b120400c5d5b36b843721
parent77f55baa51bfdf9731e30efe4681a02c8a245245
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>
(cherry picked from commit f067a82e3aa2d45b92415cc6cfb0fea71b0866c2)
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Koha/Patron/Category.pm