Lines 585-590
if ($op eq "additem") {
Link Here
|
585 |
$itemrecord = C4::Items::GetMarcItem($biblionumber,$itemnumber); |
585 |
$itemrecord = C4::Items::GetMarcItem($biblionumber,$itemnumber); |
586 |
$nextop = "saveitem"; |
586 |
$nextop = "saveitem"; |
587 |
#------------------------------------------------------------------------------- |
587 |
#------------------------------------------------------------------------------- |
|
|
588 |
} elsif ($op eq "dupeitem") { |
589 |
#------------------------------------------------------------------------------- |
590 |
# retrieve item if exist => then, it's a modif |
591 |
$itemrecord = C4::Items::GetMarcItem($biblionumber,$itemnumber); |
592 |
if (C4::Context->preference('autoBarcode') eq 'incremental') { |
593 |
$itemrecord = _increment_barcode($itemrecord, $frameworkcode); |
594 |
} |
595 |
else { |
596 |
# we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin |
597 |
my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); |
598 |
my $fieldItem = $itemrecord->field($tagfield); |
599 |
$itemrecord->delete_field($fieldItem); |
600 |
$fieldItem->delete_subfields($tagsubfield); |
601 |
$itemrecord->insert_fields_ordered($fieldItem); |
602 |
} |
603 |
|
604 |
#check for hidden subfield and remove them for the duplicated item |
605 |
foreach my $field ($itemrecord->fields()){ |
606 |
my $tag = $field->{_tag}; |
607 |
foreach my $subfield ($field->subfields()){ |
608 |
my $subfieldtag = $subfield->[0]; |
609 |
if (subfield_is_koha_internal_p($subfieldtag) || $tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10" |
610 |
|| abs($tagslib->{$tag}->{$subfieldtag}->{hidden})>4 ){ |
611 |
my $fieldItem = $itemrecord->field($tag); |
612 |
$itemrecord->delete_field($fieldItem); |
613 |
$fieldItem->delete_subfields($subfieldtag); |
614 |
$itemrecord->insert_fields_ordered($fieldItem); |
615 |
} |
616 |
} |
617 |
} |
618 |
|
619 |
$itemrecord = removeFieldsForPrefill($itemrecord) if ($prefillitem); |
620 |
$nextop = "additem"; |
621 |
#------------------------------------------------------------------------------- |
588 |
} elsif ($op eq "delitem") { |
622 |
} elsif ($op eq "delitem") { |
589 |
#------------------------------------------------------------------------------- |
623 |
#------------------------------------------------------------------------------- |
590 |
# check that there is no issue on this item before deletion. |
624 |
# check that there is no issue on this item before deletion. |