|
Lines 769-781
sub BatchCommitItems {
Link Here
|
| 769 |
my $duplicate_barcode = exists( $item->{'barcode'} ) && Koha::Items->find({ barcode => $item->{'barcode'} }); |
769 |
my $duplicate_barcode = exists( $item->{'barcode'} ) && Koha::Items->find({ barcode => $item->{'barcode'} }); |
| 770 |
my $duplicate_itemnumber = exists( $item->{'itemnumber'} ); |
770 |
my $duplicate_itemnumber = exists( $item->{'itemnumber'} ); |
| 771 |
|
771 |
|
| 772 |
my $updsth = $dbh->prepare("UPDATE import_items SET status = ?, itemnumber = ? WHERE import_items_id = ?"); |
772 |
my $updsth = $dbh->prepare("UPDATE import_items SET status = ?, itemnumber = ?, import_error = ? WHERE import_items_id = ?"); |
| 773 |
if ( $action eq "replace" && $duplicate_itemnumber ) { |
773 |
if ( $action eq "replace" && $duplicate_itemnumber ) { |
| 774 |
# Duplicate itemnumbers have precedence, that way we can update barcodes by overlaying |
774 |
# Duplicate itemnumbers have precedence, that way we can update barcodes by overlaying |
| 775 |
ModItemFromMarc( $item_marc, $biblionumber, $item->{itemnumber} ); |
775 |
ModItemFromMarc( $item_marc, $biblionumber, $item->{itemnumber} ); |
| 776 |
$updsth->bind_param( 1, 'imported' ); |
776 |
$updsth->bind_param( 1, 'imported' ); |
| 777 |
$updsth->bind_param( 2, $item->{itemnumber} ); |
777 |
$updsth->bind_param( 2, $item->{itemnumber} ); |
| 778 |
$updsth->bind_param( 3, $row->{'import_items_id'} ); |
778 |
$updsth->bind_param( 3, undef ); |
|
|
779 |
$updsth->bind_param( 4, $row->{'import_items_id'} ); |
| 779 |
$updsth->execute(); |
780 |
$updsth->execute(); |
| 780 |
$updsth->finish(); |
781 |
$updsth->finish(); |
| 781 |
$num_items_replaced++; |
782 |
$num_items_replaced++; |
|
Lines 784-797
sub BatchCommitItems {
Link Here
|
| 784 |
ModItemFromMarc( $item_marc, $biblionumber, $itemnumber ); |
785 |
ModItemFromMarc( $item_marc, $biblionumber, $itemnumber ); |
| 785 |
$updsth->bind_param( 1, 'imported' ); |
786 |
$updsth->bind_param( 1, 'imported' ); |
| 786 |
$updsth->bind_param( 2, $item->{itemnumber} ); |
787 |
$updsth->bind_param( 2, $item->{itemnumber} ); |
| 787 |
$updsth->bind_param( 3, $row->{'import_items_id'} ); |
788 |
$updsth->bind_param( 3, undef ); |
|
|
789 |
$updsth->bind_param( 4, $row->{'import_items_id'} ); |
| 788 |
$updsth->execute(); |
790 |
$updsth->execute(); |
| 789 |
$updsth->finish(); |
791 |
$updsth->finish(); |
| 790 |
$num_items_replaced++; |
792 |
$num_items_replaced++; |
| 791 |
} elsif ($duplicate_barcode) { |
793 |
} elsif ($duplicate_barcode) { |
| 792 |
$updsth->bind_param( 1, 'error' ); |
794 |
$updsth->bind_param( 1, 'error' ); |
| 793 |
$updsth->bind_param( 2, undef ); |
795 |
$updsth->bind_param( 2, undef ); |
| 794 |
$updsth->bind_param( 3, $row->{'import_items_id'} ); |
796 |
$updsth->bind_param( 3, 'duplicate item barcode' ); |
|
|
797 |
$updsth->bind_param( 4, $row->{'import_items_id'} ); |
| 795 |
$updsth->execute(); |
798 |
$updsth->execute(); |
| 796 |
$num_items_errored++; |
799 |
$num_items_errored++; |
| 797 |
} else { |
800 |
} else { |
| 798 |
- |
|
|