diff --git a/Koha/ArticleRequest.pm b/Koha/ArticleRequest.pm index 89b5c95ef4..3dc5b991ae 100644 --- a/Koha/ArticleRequest.pm +++ b/Koha/ArticleRequest.pm @@ -196,16 +196,11 @@ will have notifications sent. sub store { my ($self) = @_; - - if ( $self->in_storage() ) { - my $now = dt_from_string(); - $self->updated_on($now); - - return $self->SUPER::store(); - } - else { - $self->open(); - return $self->SUPER::store(); + if ( $self->in_storage ) { + return $self->SUPER::store; + } else { + $self->created_on( dt_from_string() ); + return $self->open; } } diff --git a/t/db_dependent/ArticleRequests.t b/t/db_dependent/ArticleRequests.t index 84ddbdee7b..a8115317e7 100755 --- a/t/db_dependent/ArticleRequests.t +++ b/t/db_dependent/ArticleRequests.t @@ -19,7 +19,7 @@ use Modern::Perl; use POSIX qw(strftime); -use Test::More tests => 56; +use Test::More tests => 57; use t::lib::TestBuilder; use t::lib::Mocks; @@ -101,7 +101,8 @@ like( $notify_message->content, qr{Title: $article_request_title}, 'Values from $article_request = Koha::ArticleRequests->find( $article_request->id ); ok( $article_request->id, 'Koha::ArticleRequest created' ); is( $article_request->status, Koha::ArticleRequest::Status::Pending, 'New article request has status of Open' ); -is( $article_request->updated_on, undef, 'New article request has not an updated_on date set yet' ); +isnt( $article_request->created_on, undef, 'New article request has created_on date set' ); +isnt( $article_request->updated_on, undef, 'New article request has updated_on date set' ); # process Koha::Notice::Messages->delete;