Bug 32348: Add library public in columns settings
[koha-ffzg.git] / admin / cities.pl
index 03bce54..f16c9d7 100755 (executable)
 use Modern::Perl;
 use CGI qw ( -utf8 );
 use C4::Context;
-use C4::Auth;
-use C4::Output;
+use C4::Auth qw( get_template_and_user );
+use C4::Output qw( output_html_with_http_headers );
 
 use Koha::Cities;
 
-my $input       = new CGI;
-my $city_name   = $input->param('city_name') // q||;
+my $input       = CGI->new;
+my $city_name_filter = $input->param('city_name_filter') // q||;
 my $cityid      = $input->param('cityid');
 my $op          = $input->param('op') || 'list';
 my @messages;
@@ -36,9 +36,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
     {   template_name   => "admin/cities.tt",
         query           => $input,
         type            => "intranet",
-        authnotrequired => 0,
         flagsrequired   => { parameters => 'manage_cities' },
-        debug           => 1,
     }
 );
 
@@ -51,7 +49,6 @@ if ( $op eq 'add_form' ) {
 
     $template->param( city => $city, );
 } elsif ( $op eq 'add_validate' ) {
-    my $cityid       = $input->param('cityid');
     my $city_name    = $input->param('city_name');
     my $city_state   = $input->param('city_state');
     my $city_zipcode = $input->param('city_zipcode');
@@ -102,15 +99,12 @@ if ( $op eq 'add_form' ) {
 }
 
 if ( $op eq 'list' ) {
-    my $filter = {};
-    $filter->{city_name} = { -like => '%'.$city_name.'%' }
-        if $city_name;
-    $template->param( cities_count => Koha::Cities->search($filter)->count );
+    $template->param( cities_count => Koha::Cities->search->count );
 }
 
 $template->param(
     cityid      => $cityid,
-    city_name_filter => $city_name,
+    city_name_filter => $city_name_filter,
     messages    => \@messages,
     op          => $op,
 );