Bug 25279: Use another var name for the filter
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 6 May 2020 12:59:47 +0000 (14:59 +0200)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 12 May 2020 10:40:07 +0000 (11:40 +0100)
It prevents:
* The screen to display "no city, create one" if we are
searching for a string that does not return any results.
* The list to display only the city we have just created

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

admin/cities.pl
koha-tmpl/intranet-tmpl/prog/en/includes/cities-admin-search.inc

index 03bce54..0688852 100755 (executable)
@@ -27,7 +27,7 @@ use C4::Output;
 use Koha::Cities;
 
 my $input       = new CGI;
-my $city_name   = $input->param('city_name') // q||;
+my $city_name_filter = $input->param('city_name_filter') // q||;
 my $cityid      = $input->param('cityid');
 my $op          = $input->param('op') || 'list';
 my @messages;
@@ -51,7 +51,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 +101,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,
 );
index 16a3508..ffde9fa 100644 (file)
@@ -5,7 +5,7 @@
        <div id="city_search" class="residentsearch">
     <p class="tip">City search:</p>
        <form action="[% script_name | html %]" method="post">
-        <input class="head-searchbox" type="text" name="city_name" value="[% searchfield | html %]" size="40" />
+        <input class="head-searchbox" type="text" name="city_name_filter" value="[% city_name_filter | html %]" size="40" />
                <input type="submit" name="submit" value="OK" class="submit" />
        </form>
        </div>