my $branch = $query->param('branch_filter') || '';
my $routing = $query->param('routing') || C4::Context->preference("RoutingSerials");
my $searched = $query->param('searched') || 0;
+my @subscriptionids = $query ->param('subscriptionid');
+my $op = $query->param('op');
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
}
);
+if ( $op and $op eq "close" ) {
+ for my $subscriptionid ( @subscriptionids ) {
+ C4::Serials::CloseSubscription( $subscriptionid );
+ }
+} elsif ( $op and $op eq "reopen" ) {
+ for my $subscriptionid ( @subscriptionids ) {
+ C4::Serials::ReopenSubscription( $subscriptionid );
+ }
+}
+
my @subscriptions;
if ($searched){
@subscriptions = SearchSubscriptions(
}
}
+my (@openedsubscriptions, @closedsubscriptions);
+for my $sub ( @subscriptions ) {
+ unless ( $sub->{closed} ) {
+ push @openedsubscriptions, $sub
+ unless $sub->{cannotdisplay};
+ } else {
+ push @closedsubscriptions, $sub
+ unless $sub->{cannotdisplay};
+ }
+}
+
my $branches = GetBranches();
my @branches_loop;
foreach (sort keys %$branches){
my $selected = 0;
- $selected = 1 if( $branch eq $_ );
+ $selected = 1 if( defined $branch and $branch eq $_ );
push @branches_loop, {
branchcode => $_,
branchname => $branches->{$_}->{'branchname'},
}
$template->param(
- subscriptions => \@subscriptions,
+ openedsubscriptions => \@openedsubscriptions,
+ closedsubscriptions => \@closedsubscriptions,
+ total => @openedsubscriptions + @closedsubscriptions,
title_filter => $title,
ISSN_filter => $ISSN,
EAN_filter => $EAN,