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 493-503
sub CheckItemPreSave {
Link Here
|
493 |
my %errors = (); |
494 |
my %errors = (); |
494 |
|
495 |
|
495 |
# check for duplicate barcode |
496 |
# check for duplicate barcode |
496 |
if (exists $item_ref->{'barcode'} and defined $item_ref->{'barcode'}) { |
497 |
if ( exists $item_ref->{'barcode'} and defined $item_ref->{'barcode'} ) { |
497 |
my $existing_item= Koha::Items->find({barcode => $item_ref->{'barcode'}}); |
498 |
my $barcode = C4::Circulation::barcodedecode( $item_ref->{'barcode'} ); |
|
|
499 |
my $existing_item = Koha::Items->find( { barcode => $barcode } ); |
498 |
if ($existing_item) { |
500 |
if ($existing_item) { |
499 |
if (!exists $item_ref->{'itemnumber'} # new item |
501 |
if ( |
500 |
or $item_ref->{'itemnumber'} != $existing_item->itemnumber) { # existing item |
502 |
!exists $item_ref->{'itemnumber'} # new item |
|
|
503 |
or $item_ref->{'itemnumber'} != $existing_item->itemnumber |
504 |
) |
505 |
{ # existing item |
501 |
$errors{'duplicate_barcode'} = $item_ref->{'barcode'}; |
506 |
$errors{'duplicate_barcode'} = $item_ref->{'barcode'}; |
502 |
} |
507 |
} |
503 |
} |
508 |
} |
504 |
- |
|
|