DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

DeleteTab Stored Procedure

Sort:
You are not authorized to post a reply.





New Around Here





    Hello,

    I am hoping you can help or point me into the right direction.  We recently upgraded out DNN framework from v5.5.1 to V7.3.4.  After the upgrade was complete, we noticed our Tab menu reordering was rearranged.  We traced it down to the stored procedure of "DeleteTab".

     

    In V5.5.1 we have the following code in proc "DeleteTab"

     

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER procedure [dbo].[DeleteTab]

    @TabId int

    as

    delete from dbo.Tabs

    where  TabId = @TabId

    In V7.3.4, we have the following code in proc "DeleteTab".  We have traced it down to the update statement causing the reordering of our menu incorrectly. 

    My question is can you please help me understand why this code was introduced and/or if there is a fix for this? 

    If there is a fix, how do I update this stored procedure?  Any information you can point me to or provide would be greatly appreciated.

     

    /****** Object:  StoredProcedure [dbo].[DeleteTab]    Script Date: 05/15/2020 15:00:37 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER PROCEDURE [dbo].[DeleteTab]

        @TabId Int  -- ID of tab to delete; Not Null and > 0

    AS

    BEGIN

        DECLARE @TabOrder Int

        DECLARE @ParentId Int

        DECLARE @ContentItemId Int

        SELECT @TabOrder = TabOrder, @ParentId = ParentID, @ContentItemID = ContentItemID FROM dbo.[Tabs] WHERE TabID = @TabId

     

        -- Delete Tab --

        DELETE FROM dbo.[Tabs] WHERE  TabID = @TabId

     

        -- Update TabOrder of remaining Tabs --

        UPDATE dbo.[Tabs]

            SET TabOrder = TabOrder - 2

            WHERE IsNull(ParentID, -1) = IsNull(@ParentId , -1) AND TabOrder > @TabOrder

     

        -- Delete Content Item --

        DELETE FROM dbo.[ContentItems] WHERE ContentItemID = @ContentItemId

    END

     

    Thanks!






    Growing Member





      Hi,

      Please note that I haven't tried or tested this, but the SP from 9.6.1 looks better indeed:
      
      ALTER PROCEDURE [dbo].[DeleteTab]
        @TabId INT  -- ID of tab to delete; Not Null and > 0
      AS
      BEGIN
          DECLARE @TabOrder INT
          DECLARE @ParentId INT
          DECLARE @ContentItemId INT
      	DECLARE @PortalId INT
          SELECT @TabOrder = TabOrder, @ParentId = ParentID, @ContentItemID = ContentItemID, @PortalId = PortalID FROM dbo.[Tabs] WHERE TabID = @TabId
      
          -- Delete Tab --
          DELETE FROM dbo.[Tabs] WHERE TabID = @TabId
      
          -- Update TabOrder of remaining Tabs --
          UPDATE dbo.[Tabs]
              SET TabOrder = TabOrder - 2
              WHERE ISNULL(ParentID, -1) = ISNULL(@ParentId , -1) AND TabOrder > @TabOrder 
      		AND (PortalID = @PortalId OR (PortalID IS NULL AND @PortalId IS NULL))
      
          -- Delete Content Item --
          DELETE FROM dbo.[ContentItems] WHERE ContentItemID = @ContentItemId
      END
       


      You could try this one on your installation and see if that helps. (But do it on a test system first, create backups etc.)
      Obviously it would be better to upgrade to a newer version of DNN, but I'm assuming you took 7.3.4 for a reason...

      Hope this helps
      You are not authorized to post a reply.

      These Forums are dedicated to the discussion of DNN Platform.

      For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

      1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
      2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
      3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
      4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
      5. No Flaming or Trolling.
      6. No Profanity, Racism, or Prejudice.
      7. Site Moderators have the final word on approving / removing a thread or post or comment.
      8. English language posting only, please.

      Would you like to help us?

      Awesome! Simply post in the forums using the link below and we'll get you started.

      Get Involved