Bug 26518: Move BiblioAutoLink within the transaction
We don't want the authorities to be created if the biblio insert fails
later
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 9038cdd9a4)
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
parent
089c12ec09
commit
b68261d3c3
19
C4/Biblio.pm
19
C4/Biblio.pm
|
|
@ -206,20 +206,19 @@ sub AddBiblio {
|
|||
$defer_marc_save = 1;
|
||||
}
|
||||
|
||||
if (C4::Context->preference('BiblioAddsAuthorities')) {
|
||||
BiblioAutoLink( $record, $frameworkcode );
|
||||
}
|
||||
|
||||
my ( $biblionumber, $biblioitemnumber, $error );
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
# transform the data into koha-table style data
|
||||
SetUTF8Flag($record);
|
||||
my $olddata = TransformMarcToKoha( $record, $frameworkcode );
|
||||
my $schema = Koha::Database->schema;
|
||||
my ( $biblionumber, $biblioitemnumber );
|
||||
try {
|
||||
$schema->txn_do(sub {
|
||||
|
||||
if (C4::Context->preference('BiblioAddsAuthorities')) {
|
||||
BiblioAutoLink( $record, $frameworkcode );
|
||||
}
|
||||
|
||||
# transform the data into koha-table style data
|
||||
SetUTF8Flag($record);
|
||||
my $olddata = TransformMarcToKoha( $record, $frameworkcode );
|
||||
|
||||
my $biblio = Koha::Biblio->new(
|
||||
{
|
||||
frameworkcode => $frameworkcode,
|
||||
|
|
|
|||
Loading…
Reference in New Issue