Bugzilla – Attachment 79421 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), 10.35 KB, created by
Pierre-Marc Thibault
on 2018-09-26 14:34:37 UTC
(
hide
)
Description:
Bug 17674: Allow UI to delete serials in batch
Filename:
MIME Type:
Creator:
Pierre-Marc Thibault
Created:
2018-09-26 14:34:37 UTC
Size:
10.35 KB
patch
obsolete
>From d831e3f7fdecbf2cd6add6c36f1ecfc6c80da6c5 Mon Sep 17 00:00:00 2001 >From: Blou <philippe.blouin@inlibro.com> >Date: Wed, 23 Nov 2016 12:22:11 -0500 >Subject: [PATCH] Bug 17674: Allow UI to delete serials in batch >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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 > >Signed-off-by: Sonia BOUIS <sonia.bouis@univ-lyon3.fr> >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> >--- > C4/Serials.pm | 18 +++++ > .../prog/en/modules/serials/serials-collection.tt | 83 +++++++++++++++++++++- > serials/serials-collection.pl | 35 ++++++++- > 3 files changed, 131 insertions(+), 5 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 0eb699f..78607de 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -85,6 +85,7 @@ BEGIN { > &CountIssues > HasItems > &subscriptionCurrentlyOnOrder >+ &GetSerialItemsInformations > > ); > } >@@ -2594,7 +2595,24 @@ sub _can_do_on_subscription { > } > return 0; > } >+=head1 GetSerialItemsInformations >+=cut >+sub GetSerialItemsInformations{ >+my (@serialid)=@_; >+my $i=0; >+my @serialitemsinformation; >+my $dbh = C4::Context->dbh; >+foreach my $sid(@serialid){ >+ my $sth = $dbh->prepare("select count(i.itemnumber) as countitems,s.itemnumber as itemnumber from items i natural join serialitems s where s.serialid=?"); >+ $sth->execute($sid); >+ my $line = $sth->fetchrow_hashref; >+ if($line->{'countitems'}){ >+ push @serialitemsinformation,$line; >+ } >+} >+ return @serialitemsinformation; > >+} > =head2 findSerialsByStatus > > @serials = findSerialsByStatus($status, $subscriptionid); >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 8bee8c4..25d13c4 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 >@@ -16,6 +16,26 @@ > > <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> › Serial collection information for <i>[% bibliotitle | html %]</i></div> > >+[% IF ( delete ) %] >+ <div class="yui-g"> >+ <div id="circ_needsconfirmation" class="dialog alert"> >+ <h3>Are you sure delete <b> [% serialnumber %] </b> selected serials</h3> >+ <form action="/cgi-bin/koha/serials/serials-collection.pl/#"> >+ <h5>Delete associated items <input type="radio" name="delitems" value="Yes">Yes >+ <input type="radio" name="delitems" value="No" checked>No</h5> >+ <h5>Number of items available <b>: [% countitems %] </b> </h5> >+ <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" /> >+ <input type="hidden" name="serialsid" value="[% serialsid %]" /> >+ <input type="hidden" name="confdelete" value="1" /> >+ <input type="submit" class="approve" value="Yes, delete"/> >+ </form> >+ <form action=""/cgi-bin/koha/serials/serials-collection.pl/#"> >+ <input type="hidden" name="subscriptionid" value="[% subscriptionid %]" /> >+ <input type="submit" class="deny" value="No, don't delete"/> >+ </form> >+ </div> >+ </div> >+ [% END %] > <div id="doc3" class="yui-t2"> > > <div id="bd"> >@@ -121,6 +141,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" onclick="javascript:deleteIssues([% subscriptionidlist %])"/> > </p> > [% END %] > <span class="checkall"> >@@ -162,12 +183,20 @@ > disabled > [% ELSE %] > [% IF ( serial.subscriptionexpired ) %] >- <input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled="disabled" /> >+ <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 ) %] >+ <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" [% IF ( delete ) %] readonly [% END %] [% IF serialsid.grep("${serial.serialid}").size %] checked [% END %] /> >+ [% ELSE %] >+ <input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid | html %]" /> >+ [% END %] > [% ELSE %] >- <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" /> >+ [% IF ( delete ) %] >+ <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" [% IF ( delete ) %] readonly [% END %] [% IF serialsid.grep("${serial.serialid}").size %] checked [% END %] /> >+ [% ELSE %] >+ <input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" /> >+ [% END %] > [% END %] > [% END %] > [% END %] >@@ -279,6 +308,54 @@ > [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] > > <script type="text/javascript"> >+ function generateReceive(subscriptionid) { >+ if(nbissues=prompt(_("How many issues do you want to receive ?"))){ >+ document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid+'&nbissues='+nbissues; >+ } >+ } >+ >+ function deleteIssues(subscriptionid) { >+ var serialnumber=0; >+ var serials=""; >+ var serialids = document.edition.serialid; >+ for(i=0;i<serialids.length;i++){ >+ if (serialids[i].checked==true){ >+ if (serials.length==0){ >+ serials+=serialids[i].value; >+ }else{ >+ serials+="!"+serialids[i].value; >+ } >+ serialnumber ++; >+ } >+ } >+ if(serialnumber==0){ >+ alert("No serials selected"); >+ }else{ >+ document.location = 'serials-collection.pl?subscriptionid='+subscriptionid+'&op=delete&serialsid='+serials+'&serialnumber='+serialnumber; >+ } >+ } >+ >+ function addsubscriptionid() { >+ var tab=new Array(); >+ var serialids = document.edition.serialid; >+ for (i=0; i<serialids.length; i++){ >+ if (serialids[i].checked == true){ >+ var found=false; >+ for (var val in tab){ >+ if (tab[val] == document.getElementsByName("subs")[i].getAttribute('val')){found = true;} >+ } >+ if (found == false){ >+ tab=tab.concat((document.getElementsByName("subs")[i].getAttribute('val'))); >+ } >+ } >+ } >+ var string=""; >+ for (var val in tab){ >+ string = string + tab[val] + ","; >+ } >+ string=string.substring(0,string.length -1); >+ document.edition.subscriptionid.value=string; >+ } > > function print_slip(subscriptionid,issue){ > var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue; >diff --git a/serials/serials-collection.pl b/serials/serials-collection.pl >index a4fd91d..1cf5ca9 100755 >--- a/serials/serials-collection.pl >+++ b/serials/serials-collection.pl >@@ -24,6 +24,7 @@ use CGI qw ( -utf8 ); > use C4::Auth; > use C4::Koha; > use C4::Serials; >+use C4::Items; > use C4::Letters; > use C4::Output; > use C4::Context; >@@ -50,11 +51,19 @@ my ($template, $loggedinuser, $cookie) > my $biblionumber = $query->param('biblionumber'); > my @subscriptionid = $query->multi_param('subscriptionid'); > >+my $serialsid=$query->param('serialsid'); >+my $serialnumber=$query->param('serialnumber'); >+my $confdelete=$query->param('confdelete'); >+my $delitems=$query->param('delitems'); > @subscriptionid= uniq @subscriptionid; > @subscriptionid= sort @subscriptionid; > my $subscriptiondescs; > my $subscriptions; >- >+my $delete; >+my $countitems=0; >+my @ids=split("!",$serialsid); >+my @serialitemsinformation=GetSerialItemsInformations(@ids); >+my $subscriptionid = $subscriptionid[0]; > if($op eq 'gennext' && @subscriptionid){ > my $subscriptionid = $subscriptionid[0]; > my $sth = $dbh->prepare(" >@@ -106,6 +115,23 @@ if($op eq 'gennext' && @subscriptionid){ > print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid); > } > >+if($op eq 'delete'){ >+ $delete=1; >+ foreach my $line (@serialitemsinformation){ >+ $countitems+=$line->{'countitems'}; >+ } >+} >+if($confdelete){ >+ for my $id(@ids){ >+ ModSerialStatus($id,"","","","",6); >+ } >+ if($delitems eq "Yes"){ >+ foreach my $line (@serialitemsinformation){ >+ DelItem($line); >+ } >+ } >+print $query->redirect('/cgi-bin/koha/serials/serials-collection.pl?subscriptionid='.$subscriptionid); >+} > my $subscriptioncount; > my ($location, $callnumber); > if (@subscriptionid){ >@@ -177,6 +203,11 @@ $template->param( > callnumber => $callnumber, > uc(C4::Context->preference("marcflavour")) => 1, > serialsadditems => $subscriptiondescs->[0]{'serialsadditems'}, >- ); >+ subscriptionid =>$subscriptionid, >+ delete =>$delete, >+ serialsid =>$serialsid, >+ serialnumber =>$serialnumber, >+ countitems =>$countitems, >+ ); > > 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