use Modern::Perl;
use CGI qw ( -utf8 );
-use C4::Auth;
+use C4::Auth qw( get_template_and_user );
use C4::Context;
-use C4::Output;
-use C4::Koha;
-use C4::Letters;
-use C4::Serials;
+use C4::Output qw( output_html_with_http_headers );
-my $dbh = C4::Context->dbh;
+use Koha::Subscriptions;
-my $input = new CGI;
-my $print = $input->param('print');
+my $input = CGI->new;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => 'serials/viewalerts.tt',
query => $input,
type => "intranet",
- authnotrequired => 0,
flagsrequired => {serials => '*'},
- debug => 1,
});
-my $subscriptionid=$input->param('subscriptionid');
-
-my $borrowers = getalert('', $subscriptionid);
-my $subscription = GetSubscription($subscriptionid);
-
-for my $borrowernumber (@$borrowers) {
- my $patron = Koha::Patrons->find( $borrowernumber );
- next unless $borrowernumber; # Just in case...
- $borrowers->{name} = join( ' ', $patron->firstname, $patron->surname );
-}
-$template->param(alertloop => $borrowers,
- bibliotitle => $subscription->{bibliotitle},
- subscriptionid => $subscriptionid,
- (uc(C4::Context->preference("marcflavour"))) => 1
- );
+my $subscriptionid = $input->param('subscriptionid');
+
+my $subscription = Koha::Subscriptions->find( $subscriptionid );
+# FIXME raise a message if subscription does not exist (easy with 18403)
+
+my $subscribers = $subscription->subscribers;
+
+$template->param(
+ subscribers => $subscribers,
+ bibliotitle => $subscription->biblio->title,
+ subscriptionid => $subscriptionid,
+);
output_html_with_http_headers $input, $cookie, $template->output;