Bugzilla – Attachment 113672 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.86 KB, created by
Victor Grousset/tuxayo
on 2020-11-16 16:37:27 UTC
(
hide
)
Description:
Bug 26518: Raise exception if the insert failed
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2020-11-16 16:37:27 UTC
Size:
1.86 KB
patch
obsolete
>From b4adbc0d5d05d51a2d51d093bc65e19ce6bb10f0 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 > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > C4/Biblio.pm | 2 ++ > Koha/Exceptions.pm | 4 ++++ > 2 files changed, 6 insertions(+) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 54046f37e1..d3360b7898 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.29.2
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