Bugzilla – Attachment 138232 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
Katrin Fischer
on 2022-07-28 21:24:31 UTC
(
hide
)
Description:
Bug 30392: Set deleted_on when an item is (marked as) deleted
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2022-07-28 21:24:31 UTC
Size:
2.41 KB
patch
obsolete
>From 50a84fe3d55b2bdeb43c713706bea293a51035a3 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 23a66dc534..4dc41b9d78 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 b13fe57e68..55cface4cf 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.30.2
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