From 7aebc8a9ac600a61180e7f2e4026103d96fc4c6b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 10 Jan 2022 11:22:54 +0100 Subject: [PATCH] Bug 28152: Log the "duplicate item barcode" error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Looking at the code this 'import_error' column is empty for the last 9 years. Not sure it makes much sense to have this single error now. commit 1dba9c6409d78cb1f90de6c1300cb5b63fb1b851 Date: Wed Oct 10 14:21:22 2012 -0500 Bug 7131: teach MARC import how to overlay items Signed-off-by: Joonas Kylmälä Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 3c0c375d8e073c9eb765179fa7b3c3d0136b5174) Signed-off-by: Lucas Gass (cherry picked from commit 2d19940f7e6a3b50e3dedee909a419cf1923a2e4) Signed-off-by: Arthur Suzuki --- C4/ImportBatch.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index d0f4c7d928..1bc4ab46da 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -769,13 +769,14 @@ sub BatchCommitItems { my $duplicate_barcode = exists( $item->{'barcode'} ) && Koha::Items->find({ barcode => $item->{'barcode'} }); my $duplicate_itemnumber = exists( $item->{'itemnumber'} ); - my $updsth = $dbh->prepare("UPDATE import_items SET status = ?, itemnumber = ? WHERE import_items_id = ?"); + my $updsth = $dbh->prepare("UPDATE import_items SET status = ?, itemnumber = ?, import_error = ? WHERE import_items_id = ?"); if ( $action eq "replace" && $duplicate_itemnumber ) { # Duplicate itemnumbers have precedence, that way we can update barcodes by overlaying ModItemFromMarc( $item_marc, $biblionumber, $item->{itemnumber} ); $updsth->bind_param( 1, 'imported' ); $updsth->bind_param( 2, $item->{itemnumber} ); - $updsth->bind_param( 3, $row->{'import_items_id'} ); + $updsth->bind_param( 3, undef ); + $updsth->bind_param( 4, $row->{'import_items_id'} ); $updsth->execute(); $updsth->finish(); $num_items_replaced++; @@ -784,14 +785,16 @@ sub BatchCommitItems { ModItemFromMarc( $item_marc, $biblionumber, $itemnumber ); $updsth->bind_param( 1, 'imported' ); $updsth->bind_param( 2, $item->{itemnumber} ); - $updsth->bind_param( 3, $row->{'import_items_id'} ); + $updsth->bind_param( 3, undef ); + $updsth->bind_param( 4, $row->{'import_items_id'} ); $updsth->execute(); $updsth->finish(); $num_items_replaced++; } elsif ($duplicate_barcode) { $updsth->bind_param( 1, 'error' ); $updsth->bind_param( 2, undef ); - $updsth->bind_param( 3, $row->{'import_items_id'} ); + $updsth->bind_param( 3, 'duplicate item barcode' ); + $updsth->bind_param( 4, $row->{'import_items_id'} ); $updsth->execute(); $num_items_errored++; } else { @@ -803,7 +806,8 @@ sub BatchCommitItems { if( $itemnumber ) { $updsth->bind_param( 1, 'imported' ); $updsth->bind_param( 2, $itemnumber ); - $updsth->bind_param( 3, $row->{'import_items_id'} ); + $updsth->bind_param( 3, undef ); + $updsth->bind_param( 4, $row->{'import_items_id'} ); $updsth->execute(); $updsth->finish(); $num_items_added++; -- 2.39.2