use CGI qw ( -utf8 );
-use C4::Auth;
-use C4::Output;
-use Koha::List::Patron;
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
+use Koha::List::Patron qw( AddPatronList GetPatronLists ModPatronList );
-my $cgi = new CGI;
+my $cgi = CGI->new;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "patron_lists/add-modify.tt",
query => $cgi,
type => "intranet",
- authnotrequired => 0,
flagsrequired => { tools => 'manage_patron_lists' },
}
);
my $id = $cgi->param('patron_list_id');
my $name = $cgi->param('name');
+my $shared = $cgi->param('shared') ? 1 : 0;
if ($id) {
my ($list) = GetPatronLists( { patron_list_id => $id } );
if ($name) {
if ($id) {
- ModPatronList( { patron_list_id => $id, name => $name } );
+ ModPatronList( { patron_list_id => $id, name => $name, shared => $shared } );
print $cgi->redirect('lists.pl');
}
else {
- my $list = AddPatronList( { name => $name } );
+ my $list = AddPatronList( { name => $name, shared => $shared } );
print $cgi->redirect(
"list.pl?patron_list_id=" . $list->patron_list_id() );
}