Bugzilla – Attachment 138073 Details for
Bug 30392
Add a deleted_on column to deleteditems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30392: Set deleted_on when an item is (marked as) deleted
Bug-30392-Set-deletedon-when-an-item-is-marked-as-.patch (text/plain), 2.41 KB, created by
Jonathan Druart
on 2022-07-25 08:09:50 UTC
(
hide
)
Description:
Bug 30392: Set deleted_on when an item is (marked as) deleted
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-07-25 08:09:50 UTC
Size:
2.41 KB
patch
obsolete
>From 5ef81a391395cf3425ac5f53dc08c6174e96c99e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 25 Jul 2022 10:07:48 +0200 >Subject: [PATCH] Bug 30392: Set deleted_on when an item is (marked as) deleted > >We could like to track down when an item has been moved to the >deleteditems table. > >Test plan: >Created a new item, delete it >Not that the deleteditems.deleted_on value is set correctly >--- > Koha/Item.pm | 1 + > t/db_dependent/Koha/Item.t | 9 +++++++-- > 2 files changed, 8 insertions(+), 2 deletions(-) > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 23a66dc5343..4dc41b9d78d 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -337,6 +337,7 @@ sub move_to_deleted { > my ($self) = @_; > my $item_infos = $self->unblessed; > delete $item_infos->{timestamp}; #This ensures the timestamp date in deleteditems will be set to the current timestamp >+ $item_infos->{deleted_on} = dt_from_string; > return Koha::Database->new->schema->resultset('Deleteditem')->create($item_infos); > } > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index b13fe57e68b..55cface4cf3 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -37,6 +37,7 @@ use List::MoreUtils qw(all); > > use t::lib::TestBuilder; > use t::lib::Mocks; >+use t::lib::Dates; > > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; >@@ -765,7 +766,7 @@ subtest 'request_transfer' => sub { > }; > > subtest 'deletion' => sub { >- plan tests => 13; >+ plan tests => 15; > > $schema->storage->txn_begin; > >@@ -776,9 +777,13 @@ subtest 'deletion' => sub { > biblionumber => $biblio->biblionumber, > } > ); >+ is( $item->deleted_on, undef, 'deleted_on not set for new item' ); > >- is( ref( $item->move_to_deleted ), 'Koha::Schema::Result::Deleteditem', 'Koha::Item->move_to_deleted should return the Deleted item' ) >+ my $deleted_item = $item->move_to_deleted; >+ is( ref( $deleted_item ), 'Koha::Schema::Result::Deleteditem', 'Koha::Item->move_to_deleted should return the Deleted item' ) > ; # FIXME This should be Koha::Deleted::Item >+ is( t::lib::Dates::compare( $deleted_item->deleted_on, dt_from_string() ), 0 ); >+ > is( Koha::Old::Items->search({itemnumber => $item->itemnumber})->count, 1, '->move_to_deleted must have moved the item to deleteditem' ); > $item = $builder->build_sample_item( > { >-- >2.25.1
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 30392
:
138073
|
138115
|
138232
|
138233
|
138481
|
138482
|
138483
|
138500