|
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 |
- |
|
|