[Koha-bugs] [Bug 32563] Reservedate becomes expirationdate in some cases
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Jan 30 13:24:42 CET 2023
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32563
Emmi Takkinen <emmi.takkinen at koha-suomi.fi> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |emmi.takkinen at koha-suomi.fi
--- Comment #4 from Emmi Takkinen <emmi.takkinen at koha-suomi.fi> ---
(In reply to Anneli Österman from comment #3)
> I tested this in PTFS-Europe's sandbox and noticed that if
> DefaultHoldExpirationdate is set and I trap a hold and revert the hold's
> waiting status and then try to cancel the hold, I get an error.
>
> {UNKNOWN}: Can't locate object method "clone" via package "2023-01-27"
> (perhaps you forgot to load "2023-01-27"?) at /kohadevbox/koha/Koha/Hold.pm
> line 898. at /kohadevbox/koha/Koha/Hold.pm line 762
> at /usr/share/perl5/DBIx/Class/Exception.pm line 77
>
> The hold's expirationdate should have been set back to the original
> expirationdate but it becomes empty. When I check reserves table the hold
> does not have expirationdate or patron_expiration_date set.
This happens because reservedate fetched from database is not a DateTime
object. Instead cloning $self->reservedate we should use dt_from_string to
$self->reservedate and then clone. Then use that clone with add. Something like
this:
>my $reservedate = dt_from_string( $self->reservedate );
>my $reservedate_clone = $reservedate->clone;
>$self->expirationdate(
>$reservedate_clone->add( $timeunit => $period ) );
--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
More information about the Koha-bugs
mailing list