Bugzilla – Attachment 174420 Details for
Bug 28633
Add a preferred name field to patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28633: (follow-up) Set preferred name and adjust counts for tests
Bug-28633-follow-up-Set-preferred-name-and-adjust-.patch (text/plain), 9.34 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-11-12 15:11:13 UTC
(
hide
)
Description:
Bug 28633: (follow-up) Set preferred name and adjust counts for tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-11-12 15:11:13 UTC
Size:
9.34 KB
patch
obsolete
>From 26ea3a9bac26cd89a763789e61cdda2eb72a0cf7 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 12 Nov 2024 14:47:07 +0000 >Subject: [PATCH] Bug 28633: (follow-up) Set preferred name and adjust counts > for tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > .../prog/en/includes/js_includes.inc | 2 +- > t/db_dependent/selenium/patrons_search.t | 71 ++++++++++--------- > 2 files changed, 39 insertions(+), 34 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >index 87d469824e2..d5d734787d1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >@@ -69,7 +69,7 @@ > [% END %] > > <script> >- var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' | html %]"; >+ var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname|preferred_name|middle_name|surname|othernames|cardnumber|userid' | html %]"; > var defaultPatronSearchMethod = "[% Koha.Preference('DefaultPatronSearchMethod') || 'contains' | html %]"; > var extendedPatronAttributes = "[% Koha.Preference('ExtendedPatronAttributes') | html %]"; > var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]'; >diff --git a/t/db_dependent/selenium/patrons_search.t b/t/db_dependent/selenium/patrons_search.t >index 74cca555efd..069c4983dac 100755 >--- a/t/db_dependent/selenium/patrons_search.t >+++ b/t/db_dependent/selenium/patrons_search.t >@@ -84,15 +84,16 @@ sub setup { > { > class => 'Koha::Patrons', > value => { >- surname => "test_patron_" . $i++, >- firstname => $firstname, >- middle_name => q{}, # We don't want to copy the logic from patron_to_html >- othernames => q{}, >- categorycode => $patron_category->categorycode, >- branchcode => $library->branchcode, >- borrowernotes => $borrowernotes, >- address => $address, >- email => $email, >+ surname => "test_patron_" . $i++, >+ firstname => $firstname, >+ preferred_name => $firstname, >+ middle_name => q{}, # We don't want to copy the logic from patron_to_html >+ othernames => q{}, >+ categorycode => $patron_category->categorycode, >+ branchcode => $library->branchcode, >+ borrowernotes => $borrowernotes, >+ address => $address, >+ email => $email, > } > } > ); >@@ -102,15 +103,16 @@ sub setup { > { > class => 'Koha::Patrons', > value => { >- surname => "test", >- firstname => "not_p_a_t_r_o_n", # won't match 'patron' >- middle_name => q{}, # We don't want to copy the logic from patron_to_html >- othernames => q{}, >- categorycode => $patron_category->categorycode, >- branchcode => $library->branchcode, >- borrowernotes => $borrowernotes, >- address => $address, >- email => $email, >+ surname => "test", >+ firstname => "not_p_a_t_r_o_n", # won't match 'patron' >+ preferred_name => "not_p_a_t_r_o_n", >+ middle_name => q{}, # We don't want to copy the logic from patron_to_html >+ othernames => q{}, >+ categorycode => $patron_category->categorycode, >+ branchcode => $library->branchcode, >+ borrowernotes => $borrowernotes, >+ address => $address, >+ email => $email, > } > } > ); >@@ -127,16 +129,17 @@ sub setup { > { > class => 'Koha::Patrons', > value => { >- surname => "test_patron_27", >- firstname => $firstname, >- middle_name => q{}, # We don't want to copy the logic from patron_to_html >- othernames => q{}, >- categorycode => $patron_category->categorycode, >- branchcode => $library_2->branchcode, >- borrowernotes => $borrowernotes, >- address => $address, >- email => $email, >- dateofbirth => '1980-06-17', >+ surname => "test_patron_27", >+ firstname => $firstname, >+ preferred_name => $firstname, >+ middle_name => q{}, # We don't want to copy the logic from patron_to_html >+ othernames => q{}, >+ categorycode => $patron_category->categorycode, >+ branchcode => $library_2->branchcode, >+ borrowernotes => $borrowernotes, >+ address => $address, >+ email => $email, >+ dateofbirth => '1980-06-17', > } > } > ); >@@ -214,7 +217,7 @@ subtest 'Search patrons' => sub { > C4::Context->set_preference('DefaultPatronSearchFields',""); > C4::Context->set_preference('DefaultPatronSearchMethod',"contains"); > my $searchable_attributes = Koha::Patron::Attribute::Types->search({ staff_searchable => 1 })->count(); >- my $nb_standard_fields = 13 + $searchable_attributes; # Standard fields, plus one searchable attribute >+ my $nb_standard_fields = 14 + $searchable_attributes; # Standard fields, plus one searchable attribute > $driver->get( $base_url . "/members/members-home.pl" ); > my @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); > is( scalar @adv_options, $nb_standard_fields + 1, 'All standard fields are searchable if DefaultPatronSearchFields not set. middle_name is there.'); >@@ -225,16 +228,16 @@ subtest 'Search patrons' => sub { > C4::Context->set_preference('DefaultPatronSearchFields',"firstname|initials"); > $driver->get( $base_url . "/members/members-home.pl" ); > @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); >- 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'); >+ is( scalar @adv_options, $nb_standard_fields - 1, 'New option added when DefaultPatronSearchFields is populated with a field. Note that middle_name and preferred_name disappears, we do not want it if not part of DefaultPatronSearchFields'); > is( $adv_options[0]->get_value(), 'standard', 'Standard search uses value "standard"'); > @filter_options = $driver->find_elements('//select[@class="searchfieldstype_filter"]/option'); >- is( scalar @filter_options, $nb_standard_fields, 'New filter option added when DefaultPatronSearchFields is populated with a field'); >+ is( scalar @filter_options, $nb_standard_fields - 1, 'New filter option added when DefaultPatronSearchFields is populated with a field'); > is( $filter_options[0]->get_value(), 'standard', 'Standard filter uses value "standard"'); > $driver->get( $base_url . "/members/members-home.pl" ); > @adv_options = $driver->find_elements('//select[@id="searchfieldstype"]/option'); > @filter_options = $driver->find_elements('//select[@class="searchfieldstype_filter"]/option'); >- is( scalar @adv_options, $nb_standard_fields, 'Invalid option not added when DefaultPatronSearchFields is populated with an invalid field'); >- is( scalar @filter_options, $nb_standard_fields, 'Invalid filter option not added when DefaultPatronSearchFields is populated with an invalid field'); >+ is( scalar @adv_options, $nb_standard_fields - 1, 'Invalid option not added when DefaultPatronSearchFields is populated with an invalid field'); >+ is( scalar @filter_options, $nb_standard_fields - 1, 'Invalid filter option not added when DefaultPatronSearchFields is populated with an invalid field'); > > # NOTE: We should probably ensure the bad field is removed from 'standard' search here, else searches are broken > C4::Context->set_preference('DefaultPatronSearchFields',""); >@@ -425,11 +428,13 @@ subtest 'Search patrons' => sub { > my $patron_27 = Koha::Patrons->search( { surname => 'test_patron_27' } )->next; > is( is_patron_shown($patron_27), 1, 'search by correct year shows the patron' ); > $dob_search_filter->clear; >+ $dob_search_filter = $s->driver->find_element( '//table[@id="' . $table_id . '"]//input[@placeholder="Date of birth search"]' ); > > $dob_search_filter->send_keys('1986'); > sleep $DT_delay && $s->wait_for_ajax; > is( is_patron_shown($patron_27), 0, 'search by incorrect year does not show the patron' ); > $dob_search_filter->clear; >+ $dob_search_filter = $s->driver->find_element( '//table[@id="' . $table_id . '"]//input[@placeholder="Date of birth search"]' ); > > $dob_search_filter->send_keys('1980-06'); > sleep $DT_delay && $s->wait_for_ajax; >-- >2.47.0
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 28633
:
123008
|
123009
|
123010
|
123658
|
125497
|
125498
|
125499
|
125500
|
126591
|
128968
|
128969
|
128970
|
130000
|
130001
|
130002
|
133445
|
133446
|
133447
|
133448
|
133449
|
133450
|
133451
|
133958
|
133959
|
133960
|
133961
|
133962
|
133963
|
133964
|
133965
|
166792
|
166793
|
166794
|
166813
|
166814
|
166815
|
166816
|
166817
|
167163
|
167164
|
173628
|
173629
|
173630
|
173631
|
173632
|
173633
|
173634
|
173664
|
173665
|
173666
|
173667
|
173668
|
173669
|
173670
|
173717
|
173718
|
173719
|
173813
|
173814
|
173815
|
173816
|
173826
|
173827
|
173828
|
173829
|
173930
|
173931
|
173932
|
173933
|
173934
|
173935
|
173936
|
174419
| 174420 |
174472
|
175177