https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32563 Bug ID: 32563 Summary: Reservedate becomes expirationdate in some cases Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Hold requests Assignee: koha-bugs@lists.koha-community.org Reporter: slavashishkin@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com Database fields DATE/DATETIME/TIMESTAMP in DBIX-Class are automatically available as DateTime objects that we can perform operations on (for example add an interval). But there is a feature: addition or subtraction operations (->add in this case) change the main object in-place and return the new value as the result of the expression. Because of this feature, due to the fact that the address to ->reserve date was passed to the ->add function, ->reservedate itself was changed, and then the result was assigned to ->expirationdate. This implicit feature resulted in an error when both dates after the given operation were the same in the future. Solution: To not change the original DateTime object, it must be cloned: https://metacpan.org/pod/DateTime#$dt-%3Eclone , accordingly, the changes will be made in a temporary copy, and a new value will be assigned to expirationdate, and the original reservedate will not change. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.