View | Details | Raw Unified | Return to bug 30392
Collapse All | Expand All

(-)a/Koha/Item.pm (+1 lines)
Lines 337-342 sub move_to_deleted { Link Here
337
    my ($self) = @_;
337
    my ($self) = @_;
338
    my $item_infos = $self->unblessed;
338
    my $item_infos = $self->unblessed;
339
    delete $item_infos->{timestamp}; #This ensures the timestamp date in deleteditems will be set to the current timestamp
339
    delete $item_infos->{timestamp}; #This ensures the timestamp date in deleteditems will be set to the current timestamp
340
    $item_infos->{deleted_on} = dt_from_string;
340
    return Koha::Database->new->schema->resultset('Deleteditem')->create($item_infos);
341
    return Koha::Database->new->schema->resultset('Deleteditem')->create($item_infos);
341
}
342
}
342
343
(-)a/t/db_dependent/Koha/Item.t (-3 / +7 lines)
Lines 37-42 use List::MoreUtils qw(all); Link Here
37
37
38
use t::lib::TestBuilder;
38
use t::lib::TestBuilder;
39
use t::lib::Mocks;
39
use t::lib::Mocks;
40
use t::lib::Dates;
40
41
41
my $schema  = Koha::Database->new->schema;
42
my $schema  = Koha::Database->new->schema;
42
my $builder = t::lib::TestBuilder->new;
43
my $builder = t::lib::TestBuilder->new;
Lines 765-771 subtest 'request_transfer' => sub { Link Here
765
};
766
};
766
767
767
subtest 'deletion' => sub {
768
subtest 'deletion' => sub {
768
    plan tests => 13;
769
    plan tests => 15;
769
770
770
    $schema->storage->txn_begin;
771
    $schema->storage->txn_begin;
771
772
Lines 776-784 subtest 'deletion' => sub { Link Here
776
            biblionumber => $biblio->biblionumber,
777
            biblionumber => $biblio->biblionumber,
777
        }
778
        }
778
    );
779
    );
780
    is( $item->deleted_on, undef, 'deleted_on not set for new item' );
779
781
780
    is( ref( $item->move_to_deleted ), 'Koha::Schema::Result::Deleteditem', 'Koha::Item->move_to_deleted should return the Deleted item' )
782
    my $deleted_item = $item->move_to_deleted;
783
    is( ref( $deleted_item ), 'Koha::Schema::Result::Deleteditem', 'Koha::Item->move_to_deleted should return the Deleted item' )
781
      ;    # FIXME This should be Koha::Deleted::Item
784
      ;    # FIXME This should be Koha::Deleted::Item
785
    is( t::lib::Dates::compare( $deleted_item->deleted_on, dt_from_string() ), 0 );
786
782
    is( Koha::Old::Items->search({itemnumber => $item->itemnumber})->count, 1, '->move_to_deleted must have moved the item to deleteditem' );
787
    is( Koha::Old::Items->search({itemnumber => $item->itemnumber})->count, 1, '->move_to_deleted must have moved the item to deleteditem' );
783
    $item = $builder->build_sample_item(
788
    $item = $builder->build_sample_item(
784
        {
789
        {
785
- 

Return to bug 30392