Lines 25-34
our @cleanup;
Link Here
|
25 |
|
25 |
|
26 |
END { |
26 |
END { |
27 |
unless ( @cleanup ) { say "WARNING: Cleanup failed!" } |
27 |
unless ( @cleanup ) { say "WARNING: Cleanup failed!" } |
28 |
C4::Context->set_preference( 'dateformat', $original_dateformat ); |
28 |
Koha::Config::SysPrefs->set_preference( 'dateformat', $original_dateformat ); |
29 |
C4::Context->set_preference( 'DefaultPatronSearchFields', $original_DefaultPatronSearchFields ); |
29 |
Koha::Config::SysPrefs->set_preference( 'DefaultPatronSearchFields', $original_DefaultPatronSearchFields ); |
30 |
C4::Context->set_preference( 'DefaultPatronSearchMethod', $original_DefaultPatronSearchMethod ); |
30 |
Koha::Config::SysPrefs->set_preference( 'DefaultPatronSearchMethod', $original_DefaultPatronSearchMethod ); |
31 |
C4::Context->set_preference( 'PatronsPerPage', $original_PatronsPerPage ); |
31 |
Koha::Config::SysPrefs->set_preference( 'PatronsPerPage', $original_PatronsPerPage ); |
32 |
$_->delete for @cleanup; |
32 |
$_->delete for @cleanup; |
33 |
}; |
33 |
}; |
34 |
|
34 |
|
Lines 162-172
subtest 'Search patrons' => sub {
Link Here
|
162 |
my $table_id = "memberresultst"; |
162 |
my $table_id = "memberresultst"; |
163 |
|
163 |
|
164 |
$s->auth; |
164 |
$s->auth; |
165 |
C4::Context->set_preference('DefaultPatronSearchFields',""); |
165 |
Koha::Config::SysPrefs->set_preference('DefaultPatronSearchFields',""); |
166 |
C4::Context->set_preference('DefaultPatronSearchMethod',"contains"); |
166 |
Koha::Config::SysPrefs->set_preference('DefaultPatronSearchMethod',"contains"); |
167 |
my $PatronsPerPage = 15; |
167 |
my $PatronsPerPage = 15; |
168 |
my $nb_standard_fields = 13; |
168 |
my $nb_standard_fields = 13; |
169 |
C4::Context->set_preference('PatronsPerPage', $PatronsPerPage); |
169 |
Koha::Config::SysPrefs->set_preference('PatronsPerPage', $PatronsPerPage); |
170 |
$driver->get( $base_url . "/members/members-home.pl" ); |
170 |
$driver->get( $base_url . "/members/members-home.pl" ); |
171 |
my @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); |
171 |
my @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); |
172 |
is( scalar @adv_options, $nb_standard_fields + 1, 'All standard fields are searchable if DefaultPatronSearchFields not set. middle_name is there.'); |
172 |
is( scalar @adv_options, $nb_standard_fields + 1, 'All standard fields are searchable if DefaultPatronSearchFields not set. middle_name is there.'); |
Lines 174-180
subtest 'Search patrons' => sub {
Link Here
|
174 |
my @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); |
174 |
my @filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); |
175 |
is( scalar @filter_options, $nb_standard_fields + 1, 'All standard fields + middle_name are searchable by filter if DefaultPatronSearchFields not set'); |
175 |
is( scalar @filter_options, $nb_standard_fields + 1, 'All standard fields + middle_name are searchable by filter if DefaultPatronSearchFields not set'); |
176 |
is( $filter_options[0]->get_value(), 'standard', 'Standard filter uses hard coded value "standard" DefaultPatronSearchFields not set'); |
176 |
is( $filter_options[0]->get_value(), 'standard', 'Standard filter uses hard coded value "standard" DefaultPatronSearchFields not set'); |
177 |
C4::Context->set_preference('DefaultPatronSearchFields',"firstname|initials"); |
177 |
Koha::Config::SysPrefs->set_preference('DefaultPatronSearchFields',"firstname|initials"); |
178 |
$driver->get( $base_url . "/members/members-home.pl" ); |
178 |
$driver->get( $base_url . "/members/members-home.pl" ); |
179 |
@adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); |
179 |
@adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); |
180 |
is( scalar @adv_options, $nb_standard_fields, 'New option added when DefaultPatronSearchFields is populated with a field. Note that middle_name disappears, we do not want it if not part of DefaultPatronSearchFields'); |
180 |
is( scalar @adv_options, $nb_standard_fields, 'New option added when DefaultPatronSearchFields is populated with a field. Note that middle_name disappears, we do not want it if not part of DefaultPatronSearchFields'); |
Lines 182-188
subtest 'Search patrons' => sub {
Link Here
|
182 |
@filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); |
182 |
@filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); |
183 |
is( scalar @filter_options, $nb_standard_fields, 'New filter option added when DefaultPatronSearchFields is populated with a field'); |
183 |
is( scalar @filter_options, $nb_standard_fields, 'New filter option added when DefaultPatronSearchFields is populated with a field'); |
184 |
is( $filter_options[0]->get_value(), 'standard', 'Standard filter uses value "standard"'); |
184 |
is( $filter_options[0]->get_value(), 'standard', 'Standard filter uses value "standard"'); |
185 |
C4::Context->set_preference('DefaultPatronSearchFields',"firstname|initials|horses"); |
185 |
Koha::Config::SysPrefs->set_preference('DefaultPatronSearchFields',"firstname|initials|horses"); |
186 |
$driver->get( $base_url . "/members/members-home.pl" ); |
186 |
$driver->get( $base_url . "/members/members-home.pl" ); |
187 |
@adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); |
187 |
@adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); |
188 |
@filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); |
188 |
@filter_options = $driver->find_elements('//select[@id="searchfieldstype_filter"]/option'); |
Lines 190-196
subtest 'Search patrons' => sub {
Link Here
|
190 |
is( scalar @filter_options, $nb_standard_fields, 'Invalid filter option not added when DefaultPatronSearchFields is populated with an invalid field'); |
190 |
is( scalar @filter_options, $nb_standard_fields, 'Invalid filter option not added when DefaultPatronSearchFields is populated with an invalid field'); |
191 |
|
191 |
|
192 |
# NOTE: We should probably ensure the bad field is removed from 'standard' search here, else searches are broken |
192 |
# NOTE: We should probably ensure the bad field is removed from 'standard' search here, else searches are broken |
193 |
C4::Context->set_preference('DefaultPatronSearchFields',""); |
193 |
Koha::Config::SysPrefs->set_preference('DefaultPatronSearchFields',""); |
194 |
$driver->get( $base_url . "/members/members-home.pl" ); |
194 |
$driver->get( $base_url . "/members/members-home.pl" ); |
195 |
$s->fill_form( { search_patron_filter => 'test_patron' } ); |
195 |
$s->fill_form( { search_patron_filter => 'test_patron' } ); |
196 |
$s->submit_form; |
196 |
$s->submit_form; |
Lines 292-298
subtest 'Search patrons' => sub {
Link Here
|
292 |
|
292 |
|
293 |
plan tests => 7; |
293 |
plan tests => 7; |
294 |
|
294 |
|
295 |
C4::Context->set_preference( 'PatronsPerPage', 5 ); |
295 |
Koha::Config::SysPrefs->set_preference( 'PatronsPerPage', 5 ); |
296 |
$driver->get( $base_url . "/members/members-home.pl" ); |
296 |
$driver->get( $base_url . "/members/members-home.pl" ); |
297 |
$s->fill_form( { search_patron_filter => 'test_patron' } ); |
297 |
$s->fill_form( { search_patron_filter => 'test_patron' } ); |
298 |
$s->submit_form; |
298 |
$s->submit_form; |
Lines 342-348
subtest 'Search patrons' => sub {
Link Here
|
342 |
subtest 'filter by date of birth' => sub { |
342 |
subtest 'filter by date of birth' => sub { |
343 |
plan tests => 7; |
343 |
plan tests => 7; |
344 |
|
344 |
|
345 |
C4::Context->set_preference( 'dateformat', 'metric' ); |
345 |
Koha::Config::SysPrefs->set_preference( 'dateformat', 'metric' ); |
346 |
|
346 |
|
347 |
# We have a patron with date of birth=1980-06-17 => formatted as 17/06/1980 |
347 |
# We have a patron with date of birth=1980-06-17 => formatted as 17/06/1980 |
348 |
|
348 |
|