FIXED wsp-10028 Domain Search is yielding incorrect results
This commit is contained in:
parent
72ea943799
commit
cc106329a6
2 changed files with 151 additions and 3 deletions
|
@ -6455,3 +6455,143 @@ END
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ALTER PROCEDURE [dbo].[SearchServiceItemsPaged]
|
||||||
|
(
|
||||||
|
@ActorID int,
|
||||||
|
@UserID int,
|
||||||
|
@ItemTypeID int,
|
||||||
|
@FilterValue nvarchar(50) = '',
|
||||||
|
@SortColumn nvarchar(50),
|
||||||
|
@StartRow int,
|
||||||
|
@MaximumRows int
|
||||||
|
)
|
||||||
|
AS
|
||||||
|
|
||||||
|
|
||||||
|
-- check rights
|
||||||
|
IF dbo.CheckActorUserRights(@ActorID, @UserID) = 0
|
||||||
|
RAISERROR('You are not allowed to access this account', 16, 1)
|
||||||
|
|
||||||
|
-- build query and run it to the temporary table
|
||||||
|
DECLARE @sql nvarchar(2000)
|
||||||
|
|
||||||
|
IF @ItemTypeID <> 13
|
||||||
|
BEGIN
|
||||||
|
SET @sql = '
|
||||||
|
DECLARE @EndRow int
|
||||||
|
SET @EndRow = @StartRow + @MaximumRows
|
||||||
|
DECLARE @Items TABLE
|
||||||
|
(
|
||||||
|
ItemPosition int IDENTITY(1,1),
|
||||||
|
ItemID int
|
||||||
|
)
|
||||||
|
INSERT INTO @Items (ItemID)
|
||||||
|
SELECT
|
||||||
|
SI.ItemID
|
||||||
|
FROM ServiceItems AS SI
|
||||||
|
INNER JOIN Packages AS P ON P.PackageID = SI.PackageID
|
||||||
|
INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID
|
||||||
|
WHERE
|
||||||
|
dbo.CheckUserParent(@UserID, P.UserID) = 1
|
||||||
|
AND SI.ItemTypeID = @ItemTypeID
|
||||||
|
'
|
||||||
|
|
||||||
|
IF @FilterValue <> ''
|
||||||
|
SET @sql = @sql + ' AND SI.ItemName LIKE @FilterValue '
|
||||||
|
|
||||||
|
IF @SortColumn = '' OR @SortColumn IS NULL
|
||||||
|
SET @SortColumn = 'ItemName'
|
||||||
|
|
||||||
|
SET @sql = @sql + ' ORDER BY ' + @SortColumn + ' '
|
||||||
|
|
||||||
|
SET @sql = @sql + ' SELECT COUNT(ItemID) FROM @Items;
|
||||||
|
SELECT
|
||||||
|
|
||||||
|
SI.ItemID,
|
||||||
|
SI.ItemName,
|
||||||
|
|
||||||
|
P.PackageID,
|
||||||
|
P.PackageName,
|
||||||
|
P.StatusID,
|
||||||
|
P.PurchaseDate,
|
||||||
|
|
||||||
|
-- user
|
||||||
|
P.UserID,
|
||||||
|
U.Username,
|
||||||
|
U.FirstName,
|
||||||
|
U.LastName,
|
||||||
|
U.FullName,
|
||||||
|
U.RoleID,
|
||||||
|
U.Email
|
||||||
|
FROM @Items AS I
|
||||||
|
INNER JOIN ServiceItems AS SI ON I.ItemID = SI.ItemID
|
||||||
|
INNER JOIN Packages AS P ON SI.PackageID = P.PackageID
|
||||||
|
INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID
|
||||||
|
WHERE I.ItemPosition BETWEEN @StartRow AND @EndRow'
|
||||||
|
END
|
||||||
|
ELSE
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
SET @SortColumn = REPLACE(@SortColumn, 'ItemName', 'DomainName')
|
||||||
|
|
||||||
|
SET @sql = '
|
||||||
|
DECLARE @EndRow int
|
||||||
|
SET @EndRow = @StartRow + @MaximumRows
|
||||||
|
DECLARE @Items TABLE
|
||||||
|
(
|
||||||
|
ItemPosition int IDENTITY(1,1),
|
||||||
|
ItemID int
|
||||||
|
)
|
||||||
|
INSERT INTO @Items (ItemID)
|
||||||
|
SELECT
|
||||||
|
D.DomainID
|
||||||
|
FROM Domains AS D
|
||||||
|
INNER JOIN Packages AS P ON P.PackageID = D.PackageID
|
||||||
|
INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID
|
||||||
|
WHERE
|
||||||
|
dbo.CheckUserParent(@UserID, P.UserID) = 1
|
||||||
|
'
|
||||||
|
|
||||||
|
IF @FilterValue <> ''
|
||||||
|
SET @sql = @sql + ' AND D.DomainName LIKE @FilterValue '
|
||||||
|
|
||||||
|
IF @SortColumn = '' OR @SortColumn IS NULL
|
||||||
|
SET @SortColumn = 'DomainName'
|
||||||
|
|
||||||
|
SET @sql = @sql + ' ORDER BY ' + @SortColumn + ' '
|
||||||
|
|
||||||
|
SET @sql = @sql + ' SELECT COUNT(ItemID) FROM @Items;
|
||||||
|
SELECT
|
||||||
|
|
||||||
|
D.DomainID AS ItemID,
|
||||||
|
D.DomainName AS ItemName,
|
||||||
|
|
||||||
|
P.PackageID,
|
||||||
|
P.PackageName,
|
||||||
|
P.StatusID,
|
||||||
|
P.PurchaseDate,
|
||||||
|
|
||||||
|
-- user
|
||||||
|
P.UserID,
|
||||||
|
U.Username,
|
||||||
|
U.FirstName,
|
||||||
|
U.LastName,
|
||||||
|
U.FullName,
|
||||||
|
U.RoleID,
|
||||||
|
U.Email
|
||||||
|
FROM @Items AS I
|
||||||
|
INNER JOIN Domains AS D ON I.ItemID = D.DomainID
|
||||||
|
INNER JOIN Packages AS P ON D.PackageID = P.PackageID
|
||||||
|
INNER JOIN UsersDetailed AS U ON P.UserID = U.UserID
|
||||||
|
WHERE I.ItemPosition BETWEEN @StartRow AND @EndRow AND D.IsDomainPointer=0'
|
||||||
|
END
|
||||||
|
|
||||||
|
exec sp_executesql @sql, N'@StartRow int, @MaximumRows int, @UserID int, @FilterValue nvarchar(50), @ItemTypeID int, @ActorID int',
|
||||||
|
@StartRow, @MaximumRows, @UserID, @FilterValue, @ItemTypeID, @ActorID
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
GO
|
|
@ -5,11 +5,19 @@
|
||||||
</configSections>
|
</configSections>
|
||||||
<!-- Connection strings -->
|
<!-- Connection strings -->
|
||||||
<connectionStrings>
|
<connectionStrings>
|
||||||
<add name="EnterpriseServer" connectionString="Server=(local)\SQLExpress;Database=WebsitePanel;uid=sa;pwd=Password12" providerName="System.Data.SqlClient" />
|
<!--
|
||||||
|
<add name="EnterpriseServer" connectionString="server=HSTPROV01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=aj7ep6fyhmw3b5qeth7c;" />
|
||||||
|
<add name="EnterpriseServer" connectionString="server=HSTWSP01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=pserxfbnlc6hwmdedbp0;" providerName="System.Data.SqlClient" />
|
||||||
|
-->
|
||||||
|
<add name="EnterpriseServer" connectionString="server=HSTPROV01;database=WebsitePanelMerge;uid=WebsitePanel;pwd=aj7ep6fyhmw3b5qeth7c;" />
|
||||||
</connectionStrings>
|
</connectionStrings>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<!-- Encryption util settings -->
|
<!-- A1D4KDHUE83NKHddF -->
|
||||||
<add key="WebsitePanel.CryptoKey" value="1234567890" />
|
<!--
|
||||||
|
<add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" />
|
||||||
|
<add key="WebsitePanel.CryptoKey" value="fr2ym4wn2gmbrj7dz336" />
|
||||||
|
-->
|
||||||
|
<add key="WebsitePanel.CryptoKey" value="3x7eqt7zabc5n5afs6dg" />
|
||||||
<!-- A1D4KDHUE83NKHddF -->
|
<!-- A1D4KDHUE83NKHddF -->
|
||||||
<add key="WebsitePanel.EncryptionEnabled" value="true" />
|
<add key="WebsitePanel.EncryptionEnabled" value="true" />
|
||||||
<!-- Web Applications -->
|
<!-- Web Applications -->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue