Lines 536-543
if ($op eq "additem") {
Link Here
|
536 |
|
536 |
|
537 |
use C4::Barcodes; |
537 |
use C4::Barcodes; |
538 |
my $barcodeobj = C4::Barcodes->new; |
538 |
my $barcodeobj = C4::Barcodes->new; |
|
|
539 |
my $copynumber = $addedolditem->{'copynumber'}; |
539 |
my $oldbarcode = $addedolditem->{'barcode'}; |
540 |
my $oldbarcode = $addedolditem->{'barcode'}; |
540 |
my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); |
541 |
my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); |
|
|
542 |
my ($copytagfield,$copytagsubfield) = &GetMarcFromKohaField("items.copynumber",$frameworkcode); |
541 |
|
543 |
|
542 |
# If there is a barcode and we can't find their new values, we can't add multiple copies |
544 |
# If there is a barcode and we can't find their new values, we can't add multiple copies |
543 |
my $testbarcode; |
545 |
my $testbarcode; |
Lines 571-576
if ($op eq "additem") {
Link Here
|
571 |
# Checking if the barcode already exists |
573 |
# Checking if the barcode already exists |
572 |
$exist_itemnumber = get_item_from_barcode($barcodevalue); |
574 |
$exist_itemnumber = get_item_from_barcode($barcodevalue); |
573 |
} |
575 |
} |
|
|
576 |
# Updating record with the new copynumber |
577 |
if ( $copynumber ){ |
578 |
$record->field($copytagfield)->update($copytagsubfield => $copynumber); |
579 |
} |
574 |
|
580 |
|
575 |
# Adding the item |
581 |
# Adding the item |
576 |
if (!$exist_itemnumber) { |
582 |
if (!$exist_itemnumber) { |
Lines 581-586
if ($op eq "additem") {
Link Here
|
581 |
# That way, all items are added, even if there was some already existing barcodes |
587 |
# That way, all items are added, even if there was some already existing barcodes |
582 |
# FIXME : Please note that there is a risk of infinite loop here if we never find a suitable barcode |
588 |
# FIXME : Please note that there is a risk of infinite loop here if we never find a suitable barcode |
583 |
$i++; |
589 |
$i++; |
|
|
590 |
# Only increment copynumber if item was really added |
591 |
$copynumber++ if ( $copynumber && $copynumber =~ m/^\d+$/ ); |
584 |
} |
592 |
} |
585 |
|
593 |
|
586 |
# Preparing the next iteration |
594 |
# Preparing the next iteration |
587 |
- |
|
|