|
Lines 51-64
if ( C4::Context->preference("IndependentBranches")
Link Here
|
| 51 |
$limit_on_branch = 1; |
51 |
$limit_on_branch = 1; |
| 52 |
} |
52 |
} |
| 53 |
|
53 |
|
|
|
54 |
my @parts = split( / /, $query ); |
| 55 |
my @params; |
| 56 |
foreach my $p (@parts) { |
| 57 |
push( |
| 58 |
@params, |
| 59 |
-or => [ |
| 60 |
surname => { -like => "$p%" }, |
| 61 |
firstname => { -like => "$p%" }, |
| 62 |
cardnumber => { -like => "$p%" }, |
| 63 |
] |
| 64 |
); |
| 65 |
} |
| 66 |
|
| 67 |
push( @params, { branchcode => C4::Context->userenv->{branch} } ) if $limit_on_branch; |
| 68 |
|
| 54 |
my $borrowers_rs = Koha::Borrowers->search( |
69 |
my $borrowers_rs = Koha::Borrowers->search( |
| 55 |
{ -or => { |
70 |
{ -and => \@params }, |
| 56 |
surname => { -like => "$query%" }, |
|
|
| 57 |
firstname => { -like => "$query%" }, |
| 58 |
cardnumber => { -like => "$query%" }, |
| 59 |
( $limit_on_branch ? { branchcode => C4::Context->userenv->{branch} } : () ), |
| 60 |
}, |
| 61 |
}, |
| 62 |
{ |
71 |
{ |
| 63 |
# Get the first 10 results |
72 |
# Get the first 10 results |
| 64 |
page => 1, |
73 |
page => 1, |
| 65 |
- |
|
|