$name = '(' . join(' OR ', @ns) . ')';
}
- my $usr_where = join ' AND ', grep { $_ } ($usr,$phone,$ident,$name);
+ my $profile = '';
+ my @profv = ();
+ if ($prof) {
+ $profile = '(profile IN (SELECT id FROM permission.grp_descendants(?)))';
+ push @profv, $prof;
+ }
+ my $usr_where = join ' AND ', grep { $_ } ($usr,$phone,$ident,$name,$profile);
my $addr_where = $addr;
}
my $descendants = "actor.org_unit_descendants($search_org)";
- my $profile = "JOIN permission.grp_descendants($prof) p ON (p.id = users.profile)" if $prof;
my $opt_in_where = '';
if (lc($strict_opt_in) eq 'true') {
SELECT $distinct_list
FROM $u_table AS users $card
JOIN $descendants d ON (d.id = users.home_ou)
- $profile
$select
$clone_select
$penalty_join
OFFSET $offset
SQL
- return actor::user->db_Main->selectcol_arrayref($select, {Columns=>[scalar(@$sort)]}, map {lc($_)} (@usrv,@phonev,@identv,@namev,@addrv));
+ return actor::user->db_Main->selectcol_arrayref($select, {Columns=>[scalar(@$sort)]}, map {lc($_)} (@usrv,@phonev,@identv,@namev,@profv,@addrv));
}
__PACKAGE__->register_method(
api_name => 'open-ils.storage.actor.user.crazy_search',