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

(-)a/Koha/Old/Biblio.pm (-1 / +6 lines)
Lines 25-30 use Koha::Biblioitem; Link Here
25
use Koha::Biblio::Metadata;
25
use Koha::Biblio::Metadata;
26
use Koha::Old::Biblio::Metadatas;
26
use Koha::Old::Biblio::Metadatas;
27
use Koha::Old::Biblioitems;
27
use Koha::Old::Biblioitems;
28
use Koha::SearchEngine::Indexer;
28
29
29
=head1 NAME
30
=head1 NAME
30
31
Lines 140-146 sub to_api_mapping { Link Here
140
141
141
Restores the deleted biblio record back to the biblio table along with
142
Restores the deleted biblio record back to the biblio table along with
142
its biblioitems and metadata. This removes the record from the deleted tables
143
its biblioitems and metadata. This removes the record from the deleted tables
143
and re-inserts it into the active tables.
144
and re-inserts it into the active tables. The biblio record will be reindexed
145
after restoration.
144
146
145
Returns the newly restored Koha::Biblio object.
147
Returns the newly restored Koha::Biblio object.
146
148
Lines 169-174 sub restore { Link Here
169
    $biblioitem->delete;
171
    $biblioitem->delete;
170
    $self->delete;
172
    $self->delete;
171
173
174
    my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
175
    $indexer->index_records( $new_biblio->biblionumber, "specialUpdate", "biblioserver" );
176
172
    return $new_biblio;
177
    return $new_biblio;
173
}
178
}
174
179
(-)a/Koha/Old/Item.pm (-1 / +14 lines)
Lines 19-25 use Modern::Perl; Link Here
19
19
20
use base qw(Koha::Object);
20
use base qw(Koha::Object);
21
21
22
use Koha::Biblio;
23
use Koha::Exceptions;
22
use Koha::Item;
24
use Koha::Item;
25
use Koha::SearchEngine::Indexer;
23
26
24
=head1 NAME
27
=head1 NAME
25
28
Lines 37-42 Koha::Old::Item - Koha Old::Item Object class Link Here
37
40
38
Restores the deleted item record back to the items table. This removes
41
Restores the deleted item record back to the items table. This removes
39
the record from the deleteditems table and re-inserts it into the items table.
42
the record from the deleteditems table and re-inserts it into the items table.
43
The biblio record will be reindexed after restoration.
44
45
Throws an exception if the biblio record does not exist.
40
46
41
Returns the newly restored Koha::Item object.
47
Returns the newly restored Koha::Item object.
42
48
Lines 45-50 Returns the newly restored Koha::Item object. Link Here
45
sub restore {
51
sub restore {
46
    my ($self) = @_;
52
    my ($self) = @_;
47
53
54
    my $biblio = Koha::Biblios->find( $self->biblionumber );
55
56
    Koha::Exceptions::ObjectNotFound->throw("Bibliographic record not found for item")
57
        unless $biblio;
58
48
    my $item_data = $self->unblessed;
59
    my $item_data = $self->unblessed;
49
    delete $item_data->{deleted_on};
60
    delete $item_data->{deleted_on};
50
61
Lines 52-57 sub restore { Link Here
52
63
53
    $self->delete;
64
    $self->delete;
54
65
66
    my $indexer = Koha::SearchEngine::Indexer->new( { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
67
    $indexer->index_records( $new_item->biblionumber, "specialUpdate", "biblioserver" );
68
55
    return $new_item;
69
    return $new_item;
56
}
70
}
57
71
58
- 

Return to bug 17387