Bug in mp_Users_SelectSearchPage procedure?

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
2/5/2012 1:03:51 PM
Gravatar
Total Posts 6

Bug in mp_Users_SelectSearchPage procedure?

Hi Joe,

The method SiteUser.GetUserSearchPage will calls dbsiteuser.GetUserSearchPage which in turns call 2 procedures:

mp_Users_CountForSearch, mp_Users_SelectSearchPage

I notice the WHERE clauses in mp_Users_SelectSearchPage is different from the countforsearch.

Is this a bug?

Original SQL:

IF @SearchInput IS NULL OR @SearchInput = ''
BEGIN
INSERT INTO     #PageIndexForUsers (UserID)

SELECT     UserID
FROM         mp_Users
WHERE
SiteID = @SiteID

ORDER BY     [Name]
END
ELSE
BEGIN
INSERT INTO     #PageIndexForUsers (UserID)

SELECT     UserID
FROM         mp_Users
WHERE
SiteID = @SiteID

AND (
([Name]  LIKE '%' + @SearchInput + '%')
OR ([LoginName]  LIKE '%' + @SearchInput + '%')
)

ORDER BY     [Name]

END

Possible correction:

IF @SearchInput IS NULL OR @SearchInput = ''
BEGIN
INSERT INTO     #PageIndexForUsers (UserID)

SELECT     UserID
FROM         mp_Users
WHERE
SiteID = @SiteID

AND ProfileApproved = 1
AND DisplayInMemberList = 1
AND IsDeleted = 0

ORDER BY     [Name]
END
ELSE
BEGIN
INSERT INTO     #PageIndexForUsers (UserID)

SELECT     UserID
FROM         mp_Users
WHERE
SiteID = @SiteID

AND u.ProfileApproved = 1
AND u.DisplayInMemberList = 1
AND u.IsDeleted = 0

AND (
([Name]  LIKE '%' + @SearchInput + '%')
OR ([LoginName]  LIKE '%' + @SearchInput + '%')
)

ORDER BY     [Name]

END

2/6/2012 7:29:16 AM
Gravatar
Total Posts 18439

Re: Bug in mp_Users_SelectSearchPage procedure?

Hi Hung,

I agree with your fix. I've added an alter procedure in a new upgrade script for 2.3.8.2. It is in the repository now, but the setup page won't run this script until I change the version in mojoPortal.Business.DatabaseHelper.DBSchemaVersion

This means I can still edit the 2.3.8.2 upgrade script, once I increment the version and push it to the default branch then I can no longer edit the script because it will be executed.

So you can manually change it in your db for now and this script will run later but will just do the same change plus any other changes I may make in that script between now and then.

The setup system works a little different for mojoPortal core than for features. For features the setup page will run any scripts it finds that are newer than the current version of the feature, but for mojoPortal core it does an extra check against this method in DatabaseHelper and only runs scripts up to the version indicated there that are higher versions than ones previously run.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.