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