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 $searchfield = $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;
{ template_name => "admin/cities.tt",
query => $input,
type => "intranet",
- authnotrequired => 0,
flagsrequired => { parameters => 'manage_cities' },
- debug => 1,
}
);
$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');
push @messages, { type => 'message', code => 'success_on_insert' };
}
}
- $searchfield = q||;
- $op = 'list';
+ $city_name = q||;
+ $op = 'list';
} elsif ( $op eq 'delete_confirm' ) {
my $city = Koha::Cities->find($cityid);
$template->param( city => $city, );
$op = 'list';
}
+if ( $op eq 'list' ) {
+ $template->param( cities_count => Koha::Cities->search->count );
+}
+
$template->param(
cityid => $cityid,
- searchfield => $searchfield,
+ city_name_filter => $city_name_filter,
messages => \@messages,
op => $op,
);