Bug 18382: (QA follow-up) Make new unit test pass
authorKyle M Hall <kyle@bywatersolutions.com>
Wed, 28 Mar 2018 19:58:37 +0000 (19:58 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 2 Apr 2018 21:07:57 +0000 (18:07 -0300)
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Koha/Hold.pm

index e76b9fb..afdafb8 100644 (file)
@@ -83,7 +83,7 @@ my $hold = $hold->suspend_hold( $suspend_until_dt );
 sub suspend_hold {
     my ( $self, $dt ) = @_;
 
-    $dt = $dt ? $dt->clone()->truncate( to => 'day' ) : undef;
+    my $date = $dt ? $dt->clone()->truncate( to => 'day' )->datetime : undef;
 
     if ( $self->is_waiting ) {    # We can't suspend waiting holds
         carp "Unable to suspend waiting hold!";
@@ -91,7 +91,7 @@ sub suspend_hold {
     }
 
     $self->suspend(1);
-    $self->suspend_until( $dt->datetime ) if ( defined $dt );
+    $self->suspend_until( $date );
     $self->store();
 
     logaction( 'HOLDS', 'SUSPEND', $self->reserve_id, Dumper($self->unblessed) )