Bug 33611: Ensure dt_from_string always returns a new object
authorNick Clemens <nick@bywatersolutions.com>
Thu, 27 Apr 2023 13:02:52 +0000 (13:02 +0000)
committerMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Mon, 15 May 2023 10:34:22 +0000 (10:34 +0000)
commit43cce2fbecd579719b070b3afefbc58cec4ed205
tree9979c7c55a7e0abf129095592c07b1d7234c7d60
parent59e55c22efbffbbfe0500423eb7df10f0d71b370
Bug 33611: Ensure dt_from_string always returns a new object

This patch alters dt_from_string to pass a cloned object if called
on an existing date time object

This resolves an issue where a holds reserve date was being altered when
the default expiration date was set

To test:
1 - Set DefaultHoldExpiration to Set
2 - Set DefaultHoldExpirationPeriod to 365
3 - Set DefaultHoldExpirationunitOfTimeToDays
4 - Place a hold
5 - Note reserve date is 1 year in the future, same as expiration
6 - Apply patch
7 - Restart all
8 - Place another hold
9 - Note reserve date is set to today

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Hinemoea Viault <hinemoea.viault@inlibro.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit ca784d740d8e5758196c523dbeb205942de7729c)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Koha/DateUtils.pm