View | Details | Raw Unified | Return to bug 7369
Collapse All | Expand All

(-)a/cataloguing/additem.pl (+34 lines)
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.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-2 / +2 lines)
Lines 175-181 function confirm_deletion() { Link Here
175
                        [% IF ( item_loo.hostitemflag ) %]
175
                        [% IF ( item_loo.hostitemflag ) %]
176
                          <a href="additem.pl?op=edititem&amp;biblionumber=[% item_loo.hostbiblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a> &nbsp; <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&amp;biblionumber=[% biblionumber %]&amp;hostitemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]">Delink</a>
176
                          <a href="additem.pl?op=edititem&amp;biblionumber=[% item_loo.hostbiblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a> &nbsp; <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&amp;biblionumber=[% biblionumber %]&amp;hostitemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]">Delink</a>
177
                        [% ELSE %]
177
                        [% ELSE %]
178
                          <a href="additem.pl?op=edititem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]#edititem">Edit</a>
178
                          <a href="additem.pl?op=edititem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]&amp;searchid=[% searchid %]#edititem">Edit</a>
179
                          <a href="additem.pl?op=dupeitem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]&amp;searchid=[% searchid %]#additema">Duplicate</a>
179
                          [% IF ( item_loo.countanalytics ) %]
180
                          [% IF ( item_loo.countanalytics ) %]
180
                            <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=% item_loo.itemnumber %]">View analytics</a>
181
                            <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=% item_loo.itemnumber %]">View analytics</a>
181
                          [% ELSE %]
182
                          [% ELSE %]
182
- 

Return to bug 7369