Bugzilla – Attachment 82237 Details for
Bug 17674
Allow UI to delete serials issues in batch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17674: Allow UI to delete serials in batch
Bug-17674-Allow-UI-to-delete-serials-in-batch.patch (text/plain), 7.14 KB, created by
Pierre-Marc Thibault
on 2018-11-12 18:09:31 UTC
(
hide
)
Description:
Bug 17674: Allow UI to delete serials in batch
Filename:
MIME Type:
Creator:
Pierre-Marc Thibault
Created:
2018-11-12 18:09:31 UTC
Size:
7.14 KB
patch
obsolete
>From 0229a9af3bade6f275fe000f857967a5e57aa371 Mon Sep 17 00:00:00 2001 >From: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com> >Date: Wed, 10 Oct 2018 11:25:59 -0400 >Subject: [PATCH] Bug 17674: Allow UI to delete serials in batch > >This new feature allows for batch deletion of serials through the UI. The current usage is a one-by-one long game. > >Testing >- Have at least three serials, with items >- check the box to select two of them >- Press the Remove selected issues button >- Decide to delete their items as well or not >- Validate. > >Sponsored by : CCSR >--- > .../prog/en/modules/serials/serials-collection.tt | 52 +++++++++++++++++++++- > serials/serials-collection.pl | 29 ++++++++++++ > 2 files changed, 79 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >index 2244f70..3263608 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt >@@ -31,6 +31,31 @@ > [% IF ( callnumber ) %]callnumber: [% callnumber | html %][% END %]</h1> > [% END %] > >+[% IF ( delete ) %] >+ <div class="dialog alert"> >+ <h3>You are about to delete [% serialnumber | html %] serial(s). Do you want to continue?</h3> >+ <form action="/cgi-bin/koha/serials/serials-collection.pl/#"> >+ [% IF countitems > 0 %] >+ <h5>Number of items available: [% countitems | html %]</h5> >+ <p> >+ <label>Delete associated items? <input type="checkbox" name="delitems" value="Yes" />Yes</label> >+ </p> >+ [% END %] >+ <input type="hidden" name="op" value="delete_confirmed" /> >+ <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" /> >+ <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" /> >+ [% FOREACH serialid IN serialsid %] >+ <input type="hidden" name="serialid" value="[% serialid | html %]" /> >+ [% END %] >+ <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button> >+ </form> >+ <form action="/cgi-bin/koha/serials/serials-collection.pl/#"> >+ <input type="hidden" name="subscriptionid" value="[% subscriptionid | html %]" /> >+ <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button> >+ </form> >+ </div> >+[% END %] >+ > [% IF ( subscriptions ) %] > <table> > [% IF ( subscriptions.size == 1 ) %] >@@ -120,6 +145,7 @@ > <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div> > [% END %] > [% END %] >+ <input type="button" value="Delete selected issues" class="delete-issues btn btn-default btn-sm" data-subscriptionids="[% subscriptionidlist | html %]" /> > </p> > [% END %] > <span class="checkall"> >@@ -163,8 +189,12 @@ > [% IF ( serial.subscriptionexpired ) %] > <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled="disabled" /> > [% ELSE %] >- [% IF ( serial.checked ) %] >- <input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid | html %]" /> >+ [% IF ( delete ) %] >+ [% IF serialsid.grep("${serial.serialid}").size %] >+ <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" disabled checked /> >+ [% ELSE %] >+ <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" disabled /> >+ [% END %] > [% ELSE %] > <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" /> > [% END %] >@@ -281,6 +311,19 @@ > > <script> > >+ function deleteIssues(subscriptionid) { >+ var serialschecked = $("form[name='edition'] input[name='serialid']:checked"); >+ if (serialschecked.length > 0) { >+ var location = 'serials-collection.pl?subscriptionid='+subscriptionid+'&op=delete_confirm'; >+ for (i=0; i < serialschecked.length; i++) { >+ location += '&serialid=' + serialschecked[i].value; >+ } >+ document.location = location; >+ } else { >+ alert(_("No serials selected")); >+ } >+ } >+ > function print_slip(subscriptionid,issue){ > var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue; > window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes'); >@@ -331,6 +374,11 @@ > } > return 1; > }); >+ >+ $(".delete-issues").on("click", function(e){ >+ e.preventDefault(); >+ deleteIssues("[% subscriptionidlist | html %]"); >+ }); > }); > > </script> >diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl >index e8735b3..7685a91 100755 >--- a/serials/serials-collection.pl >+++ b/serials/serials-collection.pl >@@ -27,6 +27,7 @@ use C4::Serials; > use C4::Letters; > use C4::Output; > use C4::Context; >+use Koha::Serial::Items; > > use Koha::DateUtils qw( dt_from_string ); > >@@ -107,6 +108,29 @@ if($op eq 'gennext' && @subscriptionid){ > exit; > } > >+my $countitems = 0; >+my @serialsid = $query->multi_param('serialid'); >+my $subscriptionid = $subscriptionid[0]; >+ >+if($op eq 'delete_confirm'){ >+ foreach my $serialid (@serialsid){ >+ $countitems += Koha::Serial::Items->search({serialid => $serialid})->count(); >+ } >+}elsif($op eq 'delete_confirmed'){ >+ if($query->param('delitems') eq "Yes"){ >+ foreach my $serialid (@serialsid){ >+ my @itemnumbers = Koha::Serial::Items->search({serialid => $serialid})->get_column('itemnumber'); >+ foreach my $itemnumber (@itemnumbers){ >+ C4::Items::DelItem({'biblionumber' => $biblionumber, 'itemnumber' => $itemnumber}); >+ } >+ } >+ } >+ for my $serialid (@serialsid){ >+ ModSerialStatus($serialid,"","","","",6); >+ } >+ print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid); >+} >+ > my $subscriptioncount; > my ($location, $callnumber); > if (@subscriptionid){ >@@ -182,6 +206,11 @@ $template->param( > callnumber => $callnumber, > uc(C4::Context->preference("marcflavour")) => 1, > serialsadditems => $subscriptiondescs->[0]{'serialsadditems'}, >+ delete => ($op eq 'delete_confirm'), >+ subscriptionid => $subscriptionid, >+ countitems => $countitems, >+ serialnumber => scalar @serialsid, >+ serialsid => \@serialsid, > ); > > output_html_with_http_headers $query, $cookie, $template->output; >-- >2.7.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 17674
:
57731
|
58262
|
58263
|
58264
|
60925
|
61314
|
61315
|
61316
|
66565
|
69007
|
69010
|
69011
|
69013
|
69976
|
69977
|
69978
|
69979
|
71865
|
71866
|
71867
|
71868
|
71869
|
72985
|
73032
|
73035
|
73036
|
73037
|
73038
|
73039
|
73040
|
74318
|
74359
|
74472
|
75643
|
75644
|
75645
|
75646
|
75647
|
75648
|
75649
|
77745
|
77746
|
77747
|
77748
|
77749
|
77750
|
77751
|
77861
|
77862
|
77863
|
77864
|
77865
|
77866
|
77867
|
77868
|
79415
|
79420
|
79421
|
79422
|
79423
|
79424
|
79425
|
79426
|
79427
|
79428
|
79453
|
79454
|
79455
|
79456
|
79457
|
79458
|
79459
|
79460
|
80859
|
80944
|
80955
|
82237
|
86689
|
95474
|
99434
|
99944
|
99945
|
100906
|
100907