Bug 36473: Handle Invalid Metadata Exceptions in totalissues.pl
This patch wraps the call for record in an eval, and catches any invalid metadata
exceptions, letting the warning show, but allowing the script to continue
To test:
1 - In default KTD record 369 has problems, otherwise you need to break a record
2 - Run : misc/cronjobs/update_totalissues.pl --use-stats --commit=1000 -v
3 - It dies at record 369 (or the one you broke)
4 - Apply patch
5 - Run again
6 - It succeeds, but skips the bad record
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f3d2f34d7a
)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
d80334a108
commit
d397da65c0
1 changed files with 6 additions and 3 deletions
|
@ -3033,9 +3033,12 @@ sub UpdateTotalIssues {
|
|||
return;
|
||||
}
|
||||
|
||||
my $record = $biblio->metadata->record;
|
||||
unless ($record) {
|
||||
carp "UpdateTotalIssues could not get biblio record";
|
||||
my $record;
|
||||
eval { $record = $biblio->metadata->record };
|
||||
if ($@) {
|
||||
my $exception = $@;
|
||||
$exception->rethrow unless ( $exception->isa('Koha::Exceptions::Metadata::Invalid') );
|
||||
warn "UpdateTotalIssues could not get bibliographic record";
|
||||
return;
|
||||
}
|
||||
my $biblioitem = $biblio->biblioitem;
|
||||
|
|
Loading…
Reference in a new issue