Bugzilla – Attachment 99838 Details for
Bug 22273
Column article_requests.created_on should not be updated
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22273: Modify Koha::ArticleRequest->store to fill created_on
Bug-22273-Modify-KohaArticleRequest-store-to-fill-.patch (text/plain), 2.75 KB, created by
Katrin Fischer
on 2020-02-29 21:39:04 UTC
(
hide
)
Description:
Bug 22273: Modify Koha::ArticleRequest->store to fill created_on
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-02-29 21:39:04 UTC
Size:
2.75 KB
patch
obsolete
>From ce6ff44e32da2a00d0805ccf3755702c8aed5007 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 18 Dec 2019 13:49:59 +0000 >Subject: [PATCH] Bug 22273: Modify Koha::ArticleRequest->store to fill > created_on > >For a new record, store should fill created_on. >The database will always update the timestamp updated_on. >Since open also calls SUPER::store, we do not need to call it twice. > >Test plan: >[1] Run t/db_dependent/ArticleRequests.t >[2] In the interface, add two article requests. Change the status of one > to PROCESSING. Check created_on and updated_on in the article_requests > table. The changed request should have updated_on > created_on. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >[1] Tests pass >ok 12 - New article request has created_on date set >ok 13 - New article request has updated_on date set > >[2] Work as described. >No errors > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/ArticleRequest.pm | 15 +++++---------- > t/db_dependent/ArticleRequests.t | 5 +++-- > 2 files changed, 8 insertions(+), 12 deletions(-) > >diff --git a/Koha/ArticleRequest.pm b/Koha/ArticleRequest.pm >index f2698e7f55..39f68b1711 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 44a99b7e62..9ede9eb53b 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; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22273
:
96424
|
96425
|
96426
|
99787
|
99788
|
99789
|
99836
|
99837
| 99838