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 (-5 / +13 lines)
Lines 172-187 function confirm_deletion() { Link Here
172
                      <td>&nbsp;</td>
172
                      <td>&nbsp;</td>
173
                    [% ELSE %]
173
                    [% ELSE %]
174
                      <td>
174
                      <td>
175
                          <div class="dropdown">
176
                          <a class="btn btn-mini dropdown-toggle" id="itemactions[% item_loo.itemnumber %]" role="button" data-toggle="dropdown" href="#">
177
                              Actions <b class="caret"></b>
178
                          </a>
179
                          <ul class="dropdown-menu" role="menu" aria-labelledby="itemactions[% item_loo.itemnumber %]">
180
175
                        [% IF ( item_loo.hostitemflag ) %]
181
                        [% 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>
182
                              <li><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 %]&amp;searchid=[% searchid %]">Delink</a></li>
177
                        [% ELSE %]
183
                        [% ELSE %]
178
                          <a href="additem.pl?op=edititem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]#edititem">Edit</a>
184
                              <li><a href="additem.pl?op=edititem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]&amp;searchid=[% searchid %]#edititem">Edit</a></li>
185
                              <li><a href="additem.pl?op=dupeitem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]&amp;searchid=[% searchid %]#additema">Duplicate</a></li>
179
                          [% IF ( item_loo.countanalytics ) %]
186
                          [% IF ( item_loo.countanalytics ) %]
180
                            <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=% item_loo.itemnumber %]">View analytics</a>
187
                              <li><a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&amp;q=% item_loo.itemnumber %]">View analytics</a></li>
181
                          [% ELSE %]
188
                          [% ELSE %]
182
                            <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]" onclick="return confirm_deletion();">Delete</a>
189
                              <li><a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&amp;biblionumber=[% biblionumber %]&amp;itemnumber=[% item_loo.itemnumber %]&amp;searchid=[% searchid %]" onclick="return_confirm_deletion();">Delete</a></li>
183
                          [% END %]
190
                          [% END %]
184
                        [% END %]
191
                        [% END %]
192
                          </ul>
193
                          </div>
185
                      </td>
194
                      </td>
186
                    [% END %]
195
                    [% END %]
187
                [% FOREACH item_valu IN item_loo.item_value %]
196
                [% FOREACH item_valu IN item_loo.item_value %]
188
- 

Return to bug 7369