Lines 566-571
if ($op eq "additem") {
Link Here
|
566 |
$itemrecord = C4::Items::GetMarcItem($biblionumber,$itemnumber); |
566 |
$itemrecord = C4::Items::GetMarcItem($biblionumber,$itemnumber); |
567 |
$nextop = "saveitem"; |
567 |
$nextop = "saveitem"; |
568 |
#------------------------------------------------------------------------------- |
568 |
#------------------------------------------------------------------------------- |
|
|
569 |
} elsif ($op eq "dupeitem") { |
570 |
#------------------------------------------------------------------------------- |
571 |
# retrieve item if exist => then, it's a modif |
572 |
$itemrecord = C4::Items::GetMarcItem($biblionumber,$itemnumber); |
573 |
if (C4::Context->preference('autoBarcode') eq 'incremental') { |
574 |
$itemrecord = _increment_barcode($itemrecord, $frameworkcode); |
575 |
} |
576 |
else { |
577 |
# we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin |
578 |
my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); |
579 |
my $fieldItem = $itemrecord->field($tagfield); |
580 |
$itemrecord->delete_field($fieldItem); |
581 |
$fieldItem->delete_subfields($tagsubfield); |
582 |
$itemrecord->insert_fields_ordered($fieldItem); |
583 |
} |
584 |
|
585 |
#check for hidden subfield and remove them for the duplicated item |
586 |
foreach my $field ($itemrecord->fields()){ |
587 |
my $tag = $field->{_tag}; |
588 |
foreach my $subfield ($field->subfields()){ |
589 |
my $subfieldtag = $subfield->[0]; |
590 |
if (subfield_is_koha_internal_p($subfieldtag) || $tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10" |
591 |
|| abs($tagslib->{$tag}->{$subfieldtag}->{hidden})>4 ){ |
592 |
my $fieldItem = $itemrecord->field($tag); |
593 |
$itemrecord->delete_field($fieldItem); |
594 |
$fieldItem->delete_subfields($subfieldtag); |
595 |
$itemrecord->insert_fields_ordered($fieldItem); |
596 |
} |
597 |
} |
598 |
} |
599 |
|
600 |
$itemrecord = removeFieldsForPrefill($itemrecord) if ($prefillitem); |
601 |
$nextop = "additem"; |
602 |
#------------------------------------------------------------------------------- |
569 |
} elsif ($op eq "delitem") { |
603 |
} elsif ($op eq "delitem") { |
570 |
#------------------------------------------------------------------------------- |
604 |
#------------------------------------------------------------------------------- |
571 |
# check that there is no issue on this item before deletion. |
605 |
# check that there is no issue on this item before deletion. |