Bugzilla – Attachment 140978 Details for
Bug 31565
Patron search filter by category code with special character returns no results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31565: Escape datatables MySQL special characters [FIX TESTS]
Bug-31565-Escape-datatables-MySQL-special-characte.patch (text/plain), 5.27 KB, created by
Mason James
on 2022-09-26 12:48:07 UTC
(
hide
)
Description:
Bug 31565: Escape datatables MySQL special characters [FIX TESTS]
Filename:
MIME Type:
Creator:
Mason James
Created:
2022-09-26 12:48:07 UTC
Size:
5.27 KB
patch
obsolete
>From 08bec5f8d64bf365e55c4946cdf95fd35cbd941b Mon Sep 17 00:00:00 2001 >From: Mason James <mtj@kohaaloha.com> >Date: Sat, 24 Sep 2022 17:39:40 +1200 >Subject: [PATCH] Bug 31565: Escape datatables MySQL special characters [FIX > TESTS] >Content-Type: text/plain; charset="utf-8" > >this patch removes _/& chars from test queries, as they are now removed via jscript > >to test: > >1/ push patch > >2/ note jenkins tests now pass >--- > t/db_dependent/selenium/patrons_search.t | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > >diff --git a/t/db_dependent/selenium/patrons_search.t b/t/db_dependent/selenium/patrons_search.t >index dac9bcb975..8e0585f3b9 100755 >--- a/t/db_dependent/selenium/patrons_search.t >+++ b/t/db_dependent/selenium/patrons_search.t >@@ -54,7 +54,7 @@ my $schema = Koha::Database->schema; > subtest 'Search patrons' => sub { > plan tests => 25; > >- if ( Koha::Patrons->search({surname => {-like => "test_patron_%"}})->count ) { >+ if ( Koha::Patrons->search({surname => {-like => "test.patron.%"}})->count ) { > BAIL_OUT("Cannot run this test, data we need to create already exist in the DB"); > } > my @patrons; >@@ -81,7 +81,7 @@ subtest 'Search patrons' => sub { > { > class => 'Koha::Patrons', > value => { >- surname => "test_patron_" . $i++, >+ surname => "test.patron." . $i++, > firstname => $firstname, > categorycode => $patron_category->categorycode, > branchcode => $library->branchcode, >@@ -98,7 +98,7 @@ subtest 'Search patrons' => sub { > class => 'Koha::Patrons', > value => { > surname => "test", >- firstname => "not_p_a_t_r_o_n", # won't match 'patron' >+ firstname => "not._patr0n", # won't match 'patron' > categorycode => $patron_category->categorycode, > branchcode => $library->branchcode, > borrowernotes => $borrowernotes, >@@ -116,7 +116,7 @@ subtest 'Search patrons' => sub { > { > class => 'Koha::Patrons', > value => { >- surname => "test_patron_26", >+ surname => "test.patron.26", > firstname => $firstname, > categorycode => $patron_category->categorycode, > branchcode => $library_2->branchcode, >@@ -182,7 +182,7 @@ subtest 'Search patrons' => sub { > # NOTE: We should probably ensure the bad field is removed from 'standard' search here, else searches are broken > C4::Context->set_preference('DefaultPatronSearchFields',""); > $driver->get( $base_url . "/members/members-home.pl" ); >- $s->fill_form( { search_patron_filter => 'test_patron' } ); >+ $s->fill_form( { search_patron_filter => 'test.patron' } ); > $s->submit_form; > my $first_patron = $patrons[0]; > >@@ -219,11 +219,11 @@ subtest 'Search patrons' => sub { > ); > > $driver->get( $base_url . "/members/members-home.pl" ); >- $s->fill_form( { search_patron_filter => 'test_patron' } ); >+ $s->fill_form( { search_patron_filter => 'test.patron' } ); > $s->submit_form; > $s->wait_for_ajax; > >- $s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test_patron'); >+ $s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test.patron'); > $s->wait_for_ajax; > is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', $PatronsPerPage, 26, $total_number_of_patrons), 'Searching in standard brings back correct results' ); > >@@ -267,7 +267,7 @@ subtest 'Search patrons' => sub { > > # Refine search and search for test_patron in all the data using the DT global search > # No change in result expected, still 2 patrons >- $s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test_patron'); >+ $s->driver->find_element('//*[@id="'.$table_id.'_filter"]//input')->send_keys('test.patron'); > $s->wait_for_ajax; > is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', 2, 2, $total_number_of_patrons), 'Refining with DataTables search works to further filter the original query' ); > >@@ -283,7 +283,7 @@ subtest 'Search patrons' => sub { > > C4::Context->set_preference( 'PatronsPerPage', 5 ); > $driver->get( $base_url . "/members/members-home.pl" ); >- $s->fill_form( { search_patron_filter => 'test_patron' } ); >+ $s->fill_form( { search_patron_filter => 'test.patron' } ); > $s->submit_form; > $s->wait_for_ajax; > my $patron_selected_text = $driver->find_element('//div[@id="patron_search_selected"]/span')->get_text; >@@ -309,7 +309,7 @@ subtest 'Search patrons' => sub { > > # Perform another search > $driver->get( $base_url . "/members/members-home.pl" ); >- $s->fill_form( { search_patron_filter => 'test_patron' } ); >+ $s->fill_form( { search_patron_filter => 'test.patron' } ); > $s->submit_form; > $s->wait_for_ajax; > $patron_selected_text = $driver->find_element('//div[@id="patron_search_selected"]/span')->get_text; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31565
:
140636
|
140637
|
140709
|
140753
|
140754
|
140755
|
140756
|
140757
|
140758
|
140978
|
140984
|
142861