Skip to content

Commit

Permalink
[13092369] Fixed owners list to include only active users and teams. …
Browse files Browse the repository at this point in the history
…The users list and owners list now match the web client.
  • Loading branch information
jbest84 committed Jul 4, 2013
1 parent 2ed6be9 commit b84f26c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
33 changes: 32 additions & 1 deletion src/Views/Owner/List.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
define('Mobile/SalesLogix/Views/Owner/List', [
'dojo/_base/declare',
'dojo/string',
'dojo/_base/array',
'Sage/Platform/Mobile/List'
], function(
declare,
string,
array,
List
) {

Expand All @@ -22,12 +24,41 @@ define('Mobile/SalesLogix/Views/Owner/List', [
security: 'Entities/Owner/View',
queryOrderBy: 'OwnerDescription',
querySelect: [
'OwnerDescription'
'OwnerDescription',
'User/Enabled',
'User/Type'
],
resourceKind: 'owners',

formatSearchQuery: function(searchQuery) {
return string.substitute('upper(OwnerDescription) like "%${0}%"', [this.escapeSearchQuery(searchQuery.toUpperCase())]);
},
processFeed: function(feed) {
// Filter the feed in memory (SData cannot check if owner.User is null)
if (feed.$resources) {
feed.$resources = array.filter(feed.$resources, function(item) {
return this._userEnabled(item) && this._isCorrectType(item);
}, this);
}

this.inherited(arguments);
},
_userEnabled: function(item) {
// If User is null, it is probably a team
if (item.User === null || item.User.Enabled) {
return true;
}

return false;
},
_isCorrectType: function(item) {
// If user is null, it is probably a team
if (item.User === null) {
return true;
}

// Filter out WebViewer, Retired, Template and AddOn users like the user list does
return item.User.Type !== 3 && item.User.Type !== 5 && item.User.Type !== 6 && item.User.Type !== 7;
}
});
});
Expand Down
9 changes: 8 additions & 1 deletion src/Views/User/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ define('Mobile/SalesLogix/Views/User/List', [
//View Properties
id: 'user_list',
queryOrderBy: 'UserInfo.LastName asc, UserInfo.FirstName asc',
queryWhere: 'Enabled eq true',

// Excluded types for the queryWhere
// Type:
// 3 - WebViewer
// 5 - Retired
// 6 - Template
// 7 - AddOn
queryWhere: 'Enabled eq true and (Type ne 3 AND Type ne 5 AND Type ne 6 AND Type ne 7)',
querySelect: [
'UserInfo/FirstName',
'UserInfo/LastName',
Expand Down

2 comments on commit b84f26c

@rjledger
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI

  • The changes to Owner List.js work fine on a 754 system.
  • The changes to User List.js do NOT work as is on a 754 system since "Type" is enumerated. So one has to do:
    queryWhere: 'Enabled eq true and (Type ne "WebViewer" AND Type ne "Retired" AND Type ne "Template" AND Type ne "AddOn")',

These changes can be applied (if one wants/needs to) to a 2.0/2.1 as well.. and ALL work with the 2.x on 754

I'm going to add them to my customer deployed systems.

@jbest84
Copy link
Member Author

@jbest84 jbest84 commented on b84f26c Jul 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. I will note this for when I update the 7.5.4 compat module.

Please sign in to comment.