$sortdir = $cgi->param('searchSortDir') if $cgi->param('searchSortDir');
$sortdir ||= '';
- $terms .= " " if ($terms);
+ $terms .= " " if ($terms && $cgi->param('searchTerms'));
$terms .= $cgi->param('searchTerms') if $cgi->param('searchTerms');
$class = $cgi->param('searchClass') if $cgi->param('searchClass');
$org_unit = $actor->request(
'open-ils.actor.org_unit_list.search' => parent_ou => undef
)->gather(1);
- } else {
+ } elsif ($org !~ /^\d+$/o) {
$org_unit = $actor->request(
'open-ils.actor.org_unit_list.search' => shortname => uc($org)
)->gather(1);
+ } else {
+ $org_unit = $actor->request(
+ 'open-ils.actor.org_unit_list.search' => id => $org
+ )->gather(1);
}
my $recs = $search->request(
org_unit => $org_unit->[0]->id,
offset => $offset - 1,
limit => $limit,
+ sort => $sort,
+ sort_dir => $sortdir,
($lang ? ( 'language' => $lang ) : ()),
} => $terms => 1
)->gather(1);