Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 15; |
20 |
use Test::More tests => 19; |
21 |
|
21 |
|
22 |
use C4::Context; |
22 |
use C4::Context; |
23 |
use C4::Branch; |
23 |
use C4::Branch; |
Lines 87-98
my %jane_doe = (
Link Here
|
87 |
userid => 'jane.doe' |
87 |
userid => 'jane.doe' |
88 |
); |
88 |
); |
89 |
|
89 |
|
|
|
90 |
my %jeanpaul_dupont = ( |
91 |
cardnumber => '456789', |
92 |
firstname => 'Jean Paul', |
93 |
surname => 'Dupont', |
94 |
categorycode => $categorycode, |
95 |
branchcode => $branchcode, |
96 |
dateofbirth => '', |
97 |
dateexpiry => '9999-12-31', |
98 |
userid => 'jeanpaul.dupont' |
99 |
); |
100 |
|
90 |
$john_doe{borrowernumber} = AddMember( %john_doe ); |
101 |
$john_doe{borrowernumber} = AddMember( %john_doe ); |
91 |
warn "Error adding John Doe, check your tests" unless $john_doe{borrowernumber}; |
102 |
warn "Error adding John Doe, check your tests" unless $john_doe{borrowernumber}; |
92 |
$john_smith{borrowernumber} = AddMember( %john_smith ); |
103 |
$john_smith{borrowernumber} = AddMember( %john_smith ); |
93 |
warn "Error adding John Smith, check your tests" unless $john_smith{borrowernumber}; |
104 |
warn "Error adding John Smith, check your tests" unless $john_smith{borrowernumber}; |
94 |
$jane_doe{borrowernumber} = AddMember( %jane_doe ); |
105 |
$jane_doe{borrowernumber} = AddMember( %jane_doe ); |
95 |
warn "Error adding Jane Doe, check your tests" unless $jane_doe{borrowernumber}; |
106 |
warn "Error adding Jane Doe, check your tests" unless $jane_doe{borrowernumber}; |
|
|
107 |
$jeanpaul_dupont{borrowernumber} = AddMember( %jeanpaul_dupont ); |
108 |
warn "Error adding Jean Paul Dupont, check your tests" unless $jeanpaul_dupont{borrowernumber}; |
96 |
|
109 |
|
97 |
# Set common datatables params |
110 |
# Set common datatables params |
98 |
my %dt_params = ( |
111 |
my %dt_params = ( |
Lines 228-233
$search_results = C4::Utils::DataTables::Members::search({
Link Here
|
228 |
}); |
241 |
}); |
229 |
is( $search_results->{ iTotalDisplayRecords}, 0, "There are still 2 common users, but the patron attribute is not searchable " ); |
242 |
is( $search_results->{ iTotalDisplayRecords}, 0, "There are still 2 common users, but the patron attribute is not searchable " ); |
230 |
|
243 |
|
|
|
244 |
$search_results = C4::Utils::DataTables::Members::search({ |
245 |
searchmember => "Jean Paul", |
246 |
searchfieldstype => 'standard', |
247 |
searchtype => 'start_with', |
248 |
branchcode => $branchcode, |
249 |
dt_params => \%dt_params |
250 |
}); |
251 |
|
252 |
is( $search_results->{ iTotalDisplayRecords }, 1, |
253 |
"Jean Paul Dupont is found using start with and two terms search 'Jean Paul' (Bug 15252)"); |
254 |
|
255 |
$search_results = C4::Utils::DataTables::Members::search({ |
256 |
searchmember => "Jean Pau", |
257 |
searchfieldstype => 'standard', |
258 |
searchtype => 'start_with', |
259 |
branchcode => $branchcode, |
260 |
dt_params => \%dt_params |
261 |
}); |
262 |
|
263 |
is( $search_results->{ iTotalDisplayRecords }, 1, |
264 |
"Jean Paul Dupont is found using start with and two terms search 'Jean Pau' (Bug 15252)"); |
265 |
|
266 |
$search_results = C4::Utils::DataTables::Members::search({ |
267 |
searchmember => "Jea Pau", |
268 |
searchfieldstype => 'standard', |
269 |
searchtype => 'start_with', |
270 |
branchcode => $branchcode, |
271 |
dt_params => \%dt_params |
272 |
}); |
273 |
|
274 |
is( $search_results->{ iTotalDisplayRecords }, 0, |
275 |
"Jean Paul Dupont is not found using start with and two terms search 'Jea Pau' (Bug 15252)"); |
276 |
|
277 |
$search_results = C4::Utils::DataTables::Members::search({ |
278 |
searchmember => "Jea Pau", |
279 |
searchfieldstype => 'standard', |
280 |
searchtype => 'contain', |
281 |
branchcode => $branchcode, |
282 |
dt_params => \%dt_params |
283 |
}); |
284 |
|
285 |
is( $search_results->{ iTotalDisplayRecords }, 1, |
286 |
"Jean Paul Dupont is found using contains and two terms search 'Jea Pau' (Bug 15252)"); |
287 |
|
288 |
# End |
231 |
$dbh->rollback; |
289 |
$dbh->rollback; |
232 |
|
290 |
|
233 |
1; |
291 |
1; |
234 |
- |
|
|