use CGI qw ( -utf8 );
-use C4::Auth;
+use C4::Auth qw( get_template_and_user );
use C4::Output;
use Koha::Patron::Message;
-my $input = new CGI;
+my $input = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ template_name => "circ/circulation.tt",
query => $input,
type => "intranet",
- authnotrequired => 0,
- flagsrequired => { borrowers => 1 },
- debug => 1,
+ flagsrequired => { borrowers => 'edit_borrowers' },
}
);
my $branchcode = $input->param('branchcode');
my $message_type = $input->param('message_type');
my $borrower_message = $input->param('borrower_message');
+my $batch = $input->param('batch');
Koha::Patron::Message->new(
{
}
)->store;
-my $url = $input->referer() // "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber";
+my $url = $input->referer;
+if ( $url ) {
+ if ( $url =~ m|circulation\.pl$| ) {
+ # Trick for POST form from batch checkouts
+ $url .= "?borrowernumber=$borrowernumber";
+ $url .= "&batch=1" if $batch;
+ }
+} else {
+ $url = "/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber";
+}
print $input->redirect($url);