Lines 45-50
BEGIN {
Link Here
|
45 |
} |
45 |
} |
46 |
|
46 |
|
47 |
use Carp qw( croak ); |
47 |
use Carp qw( croak ); |
|
|
48 |
use C4::Circulation qw( barcodedecode ); |
48 |
use C4::Context; |
49 |
use C4::Context; |
49 |
use C4::Koha; |
50 |
use C4::Koha; |
50 |
use C4::Biblio qw( GetMarcStructure TransformMarcToKoha ); |
51 |
use C4::Biblio qw( GetMarcStructure TransformMarcToKoha ); |
Lines 459-469
sub CheckItemPreSave {
Link Here
|
459 |
my %errors = (); |
460 |
my %errors = (); |
460 |
|
461 |
|
461 |
# check for duplicate barcode |
462 |
# check for duplicate barcode |
462 |
if (exists $item_ref->{'barcode'} and defined $item_ref->{'barcode'}) { |
463 |
if ( exists $item_ref->{'barcode'} and defined $item_ref->{'barcode'} ) { |
463 |
my $existing_item= Koha::Items->find({barcode => $item_ref->{'barcode'}}); |
464 |
my $barcode = C4::Circulation::barcodedecode( $item_ref->{'barcode'} ); |
|
|
465 |
my $existing_item = Koha::Items->find( { barcode => $barcode } ); |
464 |
if ($existing_item) { |
466 |
if ($existing_item) { |
465 |
if (!exists $item_ref->{'itemnumber'} # new item |
467 |
if ( |
466 |
or $item_ref->{'itemnumber'} != $existing_item->itemnumber) { # existing item |
468 |
!exists $item_ref->{'itemnumber'} # new item |
|
|
469 |
or $item_ref->{'itemnumber'} != $existing_item->itemnumber |
470 |
) |
471 |
{ # existing item |
467 |
$errors{'duplicate_barcode'} = $item_ref->{'barcode'}; |
472 |
$errors{'duplicate_barcode'} = $item_ref->{'barcode'}; |
468 |
} |
473 |
} |
469 |
} |
474 |
} |
470 |
- |
|
|