Bugzilla – Attachment 110903 Details for
Bug 26518
Adding a record can succeed even if adding the biblioitem fails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26518: Raise exception if the insert failed
Bug-26518-Raise-exception-if-the-insert-failed.patch (text/plain), 1.81 KB, created by
Jonathan Druart
on 2020-09-29 11:30:17 UTC
(
hide
)
Description:
Bug 26518: Raise exception if the insert failed
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-09-29 11:30:17 UTC
Size:
1.81 KB
patch
obsolete
>From b3aa103c1bbcd1c4ca2ff51407fd6c0f061f3de0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 29 Sep 2020 13:29:49 +0200 >Subject: [PATCH] Bug 26518: Raise exception if the insert failed > >--- > C4/Biblio.pm | 2 ++ > Koha/Exceptions.pm | 4 ++++ > 2 files changed, 6 insertions(+) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 1467eea479..36fea5e3ab 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -240,6 +240,7 @@ sub AddBiblio { > } > )->store; > $biblionumber = $biblio->biblionumber; >+ Koha::Exceptions::ObjectNotCreated->throw unless $biblio; > > my ($cn_sort) = GetClassSort( $olddata->{'biblioitems.cn_source'}, $olddata->{'cn_class'}, $olddata->{'cn_item'} ); > my $biblioitem = Koha::Biblioitem->new( >@@ -276,6 +277,7 @@ sub AddBiblio { > agerestriction => $olddata->{agerestriction}, > } > )->store; >+ Koha::Exceptions::ObjectNotCreated->throw unless $biblioitem; > $biblioitemnumber = $biblioitem->biblioitemnumber; > > _koha_marc_update_bib_ids( $record, $frameworkcode, $biblionumber, $biblioitemnumber ); >diff --git a/Koha/Exceptions.pm b/Koha/Exceptions.pm >index cf56b220ef..eec3baaa14 100644 >--- a/Koha/Exceptions.pm >+++ b/Koha/Exceptions.pm >@@ -18,6 +18,10 @@ use Exception::Class ( > isa => 'Koha::Exceptions::Exception', > description => 'The required object doesn\'t exist', > }, >+ 'Koha::Exceptions::ObjectNotCreated' => { >+ isa => 'Koha::Exceptions::Exception', >+ description => 'The object have not been created', >+ }, > 'Koha::Exceptions::CannotDeleteDefault' => { > isa => 'Koha::Exceptions::Exception', > description => 'The default value cannot be deleted' >-- >2.20.1
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 26518
:
110902
|
110903
|
111387
|
111389
|
111512
|
111513
|
111514
|
111515
|
113046
|
113671
|
113672
|
113673
|
113674
|
113917
|
113918
|
113919
|
113920
|
113921