From f5d04bd8287b76154ae3cfcefcbc89792e155e4a Mon Sep 17 00:00:00 2001 From: Blou 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 Signed-off-by: Séverine QUEUNE --- 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 8ba7264..91c669b 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 @@ -15,6 +15,26 @@ +[% IF ( delete ) %] +
+
+

Are you sure delete [% serialnumber %] selected serials

+
+
Delete associated items Yes + No
+
Number of items available : [% countitems %]
+ + + + +
+
+ + +
+
+
+ [% END %]
@@ -120,6 +140,7 @@
[% END %] [% END %] +

[% END %] @@ -161,12 +182,20 @@ disabled [% ELSE %] [% IF ( serial.subscriptionexpired ) %] - + [% ELSE %] [% IF ( serial.checked ) %] - + [% IF ( delete ) %] + + [% ELSE %] + + [% END %] [% ELSE %] - + [% IF ( delete ) %] + + [% ELSE %] + + [% END %] [% END %] [% END %] [% END %] @@ -278,6 +307,54 @@ [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]