View | Details | Raw Unified | Return to bug 4340
Collapse All | Expand All

(-)a/C4/Members.pm (-11 / +16 lines)
Lines 208-229 sub SearchMember { Link Here
208
            $query.=" borrowers.branchcode =".$dbh->quote(C4::Context->userenv->{'branch'})." AND " unless (C4::Context->userenv->{'branch'} eq "insecure");
208
            $query.=" borrowers.branchcode =".$dbh->quote(C4::Context->userenv->{'branch'})." AND " unless (C4::Context->userenv->{'branch'} eq "insecure");
209
          }      
209
          }      
210
        }     
210
        }     
211
        $query.="((surname LIKE ? OR surname LIKE ?
211
        $query.="((surname LIKE ? OR (surname LIKE ? AND surname REGEXP ?)
212
                OR firstname  LIKE ? OR firstname LIKE ?
212
                OR firstname  LIKE ? OR (firstname LIKE ? AND firstname REGEXP ?)
213
                OR othernames LIKE ? OR othernames LIKE ?)
213
                OR othernames LIKE ? OR (othernames LIKE ? AND othernames REGEXP ?))
214
        " .
214
        " .
215
        ($category_type?" AND category_type = ".$dbh->quote($category_type):"");
215
        ($category_type?" AND category_type = ".$dbh->quote($category_type):"");
216
        my $regex = '[[:punct:][:space:]]'.$data[0];
216
        @bind = (
217
        @bind = (
217
            "$data[0]%", "% $data[0]%", "$data[0]%", "% $data[0]%",
218
            "$data[0]%", "%$data[0]%", $regex, 
218
            "$data[0]%", "% $data[0]%"
219
            "$data[0]%", "%$data[0]%", $regex, 
220
            "$data[0]%", "%$data[0]%", $regex 
219
        );
221
        );
220
        for ( my $i = 1 ; $i < $count ; $i++ ) {
222
        for ( my $i = 1 ; $i < $count ; $i++ ) {
221
            $query = $query . " AND (" . " surname LIKE ? OR surname LIKE ?
223
            $query = $query . " AND (" . " surname LIKE ? OR (surname LIKE ? AND surname REGEXP ?)
222
                OR firstname  LIKE ? OR firstname LIKE ?
224
                OR firstname  LIKE ? OR (firstname LIKE ? AND firstname REGEXP ?)
223
                OR othernames LIKE ? OR othernames LIKE ?)";
225
                OR othernames LIKE ? OR (othernames LIKE ? AND othernames REGEXP ?))";
226
            $regex = '[[:punct:][:space:]]'.$data[i];
224
            push( @bind,
227
            push( @bind,
225
                "$data[$i]%",   "% $data[$i]%", "$data[$i]%",
228
              "$data[i]%", "%$data[i]%", $regex,
226
                "% $data[$i]%", "$data[$i]%",   "% $data[$i]%" );
229
              "$data[i]%", "%$data[i]%", $regex,
230
              "$data[i]%", "%$data[i]%", $regex
231
            );
232
227
233
228
            # FIXME - .= <<EOT;
234
            # FIXME - .= <<EOT;
229
        }
235
        }
230
- 

Return to bug 4340