Bugzilla – Attachment 88894 Details for
Bug 15496
Delete bibliographic record after moving last item to another record(s)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15496: Delete Bib After Moving Item
Bug-15496-Delete-Bib-After-Moving-Item.patch (text/plain), 5.16 KB, created by
Kyle M Hall (khall)
on 2019-04-26 11:22:41 UTC
(
hide
)
Description:
Bug 15496: Delete Bib After Moving Item
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-04-26 11:22:41 UTC
Size:
5.16 KB
patch
obsolete
>From 115fecefab1c0a9001cb98ebc8fa1fc31dec9eae Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 12 Apr 2019 13:50:32 -0400 >Subject: [PATCH] Bug 15496: Delete Bib After Moving Item > >Librarians have requested the ability to delete records with no items >quickly and easily from the "Attach item" results page as items are >moved from one record to another. > >Test Plan: >1) Apply this patch >2) Create 2 records with 2 items each >3) Move one item from record A to record B >4) You should see no change from pre-patch behavior >5) Move the second item from record A to record B >6) You should now see a "Delete record" button >7) Click the button >8) Note the record in question has been deleted > >Signed-off-by: Liz Rea <wizzyrea@gmail.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Biblio.pm | 9 +---- > cataloguing/moveitem.pl | 5 ++- > .../prog/en/modules/cataloguing/moveitem.tt | 39 +++++++++++++++++++ > 3 files changed, 45 insertions(+), 8 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index b535649b25..688edc85ae 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -350,11 +350,9 @@ sub article_requests_finished { > > =head3 items > >-my @items = $biblio->items(); > my $items = $biblio->items(); > >-Returns the related Koha::Items object for this biblio in scalar context, >-or list of Koha::Item objects in list context. >+Returns the related Koha::Items object for this biblio > > =cut > >@@ -363,10 +361,7 @@ sub items { > > my $items_rs = $self->_result->items; > >- return >- wantarray >- ? Koha::Items->_new_from_dbic($items_rs)->as_list >- : Koha::Items->_new_from_dbic($items_rs); >+ return Koha::Items->_new_from_dbic( $items_rs ); > } > > =head3 itemtype >diff --git a/cataloguing/moveitem.pl b/cataloguing/moveitem.pl >index 49641f45e2..697057ef03 100755 >--- a/cataloguing/moveitem.pl >+++ b/cataloguing/moveitem.pl >@@ -77,7 +77,10 @@ if ( $barcode && $biblionumber ) { > > my $moveresult = MoveItemFromBiblio( $itemnumber, $frombiblionumber, $biblionumber ); > if ($moveresult) { >- $template->param( success => 1 ); >+ $template->param( >+ success => 1, >+ from_biblio => scalar Koha::Biblios->find($frombiblionumber), >+ ); > } > else { > $template->param( >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt >index b5470f4191..cc163c0335 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/moveitem.tt >@@ -1,3 +1,4 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Cataloging › Attach an item to [% bibliotitle | html %]</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -51,6 +52,19 @@ > > [% ELSE %] > [% IF ( success ) %] >+ [% IF from_biblio.items.count == 0 %] >+ <div class="dialog alert"> >+ The record <em>[% from_biblio.title | html %]</em> has [% from_biblio.items.count | html %] attached items. >+ <p> >+ <button id="delete-biblio-btn" data-biblionumber="[% from_biblio.id | html %]"><i id="del-bib-spn" class="fa fa-spinner fa-pulse fa-fw" style="display:none"></i><i class="fa fa-fw fa-trash"></i> Delete record >+ </button> >+ <span id="del-bib-success" style="display:none">Record deleted</span> >+ <span id="del-bib-failure" style="display:none">Attempt to delete record failed.</span> >+ </p> >+ </div> >+ <br/> >+ [% END %] >+ > <div class="dialog message">The item has successfully been attached to [% INCLUDE 'biblio-default-view.inc' %]<i>[% bibliotitle | html %]</i></a>. > <p> > [% INCLUDE actions %] >@@ -62,6 +76,7 @@ > <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" /> > </form> > </p> >+ > </div> > [% ELSE %] > [% IF ( missingparameter ) %] >@@ -97,4 +112,28 @@ > </div> > </div> > >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript"> >+ $("#delete-biblio-btn").on("click", function(){ >+ if ( confirm(_("Are you sure you want to delete this record?")) ) { >+ let btn = $(this); >+ $("#del-bib-spn").show(); >+ let biblionumber = $(this).data('biblionumber'); >+ $.ajax({ >+ url: '/api/v1/biblios/' + biblionumber, >+ type: 'DELETE', >+ success: function(result) { >+ btn.hide(); >+ $('#del-bib-success').show(); >+ }, >+ error: function(result) { >+ btn.hide(); >+ $('#del-bib-failure').show(); >+ } >+ }); >+ } >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >-- >2.20.1 (Apple Git-117)
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 15496
:
88004
|
88005
|
88006
|
88008
|
88015
|
88016
|
88017
|
88018
|
88019
|
88020
|
88026
|
88027
|
88028
|
88029
|
88030
|
88031
|
88032
|
88165
|
88166
|
88167
|
88168
|
88169
|
88170
|
88171
|
88172
|
88215
|
88225
|
88226
|
88227
|
88228
|
88229
|
88230
|
88892
|
88893
| 88894 |
88895
|
88896
|
88897
|
88903
|
88905
|
88920
|
88938
|
88950