Merge commit '63865eb39f' into WebGUI8. up to 7.9.11
This commit is contained in:
commit
7b218942b3
72 changed files with 3085 additions and 407 deletions
|
|
@ -350,7 +350,8 @@ sub view {
|
|||
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
my $url = $self->session->url;
|
||||
my $url = $self->session->url;
|
||||
my $dbh = $self->session->db->dbh;
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_UserList");
|
||||
my (%var, @users, @profileField_loop, @profileFields);
|
||||
my ($user, $sth, $sql, $profileField);
|
||||
|
|
@ -432,7 +433,6 @@ sub view {
|
|||
# Query user profile data. Exclude the visitor account and users that have been deactivated.
|
||||
$sql = "select distinct users.userId, users.userName, userProfileData.publicProfile ";
|
||||
# Include remaining profile fields in the query
|
||||
my $dbh = $self->session->db->dbh;
|
||||
foreach my $profileField (@profileFields){
|
||||
$sql .= ", userProfileData." . $dbh->quote_identifier($profileField->{fieldName});
|
||||
}
|
||||
|
|
@ -441,22 +441,22 @@ sub view {
|
|||
|
||||
my $constraint;
|
||||
my @profileSearchFields = ();
|
||||
my $searchType = $form->process('searchType') || 'or';
|
||||
my $searchType = lc $form->process('searchType') eq 'and' ? 'and' : 'or';
|
||||
if ($form->process('search')){
|
||||
# Normal search with one keyword takes precedence over other search options
|
||||
if($form->process('limitSearch')){
|
||||
# Normal search with one keyword in a limited number of fields
|
||||
foreach my $profileField (@profileFields){
|
||||
if ($form->process('includeInSearch_'.$profileField->{fieldName})){
|
||||
push(@profileSearchFields,'userProfileData.'.$profileField->{fieldName}
|
||||
.' like "%'.$form->process('search').'%"');
|
||||
push(@profileSearchFields, 'userProfileData.'.$dbh->quote_identifier($profileField->{fieldName})
|
||||
.' like '. $dbh->quote('%'.$form->process('search').'%'));
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
# Normal search with one keyword in all fields
|
||||
$constraint = "(".join(' or ', map {'userProfileData.'.$_->{fieldName}
|
||||
.' like "%'.$form->process('search').'%"'} @profileFields).")";
|
||||
$constraint = "(".join(' or ', map {'userProfileData.'.$dbh->quote_identifier($_->{fieldName})
|
||||
.' like '.$dbh->quote('%'.$form->process('search').'%')} @profileFields).")";
|
||||
}
|
||||
}
|
||||
elsif ($form->process('searchExact')){
|
||||
|
|
@ -465,15 +465,15 @@ sub view {
|
|||
# Exact search with one keyword in a limited number of fields
|
||||
foreach my $profileField (@profileFields){
|
||||
if ($form->process('includeInSearch_'.$profileField->{fieldName})){
|
||||
push(@profileSearchFields,'userProfileData.'.$profileField->{fieldName}
|
||||
.' like "'.$form->process('search').'"');
|
||||
push(@profileSearchFields,'userProfileData.'.$dbh->quote_identifier($profileField->{fieldName})
|
||||
.' like '.$dbh->quote($form->process('search')));
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
# Exact search with one keyword in all fields
|
||||
$constraint = "(".join(' or ', map {'userProfileData.'.$_->{fieldName}
|
||||
.' like "'.$form->process('searchExact').'"'} @profileFields).")";
|
||||
$constraint = "(".join(' or ', map {'userProfileData.'.$dbh->quote_identifier($_->{fieldName})
|
||||
.' like ' . $dbh->quote($form->process('searchExact'))} @profileFields).")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
|
@ -481,12 +481,12 @@ sub view {
|
|||
foreach my $profileField (@profileFields){
|
||||
# Exact search has precedence over normal search
|
||||
if ($form->process('searchExact_'.$profileField->{fieldName})){
|
||||
push(@profileSearchFields,'userProfileData.'.$profileField->{fieldName}
|
||||
.' like "'.$form->process('searchExact_'.$profileField->{fieldName}).'"');
|
||||
push(@profileSearchFields,'userProfileData.'.$dbh->quote_identifier($profileField->{fieldName})
|
||||
.' like '. $dbh->quote($form->process('searchExact_'.$profileField->{fieldName})));
|
||||
}
|
||||
elsif ($form->process('search_'.$profileField->{fieldName})){
|
||||
push(@profileSearchFields,'userProfileData.'.$profileField->{fieldName}
|
||||
.' like "%'.$form->process('search_'.$profileField->{fieldName}).'%"');
|
||||
push(@profileSearchFields,'userProfileData.'.$dbh->quote_identifier($profileField->{fieldName})
|
||||
.' like '. $dbh->quote('%'.$form->process('search_'.$profileField->{fieldName})));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -495,14 +495,17 @@ sub view {
|
|||
}
|
||||
$sql .= " and ".$constraint if ($constraint);
|
||||
|
||||
my $sortBy = $form->process('sortBy') || $self->sortBy || 'users.username';
|
||||
my $sortBy = $form->process('sortBy') || $self->sortBy || 'users.username';
|
||||
my $sortOrder = $form->process('sortOrder') || $self->sortOrder || 'asc';
|
||||
|
||||
if (lc $sortOrder ne 'desc') {
|
||||
$sortOrder = 'asc';
|
||||
}
|
||||
|
||||
my @sortByUserProperties = ('dateCreated', 'lastUpdated', 'karma', 'userId');
|
||||
if(isIn($sortBy,@sortByUserProperties)){
|
||||
$sortBy = 'users.'.$sortBy;
|
||||
}
|
||||
$sortBy = join '.', map { $self->session->db->quoteIdentifier($_) } split /\./, $sortBy;
|
||||
$sortBy = join '.', map { $dbh->quote_identifier($_) } split /\./, $sortBy;
|
||||
$sql .= " order by ".$sortBy." ".$sortOrder;
|
||||
|
||||
my $paginatePage = $form->param('pn') || 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue