|
Lines 456-462
if ($op eq "additem") {
Link Here
|
| 456 |
} |
456 |
} |
| 457 |
|
457 |
|
| 458 |
# if autoBarcode is set to 'incremental', calculate barcode... |
458 |
# if autoBarcode is set to 'incremental', calculate barcode... |
| 459 |
if ( not $item->barcode && C4::Context->preference('autoBarcode') eq 'incremental' ) { |
459 |
if ( ! defined $item->barcode && C4::Context->preference('autoBarcode') eq 'incremental' ) { |
| 460 |
my ( $barcode ) = C4::Barcodes::ValueBuilder::incremental::get_barcode; |
460 |
my ( $barcode ) = C4::Barcodes::ValueBuilder::incremental::get_barcode; |
| 461 |
$item->barcode($barcode); |
461 |
$item->barcode($barcode); |
| 462 |
} |
462 |
} |
|
Lines 465-471
if ($op eq "additem") {
Link Here
|
| 465 |
if ( $add_submit || $prefillitem) { |
465 |
if ( $add_submit || $prefillitem) { |
| 466 |
|
466 |
|
| 467 |
# check for item barcode # being unique |
467 |
# check for item barcode # being unique |
| 468 |
if ( Koha::Items->search({ barcode => $item->barcode })->count ) { |
468 |
if ( defined $item->barcode |
|
|
469 |
&& Koha::Items->search( { barcode => $item->barcode } )->count ) |
| 470 |
{ |
| 469 |
# if barcode exists, don't create, but report The problem. |
471 |
# if barcode exists, don't create, but report The problem. |
| 470 |
push @errors, "barcode_not_unique"; |
472 |
push @errors, "barcode_not_unique"; |
| 471 |
|
473 |
|
|
Lines 712-718
if ($op eq "additem") {
Link Here
|
| 712 |
} |
714 |
} |
| 713 |
|
715 |
|
| 714 |
# check that the barcode don't exist already |
716 |
# check that the barcode don't exist already |
| 715 |
if ( Koha::Items->search({ barcode => $item->barcode, itemnumber => { '!=' => $item->itemnumber } })->count ) { |
717 |
if ( |
|
|
718 |
defined $item->barcode |
| 719 |
&& Koha::Items->search( |
| 720 |
{ |
| 721 |
barcode => $item->barcode, |
| 722 |
itemnumber => { '!=' => $item->itemnumber } |
| 723 |
} |
| 724 |
)->count |
| 725 |
) |
| 726 |
{ |
| 716 |
# FIXME We shouldn't need that, ->store would explode as there is a unique constraint on items.barcode |
727 |
# FIXME We shouldn't need that, ->store would explode as there is a unique constraint on items.barcode |
| 717 |
push @errors,"barcode_not_unique"; |
728 |
push @errors,"barcode_not_unique"; |
| 718 |
$current_item = $item->unblessed; # Restore edit form for the same item |
729 |
$current_item = $item->unblessed; # Restore edit form for the same item |
| 719 |
- |
|
|