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)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 15 Aug 2023 09:17:04 +0000 (12:17 +0300)
commitdae5607fd184c2e4b19b197cca313aca92975e47
tree08665054f3566334d795129ca233bdec7bda0de9
parent420363258214e2c397ef604c63b13491462ed955
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>
Koha/Patron/Category.pm