Bugzilla – Attachment 44524 Details for
Bug 7369
Ability to duplicate existing items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7369 - duplicate item and add dropdown buttons for item actions
Bug-7369---duplicate-item-and-add-dropdown-buttons.patch (text/plain), 6.54 KB, created by
Nick Clemens (kidclamp)
on 2015-11-05 18:57:43 UTC
(
hide
)
Description:
Bug 7369 - duplicate item and add dropdown buttons for item actions
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2015-11-05 18:57:43 UTC
Size:
6.54 KB
patch
obsolete
>From f0aa60ff125916d91811eb338fe3a359c7349021 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@quecheelibrary.org> >Date: Sat, 21 Mar 2015 12:27:04 -0400 >Subject: [PATCH] Bug 7369 - duplicate item and add dropdown buttons for item > actions > >This patch adds a link to duplicate existing items on the edit items screen > >To test: >1 - Apply patch >2 - navigate to the edit items screen for a record with existing items >3 - click the duplicate link and ensure item info but not barcode are carried over >4 - save the item and ensure it is added correctly >5 - check that all previous functionality on page works as before > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > cataloguing/additem.pl | 34 ++++++++++++++++++++++ > .../prog/en/modules/cataloguing/additem.tt | 17 ++++++++--- > 2 files changed, 47 insertions(+), 4 deletions(-) > >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index b74605a..db09984 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -585,6 +585,40 @@ if ($op eq "additem") { > $itemrecord = C4::Items::GetMarcItem($biblionumber,$itemnumber); > $nextop = "saveitem"; > #------------------------------------------------------------------------------- >+} elsif ($op eq "dupeitem") { >+#------------------------------------------------------------------------------- >+# retrieve item if exist => then, it's a modif >+ $itemrecord = C4::Items::GetMarcItem($biblionumber,$itemnumber); >+ if (C4::Context->preference('autoBarcode') eq 'incremental') { >+ $itemrecord = _increment_barcode($itemrecord, $frameworkcode); >+ } >+ else { >+ # we have to clear the barcode field in the duplicate item record to make way for the new one generated by the javascript plugin >+ my ($tagfield,$tagsubfield) = &GetMarcFromKohaField("items.barcode",$frameworkcode); >+ my $fieldItem = $itemrecord->field($tagfield); >+ $itemrecord->delete_field($fieldItem); >+ $fieldItem->delete_subfields($tagsubfield); >+ $itemrecord->insert_fields_ordered($fieldItem); >+ } >+ >+ #check for hidden subfield and remove them for the duplicated item >+ foreach my $field ($itemrecord->fields()){ >+ my $tag = $field->{_tag}; >+ foreach my $subfield ($field->subfields()){ >+ my $subfieldtag = $subfield->[0]; >+ if (subfield_is_koha_internal_p($subfieldtag) || $tagslib->{$tag}->{$subfieldtag}->{'tab'} ne "10" >+ || abs($tagslib->{$tag}->{$subfieldtag}->{hidden})>4 ){ >+ my $fieldItem = $itemrecord->field($tag); >+ $itemrecord->delete_field($fieldItem); >+ $fieldItem->delete_subfields($subfieldtag); >+ $itemrecord->insert_fields_ordered($fieldItem); >+ } >+ } >+ } >+ >+ $itemrecord = removeFieldsForPrefill($itemrecord) if ($prefillitem); >+ $nextop = "additem"; >+#------------------------------------------------------------------------------- > } elsif ($op eq "delitem") { > #------------------------------------------------------------------------------- > # check that there is no issue on this item before deletion. >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >index 1b0e317..c84cf60 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt >@@ -172,16 +172,25 @@ function confirm_deletion() { > <td> </td> > [% ELSE %] > <td> >+ <div class="dropdown"> >+ <a class="btn btn-mini dropdown-toggle" id="itemactions[% item_loo.itemnumber %]" role="button" data-toggle="dropdown" href="#"> >+ Actions <b class="caret"></b> >+ </a> >+ <ul class="dropdown-menu" role="menu" aria-labelledby="itemactions[% item_loo.itemnumber %]"> >+ > [% IF ( item_loo.hostitemflag ) %] >- <a href="additem.pl?op=edititem&biblionumber=[% item_loo.hostbiblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a> <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&biblionumber=[% biblionumber %]&hostitemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]">Delink</a> >+ <li><a href="additem.pl?op=edititem&biblionumber=[% item_loo.hostbiblionumber %]&itemnumber=[% item_loo.itemnumber %]#edititem">Edit in host</a> <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delinkitem&biblionumber=[% biblionumber %]&hostitemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]">Delink</a></li> > [% ELSE %] >- <a href="additem.pl?op=edititem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]#edititem">Edit</a> >+ <li><a href="additem.pl?op=edititem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]#edititem">Edit</a></li> >+ <li><a href="additem.pl?op=dupeitem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]#additema">Duplicate</a></li> > [% IF ( item_loo.countanalytics ) %] >- <a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&q=% item_loo.itemnumber %]">View analytics</a> >+ <li><a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&q=% item_loo.itemnumber %]">View analytics</a></li> > [% ELSE %] >- <a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]" onclick="return confirm_deletion();">Delete</a> >+ <li><a class="delete" href="/cgi-bin/koha/cataloguing/additem.pl?op=delitem&biblionumber=[% biblionumber %]&itemnumber=[% item_loo.itemnumber %]&searchid=[% searchid %]" onclick="return_confirm_deletion();">Delete</a></li> > [% END %] > [% END %] >+ </ul> >+ </div> > </td> > [% END %] > [% FOREACH item_valu IN item_loo.item_value %] >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7369
:
37080
|
37352
|
37496
|
37498
|
37502
|
37503
|
37504
|
37505
|
37506
|
37507
|
37655
|
37656
|
44522
|
44523
| 44524