dbo.QER_TUBaseTree
Database TriggerSQL_TRIGGERSandbox DB
Interpretation
- Database trigger. Treat parent table and enqueue/object-layer calls as the main relation points.
- DBQueue relation detected. Follow the task procedure and referenced-by list for async processing.
Relations
- Bulk DBQueue insert -> QER-K-ITSHOPOrder-RESET / QER_ZITShopOrderReset at line 11
- Bulk DBQueue insert -> QER-K-ITSHOPOrder-ABORT / QER_ZITShopOrderAbort at line 11
- Bulk DBQueue insert -> QER-K-ITSHOPOrder-ABORT / QER_ZITShopOrderAbort at line 11
- Bulk DBQueue insert -> QER-K-PersonCheckDynUser / QER_ZPersonCheckDynUser at line 11
- Bulk DBQueue insert -> QER-K-ITSHOPOrder-ABORT / QER_ZITShopOrderAbort at line 12
- Bulk DBQueue insert -> QER-K-ITSHOPOrder-ABORT / QER_ZITShopOrderAbort at line 12
- Bulk DBQueue insert -> QER-K-PersonCheckDynUser / QER_ZPersonCheckDynUser at line 12
- Bulk DBQueue insert -> QER-K-ITSHOPOrder-ABORT / QER_ZITShopOrderAbort at line 16
- Bulk DBQueue insert -> QER-K-PersonCheckDynUser / QER_ZPersonCheckDynUser at line 16
- Bulk DBQueue insert -> QER-K-PersonCheckDynUser / QER_ZPersonCheckDynUser at line 24
- Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 24
- Bulk DBQueue insert -> at line 24
- Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 47
- Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 47
- Bulk DBQueue insert -> QER-V-ITShopOrg at line 47
- Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 47
- Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 53
- Bulk DBQueue insert -> QER-V-ITShopOrg at line 53
- Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 53
- Single DBQueue insert -> QER-K-ShoppingRackPWODecisionMaker / QER_ZITShopDecisionMakerFill at line 53
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 53
- Bulk DBQueue insert -> QER-V-ITShopOrg at line 72
- Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 72
- Single DBQueue insert -> QER-K-ShoppingRackPWODecisionMaker / QER_ZITShopDecisionMakerFill at line 72
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 72
- Bulk DBQueue insert -> QER-K-OrgTreeLEVEL / QER_ZOrgTreeLevel at line 72
- Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 72
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 72
- Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 72
- Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 72
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 72
- Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 76
- Single DBQueue insert -> QER-K-ShoppingRackPWODecisionMaker / QER_ZITShopDecisionMakerFill at line 76
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 76
- Bulk DBQueue insert -> QER-K-OrgTreeLEVEL / QER_ZOrgTreeLevel at line 76
- Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 76
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 76
- Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 76
- Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 76
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 76
- Single DBQueue insert -> QER-K-ShoppingRackPWODecisionMaker / QER_ZITShopDecisionMakerFill at line 77
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 77
- Bulk DBQueue insert -> QER-K-OrgTreeLEVEL / QER_ZOrgTreeLevel at line 77
- Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 77
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 77
- Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 77
- Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 77
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 77
- Bulk DBQueue insert -> QER-K-AllForOnePerson / QER_ZAllForOnePerson at line 77
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 80
- Bulk DBQueue insert -> QER-K-OrgTreeLEVEL / QER_ZOrgTreeLevel at line 80
- Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 80
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 80
- Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 80
- Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 80
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 80
- Bulk DBQueue insert -> QER-K-AllForOnePerson / QER_ZAllForOnePerson at line 80
- Bulk DBQueue insert -> QER-K-OrgTreeLEVEL / QER_ZOrgTreeLevel at line 83
- Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 83
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 83
- Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 83
- Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 83
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 83
- Bulk DBQueue insert -> QER-K-AllForOnePerson / QER_ZAllForOnePerson at line 83
- Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 83
- Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 86
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 86
- Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 86
- Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 86
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 86
- Bulk DBQueue insert -> QER-K-AllForOnePerson / QER_ZAllForOnePerson at line 86
- Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 86
- Bulk DBQueue insert -> QER-K-AllForOneWorkdesk / QER_ZAllForOneWorkdesk at line 86
- Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 91
- Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 91
- Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 91
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 91
- Bulk DBQueue insert -> QER-K-AllForOnePerson / QER_ZAllForOnePerson at line 91
- Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 91
- Bulk DBQueue insert -> QER-K-AllForOneWorkdesk / QER_ZAllForOneWorkdesk at line 91
- Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 95
- Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 95
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 95
- Bulk DBQueue insert -> QER-K-AllForOnePerson / QER_ZAllForOnePerson at line 95
- Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 95
- Bulk DBQueue insert -> QER-K-AllForOneWorkdesk / QER_ZAllForOneWorkdesk at line 95
- Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 98
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 98
- Bulk DBQueue insert -> QER-K-AllForOnePerson / QER_ZAllForOnePerson at line 98
- Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 98
- Bulk DBQueue insert -> QER-K-AllForOneWorkdesk / QER_ZAllForOneWorkdesk at line 98
- Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 101
- Bulk DBQueue insert -> QER-K-AllForOnePerson / QER_ZAllForOnePerson at line 101
- Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 101
- Bulk DBQueue insert -> QER-K-AllForOneWorkdesk / QER_ZAllForOneWorkdesk at line 101
- Bulk DBQueue insert -> QER-K-AllForOnePerson / QER_ZAllForOnePerson at line 106
- Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 106
- Bulk DBQueue insert -> QER-K-AllForOneWorkdesk / QER_ZAllForOneWorkdesk at line 106
- Bulk DBQueue insert -> QER-K-AllForOneHardware / QER_ZAllForOneHardware at line 110
- Bulk DBQueue insert -> QER-K-AllForOneWorkdesk / QER_ZAllForOneWorkdesk at line 110
Typed Edges
- queues DBQueue task QER_ZITShopOrderReset at line 11 Bulk DBQueue insert -> QER-K-ITSHOPOrder-RESET / QER_ZITShopOrderReset at line 11
- queues DBQueue task QER_ZITShopOrderAbort at line 11 Bulk DBQueue insert -> QER-K-ITSHOPOrder-ABORT / QER_ZITShopOrderAbort at line 11
- queues DBQueue task QER_ZPersonCheckDynUser at line 11 Bulk DBQueue insert -> QER-K-PersonCheckDynUser / QER_ZPersonCheckDynUser at line 11
- queues DBQueue task QER_ZITShopOrderAbort at line 12 Bulk DBQueue insert -> QER-K-ITSHOPOrder-ABORT / QER_ZITShopOrderAbort at line 12
- queues DBQueue task QER_ZPersonCheckDynUser at line 12 Bulk DBQueue insert -> QER-K-PersonCheckDynUser / QER_ZPersonCheckDynUser at line 12
- queues DBQueue task QER_ZITShopOrderAbort at line 16 Bulk DBQueue insert -> QER-K-ITSHOPOrder-ABORT / QER_ZITShopOrderAbort at line 16
- queues DBQueue task QER_ZPersonCheckDynUser at line 16 Bulk DBQueue insert -> QER-K-PersonCheckDynUser / QER_ZPersonCheckDynUser at line 16
- queues DBQueue task QER_ZPersonCheckDynUser at line 24 Bulk DBQueue insert -> QER-K-PersonCheckDynUser / QER_ZPersonCheckDynUser at line 24
- queues DBQueue task QER_ZHelperHeadOrg at line 24 Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 24
- queues DBQueue task at line 24 Bulk DBQueue insert -> at line 24
- queues DBQueue task QER_ZHelperHeadOrg at line 47 Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 47
- queues DBQueue task QER-V-ITShopOrg at line 47 Bulk DBQueue insert -> QER-V-ITShopOrg at line 47
- queues DBQueue task QBM_ZRecalculate at line 47 Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 47
- queues DBQueue task QER_ZHelperHeadOrg at line 53 Bulk DBQueue insert -> QER-K-HelperHeadOrg / QER_ZHelperHeadOrg at line 53
- queues DBQueue task QER-V-ITShopOrg at line 53 Bulk DBQueue insert -> QER-V-ITShopOrg at line 53
- queues DBQueue task QBM_ZRecalculate at line 53 Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 53
- queues DBQueue task QER_ZITShopDecisionMakerFill at line 53 Single DBQueue insert -> QER-K-ShoppingRackPWODecisionMaker / QER_ZITShopDecisionMakerFill at line 53
- queues DBQueue task QER_ZITShopCheckMethodPR at line 53 Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 53
- queues DBQueue task QER-V-ITShopOrg at line 72 Bulk DBQueue insert -> QER-V-ITShopOrg at line 72
- queues DBQueue task QBM_ZRecalculate at line 72 Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 72
- queues DBQueue task QER_ZITShopDecisionMakerFill at line 72 Single DBQueue insert -> QER-K-ShoppingRackPWODecisionMaker / QER_ZITShopDecisionMakerFill at line 72
- queues DBQueue task QER_ZITShopCheckMethodPR at line 72 Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 72
- queues DBQueue task QER_ZOrgTreeLevel at line 72 Bulk DBQueue insert -> QER-K-OrgTreeLEVEL / QER_ZOrgTreeLevel at line 72
- queues DBQueue task QER_ZBaseTreeCollectionF at line 72 Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 72
- queues DBQueue task QER_ZITShopCheckMethodBO at line 72 Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 72
- queues DBQueue task QER_ZOrgInherite at line 72 Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 72
- queues DBQueue task QER_ZITShopProductNodeCheck at line 72 Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 72
- queues DBQueue task QBM_ZRecalculate at line 76 Single DBQueue insert -> QBM-K-CommonReCalculate / QBM_ZRecalculate at line 76
- queues DBQueue task QER_ZITShopDecisionMakerFill at line 76 Single DBQueue insert -> QER-K-ShoppingRackPWODecisionMaker / QER_ZITShopDecisionMakerFill at line 76
- queues DBQueue task QER_ZITShopCheckMethodPR at line 76 Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 76
- queues DBQueue task QER_ZOrgTreeLevel at line 76 Bulk DBQueue insert -> QER-K-OrgTreeLEVEL / QER_ZOrgTreeLevel at line 76
- queues DBQueue task QER_ZBaseTreeCollectionF at line 76 Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 76
- queues DBQueue task QER_ZITShopCheckMethodBO at line 76 Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 76
- queues DBQueue task QER_ZOrgInherite at line 76 Bulk DBQueue insert -> QER-K-OrgInherite / QER_ZOrgInherite at line 76
- queues DBQueue task QER_ZITShopProductNodeCheck at line 76 Bulk DBQueue insert -> QER-K-OrgAutoChild / QER_ZITShopProductNodeCheck at line 76
- queues DBQueue task QER_ZITShopDecisionMakerFill at line 77 Single DBQueue insert -> QER-K-ShoppingRackPWODecisionMaker / QER_ZITShopDecisionMakerFill at line 77
- queues DBQueue task QER_ZITShopCheckMethodPR at line 77 Bulk DBQueue insert -> QER-K-ShoppingRackProductNode / QER_ZITShopCheckMethodPR at line 77
- queues DBQueue task QER_ZOrgTreeLevel at line 77 Bulk DBQueue insert -> QER-K-OrgTreeLEVEL / QER_ZOrgTreeLevel at line 77
- queues DBQueue task QER_ZBaseTreeCollectionF at line 77 Bulk DBQueue insert -> QER-K-BaseTreeCollectionF / QER_ZBaseTreeCollectionF at line 77
- queues DBQueue task QER_ZITShopCheckMethodBO at line 77 Bulk DBQueue insert -> QER-K-ShoppingRackMethod / QER_ZITShopCheckMethodBO at line 77
Complete Source
1CREATE trigger QER_TUBaseTree2 ON BaseTree FOR3UPDATE NOT FOR Replication4AS5BEGIN6 DECLARE @PWOTaskToUse varchar(38) = dbo.QER_FGIPWOTaskToUse()7 BEGIN TRY8 IF EXISTS(9 SELECT TOP 1 110 FROM inserted)11 GOTO start12 IF EXISTS(13 SELECT TOP 1 114 FROM deleted)15 GOTO start16 RETURN start:17 DECLARE @GenProcID varchar(38)18 SELECT @GenProcID = dbo.QBM_FGISessionContext('')19 DECLARE @alt_uid_Org varchar(38)20 DECLARE @alt_uid_Orgroot varchar(38)21 DECLARE @neu_uid_Orgroot varchar(38)22 DECLARE @alt_uid_Parentorg varchar(38)23 DECLARE @neu_uid_Parentorg varchar(38)24 DECLARE @Ordernumber int25 DECLARE @OL_only_Upper BIT26 DECLARE @alt_isCutNode BIT27 DECLARE @neu_isCutNode BIT28 DECLARE @alt_ITShopInfo nvarchar(2)29 DECLARE @neu_ITShopInfo nvarchar(2)30 DECLARE @alt_ident_orgtype nvarchar(64)31 DECLARE @neu_ident_orgtype nvarchar(64)32 DECLARE @IsTopDown BIT33 DECLARE @QER_ITShop_OnWorkflowAssign varchar(16)34 IF35 UPDATE(UID_PWODecisionMethod)36 BEGIN37 SELECT38 @QER_ITShop_OnWorkflowAssign = dbo.QBM_FGIConfigparmValue('QER\ITShop\OnWorkflowAssign')39 IF @QER_ITShop_OnWorkflowAssign IN('RESET',40 'ABORT')41 BEGIN42 DECLARE @DBQueueElements_01 QBM_YDBQueueRaw43 INSERT INTO @DBQueueElements_01(Object,44 SubObject,45 GenProcID)46 SELECT47 x.uid,48 NULL,49 @GenProcID50 FROM(51 SELECT pwo.UID_PersonWantsOrg AS uid52 FROM BaseTree b53 JOIN deleted d54 ON b.UID_Org = d.UID_Org AND isnull(b.UID_PWODecisionMethod, '') <> isnull(d.UID_PWODecisionMethod, '') AND b.UID_PWODecisionMethod > ' '55 JOIN PersonWantsOrg pwo56 ON pwo.UID_Org = b.UID_Org AND pwo.OrderState IN('Assigned', 'Granted', 'New', 'OrderProduct', 'OrderProlongate',57 'OrderUnsubscribe', 'Waiting')) AS x58 IF @QER_ITShop_OnWorkflowAssign = 'RESET'59 BEGIN60 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-ITSHOPOrder-RESET',61 @DBQueueElements_0162 END63 IF @QER_ITShop_OnWorkflowAssign = 'ABORT'64 BEGIN65 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-ITSHOPOrder-ABORT',66 @DBQueueElements_0167 END68 END69 DECLARE @DBQueueElements_02 QBM_YDBQueueRaw70 INSERT INTO @DBQueueElements_02(Object,71 SubObject,72 GenProcID)73 SELECT74 x.uid,75 NULL,76 @GenProcID77 FROM(78 SELECT pwo.UID_PersonWantsOrg AS uid79 FROM BaseTree b80 JOIN deleted d81 ON b.UID_Org = d.UID_Org AND isnull(b.UID_PWODecisionMethod, '') <> isnull(d.UID_PWODecisionMethod, '') AND b.UID_PWODecisionMethod IS NULL82 JOIN PersonWantsOrg pwo83 ON pwo.UID_Org = b.UID_Org AND pwo.OrderState IN('Assigned', 'Granted', 'New', 'OrderProduct', 'OrderProlongate',84 'OrderUnsubscribe', 'Waiting')) AS x85 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-ITSHOPOrder-ABORT',86 @DBQueueElements_0287 END88 IF89 UPDATE(IsInvalidForDynamicGroup)90 BEGIN91 IF EXISTS(92 SELECT TOP 1 193 FROM deleted d94 JOIN BaseTree b95 ON d.UID_Org = b.UID_Org96 JOIN DynamicGroup g97 ON b.XObjectKey = g.ObjectKeyBaseTree98 WHERE99 d.IsInvalidForDynamicGroup = 0 AND b.IsInvalidForDynamicGroup = 1)100 BEGIN101 RAISERROR('#LDS#Change of IsInvalidForDynamicGroup is invalid because element is used for dynamic groups.|',102 18,103 1)104 WITH nowait105 END106 END107 IF108 UPDATE(UID_DialogGroup)109 BEGIN110 IF EXISTS(111 SELECT TOP 1 1112 FROM inserted i113 JOIN DialogGroup g114 ON i.UID_DialogGroup = g.UID_DialogGroup115 WHERE116 g.IsRoleBasedOnly = 0)117 BEGIN118 RAISERROR('#LDS#Assigment is only permitted for DialogGroup.IsRoleBasedOnly true.|',119 18,120 2)121 WITH nowait122 END123 DECLARE @DBQueueElements_03 QBM_YDBQueueRaw124 INSERT INTO @DBQueueElements_03(object,125 subobject,126 genprocid)127 SELECT128 x.uid,129 NULL,130 @GenProcID131 FROM(132 SELECT133 DISTINCT pio.uid_person AS uid134 FROM BaseTree b135 JOIN deleted d136 ON b.uid_org = d.uid_org AND isnull(b.UID_DialogGroup, '') <> isnull(d.UID_DialogGroup, '') AND b.uid_orgroot = 'QER-V-AERole'137 JOIN BaseTreecollection co138 ON b.uid_org = co.uid_ParentOrg139 JOIN personinBaseTree pio140 ON pio.uid_org = co.uid_org AND pio.XOrigin > 0) AS x141 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-PersonCheckDynUser',142 @DBQueueElements_03143 END144 IF145 UPDATE(uid_orgroot)146 BEGIN147 IF EXISTS(148 SELECT TOP 1 1149 FROM deleted d150 JOIN BaseTree b151 ON d.UID_Org = b.UID_Org152 WHERE153 d.UID_OrgRoot <> b.UID_OrgRoot)154 BEGIN155 RAISERROR('#LDS#Cannot update node because OrgRoot was changed.|',156 18,157 1)158 WITH nowait159 END160 END161 IF162 UPDATE(uid_Parentorg)163 BEGIN164 IF EXISTS(165 SELECT TOP 1 1166 FROM deleted d167 JOIN BaseTree b168 ON d.UID_Org = b.UID_Org169 LEFT170 OUTER171 JOIN BaseTree p172 ON b.UID_ParentOrg = p.UID_Org AND b.UID_OrgRoot = p.UID_OrgRoot173 WHERE174 b.UID_ParentOrg > ' ' AND p.UID_Org IS NULL)175 BEGIN176 RAISERROR('#LDS#Cannot change node, because predecessor does not exist in same role class.|',177 18,178 1)179 WITH nowait180 END181 IF EXISTS(182 SELECT TOP 1 1183 FROM deleted d184 JOIN BaseTree b185 ON d.UID_Org = b.UID_Org186 LEFT187 OUTER188 JOIN BaseTree sh189 ON b.UID_ParentOrg = sh.UID_Org AND sh.ITShopInfo = 'SH'190 WHERE191 b.UID_OrgRoot = 'QER-V-ITShopOrg' AND d.ITShopInfo = 'BO' AND isnull(d.UID_ParentOrg, '') <> isnull(b.UID_ParentOrg,192 '') AND sh.UID_Org IS NULL)193 BEGIN194 RAISERROR('#LDS#Cannot change shelf properties, because predecessor is not a Shop.|',195 18,196 2)197 WITH nowait198 END199 END200 IF201 UPDATE(ITShopInfo)202 BEGIN203 IF EXISTS(204 SELECT TOP 1 1205 FROM deleted d206 JOIN BaseTree b207 ON d.UID_Org = b.UID_Org208 WHERE209 b.ITShopInfo > ' ' AND b.UID_OrgRoot NOT IN('QER-V-ITShopOrg', 'QER-V-ITShopSrc'))210 BEGIN211 RAISERROR('#LDS#Cannot set IT Shop information, because role class is not suitable for IT Shop.|',212 18,213 2)214 WITH nowait215 END216 IF EXISTS(217 SELECT TOP 1 1218 FROM deleted d219 JOIN BaseTree b220 ON d.UID_Org = b.UID_Org221 JOIN BaseTree pr222 ON pr.UID_ParentOrg = d.UID_Org223 WHERE224 d.ITShopInfo = 'BO' AND isnull(b.ITShopInfo, '') <> 'BO')225 BEGIN226 RAISERROR('#LDS#Cannot change shelf in IT Shop, because product nodes still exist.|',227 18,228 2)229 WITH nowait230 END231 IF EXISTS(232 SELECT TOP 1 1233 FROM deleted d234 JOIN BaseTree b235 ON d.UID_Org = b.UID_Org236 JOIN BaseTree pa237 WITH(nolock)238 ON (b.UID_ParentOrg = pa.UID_Org OR d.UID_ParentOrg = pa.UID_Org)239 WHERE240 isnull(d.ITShopInfo, '') <> isnull(b.ITShopInfo, '') AND pa.ITShopInfo = 'BO')241 BEGIN242 RAISERROR('#LDS#Cannot change shelf property, because predecessor already is a shelf.|',243 18,244 2)245 WITH nowait246 END247 IF EXISTS(248 SELECT TOP 1 1249 FROM deleted d250 JOIN BaseTree b251 ON d.UID_Org = b.UID_Org252 WHERE253 b.UID_OrgRoot = 'QER-V-ITShopSrc' AND isnull(d.ITShopInfo, '') <> isnull(b.ITShopInfo, ''))254 BEGIN255 RAISERROR('#LDS#Cannot change shelf properties, because changing the type of template is not suitable for IT Shop Source.|',256 18,257 2)258 WITH nowait259 END260 IF EXISTS(261 SELECT TOP 1 1262 FROM deleted d263 JOIN BaseTree b264 ON d.UID_Org = b.UID_Org265 JOIN PersonInBaseTree pio266 ON b.UID_Org = pio.UID_Org267 WHERE268 b.UID_OrgRoot = 'QER-V-ITShopOrg' AND isnull(d.ITShopInfo, '') <> isnull(b.ITShopInfo, '') AND d.ITShopInfo = 'CU')269 BEGIN270 RAISERROR('#LDS#Cannot change IT Shop information, because customer assignment in shop already exists.|',271 18,272 2)273 WITH nowait274 END275 END276 IF277 UPDATE(uid_personhead) OR278 UPDATE(uid_personheadSecond)279 BEGIN280 DECLARE @DBQueueElements_04 QBM_YDBQueueRaw281 INSERT INTO @DBQueueElements_04(object,282 subobject,283 genprocid)284 SELECT285 x.uid,286 NULL,287 @GenProcID288 FROM(289 SELECT uid_personHead AS uid290 FROM inserted291 WHERE292 uid_personHead > ' '293 UNION294 SELECT uid_personHeadSecond AS uid295 FROM Inserted296 WHERE297 uid_personHeadSecond > ' '298 UNION299 SELECT uid_personHead AS uid300 FROM deleted301 WHERE302 uid_personHead > ' '303 UNION304 SELECT uid_personHeadSecond AS uid305 FROM deleted306 WHERE307 uid_personHeadSecond > ' '308 UNION309 SELECT us.UID_PersonReceiver AS uid310 FROM inserted i311 JOIN QERUniversalSubstitute us312 ON us.UID_PersonSender IN(i.UID_PersonHead, i.UID_PersonHeadSecond)313 WHERE314 us.IsCurrentlyActive = 1 AND us.UseForHeadOrg = 1315 UNION316 SELECT us.UID_PersonReceiver AS uid317 FROM deleted d318 JOIN QERUniversalSubstitute us319 ON us.UID_PersonSender IN(d.UID_PersonHead, d.UID_PersonHeadSecond)320 WHERE321 us.IsCurrentlyActive = 1 AND us.UseForHeadOrg = 1) AS x322 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-HelperHeadOrg',323 @DBQueueElements_04324 END325 IF326 UPDATE(UID_AERoleManager)327 BEGIN328 DECLARE @DBQueueElements_05 QBM_YDBQueueRaw329 INSERT INTO @DBQueueElements_05(object,330 subobject,331 genprocid)332 SELECT333 x.uid,334 NULL,335 @GenProcID336 FROM(337 SELECT pio.UID_Person AS uid338 FROM inserted i339 JOIN PersonInBaseTree pio340 ON i.UID_AERoleManager = pio.UID_Org341 UNION342 SELECT us.UID_PersonReceiver AS uid343 FROM inserted i344 JOIN PersonInBaseTree pio345 ON i.UID_AERoleManager = pio.UID_Org346 JOIN QERUniversalSubstitute us347 ON us.UID_PersonSender = pio.UID_Person348 WHERE349 us.IsCurrentlyActive = 1 AND us.UseForHeadOrg = 1350 UNION351 SELECT pio.UID_Person AS uid352 FROM deleted d353 JOIN PersonInBaseTree pio354 ON d.UID_AERoleManager = pio.UID_Org355 UNION356 SELECT us.UID_PersonReceiver AS uid357 FROM deleted d358 JOIN PersonInBaseTree pio359 ON d.UID_AERoleManager = pio.UID_Org360 JOIN QERUniversalSubstitute us361 ON us.UID_PersonSender = pio.UID_Person362 WHERE363 us.IsCurrentlyActive = 1 AND us.UseForHeadOrg = 1) AS x364 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-HelperHeadOrg',365 @DBQueueElements_05366 END367 IF368 UPDATE(UID_AERoleManager)369 BEGIN370 DECLARE @RecalcParameter_OX QBM_YCursorBuffer371 INSERT INTO @RecalcParameter_OX(UID1,372 ObjectKey1,373 Ident1)374 SELECT375 'QER-PWODecisionRule-OX',376 i.XObjectKey,377 'I'378 FROM inserted i379 EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_OX,380 @GenprocID381 END382 IF383 UPDATE(UID_OrgDepartment)384 BEGIN385 DECLARE @RecalcParameter_01 QBM_YCursorBuffer386 INSERT INTO @RecalcParameter_01(UID1,387 ObjectKey1,388 Ident1)389 SELECT390 y.DecisionRule,391 x.XObjectKey,392 'I'393 FROM(394 SELECT i.XObjectKey395 FROM inserted i396 WHERE397 i.UID_OrgRoot = 'QER-V-ITShopOrg') AS x398 JOIN(399 SELECT 'QER-PWODecisionRule-D0' AS DecisionRule400 UNION401 SELECT 'QER-PWODecisionRule-D1'402 UNION403 SELECT 'QER-PWODecisionRule-D2') AS y404 ON 1 = 1405 EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_01,406 @GenprocID407 END408 IF409 UPDATE(UID_OrgProfitCenter)410 BEGIN411 DECLARE @RecalcParameter_02 QBM_YCursorBuffer412 INSERT INTO @RecalcParameter_02(UID1,413 ObjectKey1,414 Ident1)415 SELECT416 y.DecisionRule,417 x.XObjectKey,418 'I'419 FROM(420 SELECT i.XObjectKey421 FROM inserted i422 WHERE423 i.UID_OrgRoot = 'QER-V-ITShopOrg') AS x424 JOIN(425 SELECT 'QER-PWODecisionRule-P0' AS DecisionRule426 UNION427 SELECT 'QER-PWODecisionRule-P1'428 UNION429 SELECT 'QER-PWODecisionRule-P2') AS y430 ON 1 = 1431 EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_02,432 @GenprocID433 END434 IF435 UPDATE(UID_AccProduct)436 BEGIN437 DECLARE @RecalcParameter_03 QBM_YCursorBuffer438 INSERT INTO @RecalcParameter_03(UID1,439 ObjectKey1,440 Ident1)441 SELECT442 y.DecisionRule,443 x.XObjectKey,444 'I'445 FROM(446 SELECT i.XObjectKey447 FROM inserted i448 WHERE449 i.UID_OrgRoot = 'QER-V-ITShopOrg') AS x450 JOIN(451 SELECT 'QER-PWODecisionRule-OA' AS DecisionRule) AS y452 ON 1 = 1453 EXEC QER_PITShopHelperFill_Recalc @RecalcParameter_03,454 @GenprocID455 END456 IF457 UPDATE(UID_OrgType) OR458 UPDATE(uid_rulercontainer) OR459 UPDATE(uid_rulercontainerIT) OR460 UPDATE(uid_parentorg)461 BEGIN462 IF @PWOTaskToUse > ' '463 BEGIN464 DECLARE @DBQueueElements_06 QBM_YDBQueueRaw465 INSERT INTO @DBQueueElements_06(object,466 subobject,467 genprocid)468 SELECT469 x.uid,470 NULL,471 @GenProcID472 FROM(473 SELECT pwo.UID_PersonWantsOrg AS uid474 FROM BaseTree b475 JOIN deleted d476 ON b.uid_org = d.uid_org AND isnull(b.uid_accproduct, '') <> isnull(d.uid_accproduct, '')477 JOIN PersonWantsOrg pwo478 ON (b.UID_Org = pwo.UID_Org OR b.UID_Org = pwo.UID_ITShopOrgFinal)479 WHERE480 b.ItshopInfo = 'PR' AND b.uid_OrgRoot = 'QER-V-ITShopOrg'481 UNION482 SELECT pwo.UID_PersonWantsOrg AS uid483 FROM BaseTree b484 JOIN deleted d485 ON b.uid_org = d.uid_org AND(isnull(b.uid_rulercontainer, '') <> isnull(d.uid_rulercontainer, '') OR isnull(b.uid_rulercontainerIT,486 '') <> isnull(d.uid_rulercontainerIT, '') OR isnull(b.uid_orgdepartment, '') <> isnull(d.uid_orgdepartment,487 '') OR isnull(b.uid_orgProfitCenter, '') <> isnull(d.uid_orgProfitCenter, ''))488 JOIN PersonWantsOrg pwo489 ON (b.UID_Org = pwo.UID_Org OR b.UID_Org = pwo.UID_OrgParent OR b.UID_Org = pwo.UID_OrgParentOfParent)490 WHERE491 b.ItshopInfo IN('PR', 'BO', 'SH') AND b.uid_OrgRoot = 'QER-V-ITShopOrg' AND pwo.OrderState LIKE 'Order%') AS x492 EXEC QBM_PDBQueueInsert_Bulk @PWOTaskToUse,493 @DBQueueElements_06494 IF EXISTS(495 SELECT TOP 1 1496 FROM BaseTree b497 JOIN deleted d498 ON b.uid_org = d.uid_org499 WHERE500 (b.uid_OrgRoot <> 'QER-V-ITShopOrg' OR isnull(b.ItshopInfo, '') = 'SC') AND(isnull(b.uid_rulercontainer,501 '') <> isnull(d.uid_rulercontainer, '') OR isnull(b.uid_rulercontainerIT, '') <> isnull(d.uid_rulercontainerIT,502 '') OR isnull(b.uid_orgdepartment, '') <> isnull(d.uid_orgdepartment, '') OR isnull(b.uid_orgProfitCenter,503 '') <> isnull(d.uid_orgProfitCenter, '') OR isnull(b.uid_parentorg, '') <> isnull(d.uid_parentorg, '')))504 BEGIN505 EXEC QBM_PDBQueueInsert_Single 'QBM-K-CommonReCalculate',506 @PWOTaskToUse,507 '',508 @GenProcID509 END510 END511 EXEC QBM_PDBQueueInsert_Single 'QER-K-ShoppingRackPWODecisionMaker',512 '',513 '',514 @GenProcID515 END516 IF517 UPDATE(uid_Accproduct)518 BEGIN519 DECLARE @DBQueueElements_07 QBM_YDBQueueRaw520 INSERT INTO @DBQueueElements_07(object,521 subobject,522 genprocid)523 SELECT524 x.uid,525 NULL,526 @GenProcID527 FROM(528 SELECT d.uid_org AS uid529 FROM BaseTree b530 JOIN deleted d531 ON b.uid_org = d.uid_org AND isnull(b.uid_accproduct, '') <> isnull(d.uid_accproduct, '')532 WHERE533 b.ItshopInfo = 'PR' AND b.uid_OrgRoot = 'QER-V-ITShopOrg') AS x534 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-ShoppingRackProductNode',535 @DBQueueElements_07536 END537 IF538 UPDATE(uid_parentorg)539 BEGIN540 DECLARE @DBQueueElements_08 QBM_YDBQueueRaw541 INSERT INTO @DBQueueElements_08(object,542 subobject,543 genprocid)544 SELECT545 x.uid,546 NULL,547 @GenProcID548 FROM(549 SELECT d.uid_org AS uid550 FROM BaseTree b551 JOIN deleted d552 ON b.uid_org = d.uid_org AND isnull(b.uid_parentorg, '') <> isnull(d.uid_parentorg, '')) AS x553 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-OrgTreeLEVEL',554 @DBQueueElements_08555 DECLARE @DBQueueElements_09 QBM_YDBQueueRaw556 INSERT INTO @DBQueueElements_09(object,557 subobject,558 genprocid)559 SELECT560 x.uid,561 NULL,562 @GenProcID563 FROM(564 SELECT d.UID_Org AS uid565 FROM deleted d566 UNION567 SELECT co.UID_Org568 FROM deleted d569 JOIN BaseTree i570 ON d.UID_Org = i.UID_Org571 JOIN BaseTreeCollectionF co572 ON co.UID_ParentOrg = d.UID_Org573 WHERE574 isnull(d.UID_ParentOrg, '') <> isnull(i.UID_ParentOrg, '')) AS x575 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-BaseTreeCollectionF',576 @DBQueueElements_09577 END578 IF579 UPDATE(uid_parentorg) OR580 UPDATE(UID_OrgType)581 BEGIN582 IF EXISTS(583 SELECT TOP 1 1584 FROM inserted i585 WHERE586 i.uid_OrgRoot = 'QER-V-ITShopOrg')587 BEGIN588 DECLARE @DBQueueElements_10 QBM_YDBQueueRaw589 INSERT INTO @DBQueueElements_10(object,590 subobject,591 genprocid)592 SELECT593 x.uid,594 NULL,595 @GenProcID596 FROM(597 SELECT pr.uid_org AS uid598 FROM(599 SELECT uid_org600 FROM inserted601 UNION602 SELECT uid_org603 FROM deleted604 UNION605 SELECT uid_parentorg606 FROM deleted607 UNION608 SELECT uid_parentorg609 FROM inserted) AS o610 JOIN BaseTreecollection co611 ON o.uid_org = co.uid_parentorg612 JOIN BaseTree bo613 ON co.uid_org = bo.uid_org AND bo.ITShopInfo = 'BO' AND bo.uid_OrgRoot = 'QER-V-ITShopOrg'614 JOIN BaseTree pr615 ON pr.uid_parentorg = bo.uid_Org AND pr.ITShopInfo = 'PR'616 UNION617 SELECT uid_Org618 FROM inserted pr619 WHERE620 pr.ITShopInfo = 'PR' AND pr.uid_OrgRoot = 'QER-V-ITShopOrg') AS x621 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-ShoppingRackProductNode',622 @DBQueueElements_10623 DECLARE @DBQueueElements_11 QBM_YDBQueueRaw624 INSERT INTO @DBQueueElements_11(object,625 subobject,626 genprocid)627 SELECT628 x.uid,629 NULL,630 @GenProcID631 FROM(632 SELECT b.uid_org AS uid633 FROM(634 SELECT uid_org635 FROM inserted636 UNION637 SELECT uid_org638 FROM deleted639 UNION640 SELECT uid_parentorg641 FROM deleted642 UNION643 SELECT uid_parentorg644 FROM inserted) AS o645 JOIN BaseTreecollection co646 ON o.uid_org = co.uid_parentorg647 JOIN BaseTree b648 ON co.uid_org = b.uid_org AND b.ITShopInfo = 'BO' AND b.uid_OrgRoot = 'QER-V-ITShopOrg') AS x649 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-ShoppingRackMethod',650 @DBQueueElements_11651 END652 END653 IF654 UPDATE(uid_parentorg) OR655 UPDATE(isCutnode)656 BEGIN657 DECLARE @DBQueueElements_12 QBM_YDBQueueRaw658 INSERT INTO @DBQueueElements_12(object,659 subobject,660 genprocid)661 SELECT662 x.uid,663 NULL,664 @GenProcID665 FROM(666 SELECT667 DISTINCT d.uid_org AS uid668 FROM BaseTree b669 JOIN deleted d670 ON b.uid_org = d.uid_org671 WHERE672 isnull(b.uid_parentorg, '') <> isnull(d.uid_parentorg, '') OR isnull(d.isCutnode, 0) <> isnull(b.isCutnode,673 0)) AS x674 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-OrgInherite',675 @DBQueueElements_12676 END677 IF678 UPDATE(ITShopInfo)679 BEGIN680 DECLARE @DBQueueElements_13 QBM_YDBQueueRaw681 INSERT INTO @DBQueueElements_13(object,682 subobject,683 genprocid)684 SELECT685 x.uid,686 NULL,687 @GenProcID688 FROM(689 SELECT d.uid_org AS uid690 FROM BaseTree b691 JOIN deleted d692 ON b.uid_org = d.uid_org AND d.uid_orgroot = 'QER-V-ITShopOrg' AND isnull(d.ITShopInfo, '') <> 'BO' AND isnull(b.ITShopInfo,693 '') = 'BO') AS x694 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild',695 @DBQueueElements_13696 END697 IF698 UPDATE(IsNoInheriteToPerson)699 BEGIN700 DECLARE @DBQueueElements_14 QBM_YDBQueueRaw701 INSERT INTO @DBQueueElements_14(object,702 subobject,703 genprocid)704 SELECT705 x.uid,706 NULL,707 @GenProcID708 FROM(709 SELECT h.uid_person AS uid710 FROM BaseTree b711 JOIN deleted d712 ON b.uid_org = d.uid_org713 JOIN helperPersonOrg h714 ON h.uid_org = b.uid_org715 WHERE716 isnull(d.IsNoInheriteToPerson, 0) <> isnull(b.IsNoInheriteToPerson, 0)717 UNION718 SELECT pio.uid_person AS uid719 FROM BaseTree b720 JOIN deleted d721 ON b.uid_org = d.uid_org722 JOIN personinBaseTree pio723 ON pio.uid_org = b.uid_org AND pio.XOrigin > 0724 WHERE725 isnull(d.IsNoInheriteToPerson, 0) <> isnull(b.IsNoInheriteToPerson, 0)) AS x726 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllForOnePerson',727 @DBQueueElements_14728 END729 IF730 UPDATE(IsNoInheriteToHardware)731 BEGIN732 DECLARE @DBQueueElements_15 QBM_YDBQueueRaw733 INSERT INTO @DBQueueElements_15(object,734 subobject,735 genprocid)736 SELECT737 x.uid,738 NULL,739 @GenProcID740 FROM(741 SELECT h.uid_Hardware AS uid742 FROM BaseTree b743 JOIN deleted d744 ON b.uid_org = d.uid_org745 JOIN helperHardwareOrg h746 ON h.uid_org = b.uid_org747 WHERE748 isnull(d.IsNoInheriteToHardware, 0) <> isnull(b.IsNoInheriteToHardware, 0)749 UNION750 SELECT pio.uid_Hardware AS uid751 FROM BaseTree b752 JOIN deleted d753 ON b.uid_org = d.uid_org754 JOIN HardwareinBaseTree pio755 ON pio.uid_org = b.uid_org AND pio.XOrigin > 0756 WHERE757 isnull(d.IsNoInheriteToHardware, 0) <> isnull(b.IsNoInheriteToHardware, 0)) AS x758 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllForOneHardware',759 @DBQueueElements_15760 END761 IF762 UPDATE(IsNoInheriteToWorkDesk)763 BEGIN764 DECLARE @DBQueueElements_16 QBM_YDBQueueRaw765 INSERT INTO @DBQueueElements_16(object,766 subobject,767 genprocid)768 SELECT769 x.uid,770 NULL,771 @GenProcID772 FROM(773 SELECT h.uid_WorkDesk AS uid774 FROM BaseTree b775 JOIN deleted d776 ON b.uid_org = d.uid_org777 JOIN helperWorkDeskOrg h778 ON h.uid_org = b.uid_org779 WHERE780 isnull(d.IsNoInheriteToWorkDesk, 0) <> isnull(b.IsNoInheriteToWorkDesk, 0)781 UNION782 SELECT pio.uid_WorkDesk AS uid783 FROM BaseTree b784 JOIN deleted d785 ON b.uid_org = d.uid_org786 JOIN WorkDeskinBaseTree pio787 ON pio.uid_org = b.uid_org AND pio.XOrigin > 0788 WHERE789 isnull(d.IsNoInheriteToWorkDesk, 0) <> isnull(b.IsNoInheriteToWorkDesk, 0)) AS x790 EXEC QBM_PDBQueueInsert_Bulk 'QER-K-AllForOneWorkdesk',791 @DBQueueElements_16792 END793 END TRY794 BEGIN CATCH795 EXEC QBM_PSessionErrorAdd DEFAULT796 RAISERROR('',797 18,798 1)799 WITH NOWAIT800 END CATCH801 RETURN802END
Open raw exported source
1create trigger QER_TUBaseTree on BaseTree for UPDATE not for Replication as begin declare @PWOTaskToUse varchar(38) = dbo.QER_FGIPWOTaskToUse2() BEGIN TRY if exists (select top 1 1 from inserted) goto start if exists (select top 1 1 from deleted) goto start return start: declare @GenProcID varchar3(38) select @GenProcID = dbo.QBM_FGISessionContext('') declare @alt_uid_Org varchar(38) declare @alt_uid_Orgroot varchar(38) declare @neu_uid_Orgroot4 varchar(38) declare @alt_uid_Parentorg varchar(38) declare @neu_uid_Parentorg varchar(38) declare @Ordernumber int declare @OL_only_Upper bit declare 5@alt_isCutNode bit declare @neu_isCutNode bit declare @alt_ITShopInfo nvarchar(2) declare @neu_ITShopInfo nvarchar(2) declare @alt_ident_orgtype nvarchar6(64) declare @neu_ident_orgtype nvarchar(64) declare @IsTopDown bit declare @QER_ITShop_OnWorkflowAssign varchar(16) if update(UID_PWODecisionMethod) begin7 select @QER_ITShop_OnWorkflowAssign = dbo.QBM_FGIConfigparmValue('QER\ITShop\OnWorkflowAssign') if @QER_ITShop_OnWorkflowAssign in ('RESET', 'ABORT') 8begin declare @DBQueueElements_01 QBM_YDBQueueRaw insert into @DBQueueElements_01(Object, SubObject, GenProcID) select x.uid, null, @GenProcID from ( select9 pwo.UID_PersonWantsOrg as uid from BaseTree b join deleted d on b.UID_Org = d.UID_Org and isnull(b.UID_PWODecisionMethod, '') <> isnull(d.UID_PWODecisionMethod10, '') and b.UID_PWODecisionMethod > ' ' join PersonWantsOrg pwo on pwo.UID_Org = b.UID_Org and pwo.OrderState in ('Assigned', 'Granted', 'New', 'OrderProduct'11, 'OrderProlongate', 'OrderUnsubscribe', 'Waiting') ) as x if @QER_ITShop_OnWorkflowAssign = 'RESET' begin exec QBM_PDBQueueInsert_Bulk 'QER-K-ITSHOPOrder-RESET'12, @DBQueueElements_01 end if @QER_ITShop_OnWorkflowAssign = 'ABORT' begin exec QBM_PDBQueueInsert_Bulk 'QER-K-ITSHOPOrder-ABORT', @DBQueueElements_01 end13 end declare @DBQueueElements_02 QBM_YDBQueueRaw insert into @DBQueueElements_02(Object, SubObject, GenProcID) select x.uid, null, @GenProcID from ( 14select pwo.UID_PersonWantsOrg as uid from BaseTree b join deleted d on b.UID_Org = d.UID_Org and isnull(b.UID_PWODecisionMethod, '') <> isnull(d.UID_PWODecisionMethod15, '') and b.UID_PWODecisionMethod is null join PersonWantsOrg pwo on pwo.UID_Org = b.UID_Org and pwo.OrderState in ('Assigned', 'Granted', 'New', 16'OrderProduct', 'OrderProlongate', 'OrderUnsubscribe', 'Waiting') ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-ITSHOPOrder-ABORT', @DBQueueElements_02 end17 if update(IsInvalidForDynamicGroup) begin if exists (select top 1 1 from deleted d join BaseTree b on d.UID_Org = b.UID_Org join DynamicGroup g on b.XObjectKey18 = g.ObjectKeyBaseTree where d.IsInvalidForDynamicGroup = 0 and b.IsInvalidForDynamicGroup = 1 ) begin raiserror( '#LDS#Change of IsInvalidForDynamicGroup is invalid because element is used for dynamic groups.|'19, 18, 1) with nowait end end if update(UID_DialogGroup) begin if exists (select top 1 1 from inserted i join DialogGroup g on i.UID_DialogGroup = g.UID_DialogGroup20 where g.IsRoleBasedOnly = 0 ) begin raiserror('#LDS#Assigment is only permitted for DialogGroup.IsRoleBasedOnly true.|', 18, 2) with nowait end declare21 @DBQueueElements_03 QBM_YDBQueueRaw insert into @DBQueueElements_03 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select distinct22 pio.uid_person as uid from BaseTree b join deleted d on b.uid_org = d.uid_org and isnull(b.UID_DialogGroup, '') <> isnull(d.UID_DialogGroup, '') and b.uid_orgroot23 = 'QER-V-AERole' join BaseTreecollection co on b.uid_org = co.uid_ParentOrg join personinBaseTree pio on pio.uid_org = co.uid_org and pio.XOrigin > 024 ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-PersonCheckDynUser', @DBQueueElements_03 end if update(uid_orgroot) begin if exists (select top 1 1 from 25deleted d join BaseTree b on d.UID_Org = b.UID_Org where d.UID_OrgRoot <> b.UID_OrgRoot ) begin raiserror('#LDS#Cannot update node because OrgRoot was changed.|'26, 18, 1) with nowait end end if update(uid_Parentorg) begin if exists (select top 1 1 from deleted d join BaseTree b on d.UID_Org = b.UID_Org left outer27 join BaseTree p on b.UID_ParentOrg = p.UID_Org and b.UID_OrgRoot = p.UID_OrgRoot where b.UID_ParentOrg > ' ' and p.UID_Org is null ) begin raiserror( 28'#LDS#Cannot change node, because predecessor does not exist in same role class.|', 18, 1) with nowait end if exists (select top 1 1 from deleted d join29 BaseTree b on d.UID_Org = b.UID_Org left outer join BaseTree sh on b.UID_ParentOrg = sh.UID_Org and sh.ITShopInfo = 'SH' where b.UID_OrgRoot = 'QER-V-ITShopOrg'30 and d.ITShopInfo = 'BO' and isnull(d.UID_ParentOrg, '') <> isnull(b.UID_ParentOrg, '') and sh.UID_Org is null ) begin raiserror( '#LDS#Cannot change shelf properties, because predecessor is not a Shop.|'31, 18, 2) with nowait end end if update(ITShopInfo) begin if exists (select top 1 1 from deleted d join BaseTree b on d.UID_Org = b.UID_Org where b.ITShopInfo32 > ' ' and b.UID_OrgRoot not in ('QER-V-ITShopOrg', 'QER-V-ITShopSrc') ) begin raiserror( '#LDS#Cannot set IT Shop information, because role class is not suitable for IT Shop.|'33, 18, 2) with nowait end if exists (select top 1 1 from deleted d join BaseTree b on d.UID_Org = b.UID_Org join BaseTree pr on pr.UID_ParentOrg = d.UID_Org34 where d.ITShopInfo = 'BO' and isnull( b.ITShopInfo , '') <> 'BO' ) begin raiserror( '#LDS#Cannot change shelf in IT Shop, because product nodes still exist.|'35, 18, 2) with nowait end if exists (select top 1 1 from deleted d join BaseTree b on d.UID_Org = b.UID_Org join BaseTree pa with (nolock) on ( b.UID_ParentOrg36 = pa.UID_Org or d.UID_ParentOrg = pa.UID_Org ) where isnull(d.ITShopInfo, '') <> isnull(b.ITShopInfo, '') and pa.ITShopInfo = 'BO' ) begin raiserror( 37'#LDS#Cannot change shelf property, because predecessor already is a shelf.|', 18, 2) with nowait end if exists (select top 1 1 from deleted d join BaseTree38 b on d.UID_Org = b.UID_Org where b.UID_OrgRoot = 'QER-V-ITShopSrc' and isnull(d.ITShopInfo, '') <> isnull(b.ITShopInfo, '') ) begin raiserror( '#LDS#Cannot change shelf properties, because changing the type of template is not suitable for IT Shop Source.|'39, 18, 2) with nowait end if exists (select top 1 1 from deleted d join BaseTree b on d.UID_Org = b.UID_Org join PersonInBaseTree pio on b.UID_Org = pio.UID_Org40 where b.UID_OrgRoot = 'QER-V-ITShopOrg' and isnull(d.ITShopInfo, '') <> isnull(b.ITShopInfo, '') and d.ITShopInfo = 'CU' ) begin raiserror( '#LDS#Cannot change IT Shop information, because customer assignment in shop already exists.|'41, 18, 2) with nowait end end if update(uid_personhead) or update(uid_personheadSecond) begin declare @DBQueueElements_0442 QBM_YDBQueueRaw insert into @DBQueueElements_04 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select uid_personHead as uid from43 inserted where uid_personHead > ' ' union select uid_personHeadSecond as uid from Inserted where uid_personHeadSecond > ' ' union select uid_personHead44 as uid from deleted where uid_personHead > ' ' union select uid_personHeadSecond as uid from deleted where uid_personHeadSecond > ' ' union select us.UID_PersonReceiver45 as uid from inserted i join QERUniversalSubstitute us on us.UID_PersonSender in (i.UID_PersonHead, i.UID_PersonHeadSecond) where us.IsCurrentlyActive 46= 1 and us.UseForHeadOrg = 1 union select us.UID_PersonReceiver as uid from deleted d join QERUniversalSubstitute us on us.UID_PersonSender in (d.UID_PersonHead47, d.UID_PersonHeadSecond) where us.IsCurrentlyActive = 1 and us.UseForHeadOrg = 1 ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-HelperHeadOrg', @DBQueueElements_0448 end if UPDATE(UID_AERoleManager) begin declare @DBQueueElements_05 QBM_YDBQueueRaw insert into @DBQueueElements_05 (object, subobject, genprocid) select49 x.uid, null, @GenProcID from( select pio.UID_Person as uid from inserted i join PersonInBaseTree pio on i.UID_AERoleManager = pio.UID_Org union select50 us.UID_PersonReceiver as uid from inserted i join PersonInBaseTree pio on i.UID_AERoleManager = pio.UID_Org join QERUniversalSubstitute us on us.UID_PersonSender51 = pio.UID_Person where us.IsCurrentlyActive = 1 and us.UseForHeadOrg = 1 union select pio.UID_Person as uid from deleted d join PersonInBaseTree pio on52 d.UID_AERoleManager = pio.UID_Org union select us.UID_PersonReceiver as uid from deleted d join PersonInBaseTree pio on d.UID_AERoleManager = pio.UID_Org53 join QERUniversalSubstitute us on us.UID_PersonSender = pio.UID_Person where us.IsCurrentlyActive = 1 and us.UseForHeadOrg = 1 ) as x exec QBM_PDBQueueInsert_Bulk54 'QER-K-HelperHeadOrg', @DBQueueElements_05 end if update(UID_AERoleManager) begin declare @RecalcParameter_OX QBM_YCursorBuffer insert into @RecalcParameter_OX55 (UID1, ObjectKey1, Ident1) select 'QER-PWODecisionRule-OX', i.XObjectKey, 'I' from inserted i exec QER_PITShopHelperFill_Recalc @RecalcParameter_OX, 56@GenprocID end if update(UID_OrgDepartment) begin declare @RecalcParameter_01 QBM_YCursorBuffer insert into @RecalcParameter_01 (UID1, ObjectKey1, Ident157) select y.DecisionRule, x.XObjectKey, 'I' from (select i.XObjectKey from inserted i where i.UID_OrgRoot = 'QER-V-ITShopOrg' ) as x join (select 'QER-PWODecisionRule-D0'58 as DecisionRule union select 'QER-PWODecisionRule-D1' union select 'QER-PWODecisionRule-D2' ) as y on 1 = 1 exec QER_PITShopHelperFill_Recalc @RecalcParameter_0159, @GenprocID end if update(UID_OrgProfitCenter) begin declare @RecalcParameter_02 QBM_YCursorBuffer insert into @RecalcParameter_02 (UID1, ObjectKey160, Ident1) select y.DecisionRule, x.XObjectKey, 'I' from (select i.XObjectKey from inserted i where i.UID_OrgRoot = 'QER-V-ITShopOrg' ) as x join (select61 'QER-PWODecisionRule-P0' as DecisionRule union select 'QER-PWODecisionRule-P1' union select 'QER-PWODecisionRule-P2' ) as y on 1 = 1 exec QER_PITShopHelperFill_Recalc62 @RecalcParameter_02, @GenprocID end if update(UID_AccProduct) begin declare @RecalcParameter_03 QBM_YCursorBuffer insert into @RecalcParameter_03 (UID163, ObjectKey1, Ident1) select y.DecisionRule, x.XObjectKey, 'I' from (select i.XObjectKey from inserted i where i.UID_OrgRoot = 'QER-V-ITShopOrg' ) as x64 join (select 'QER-PWODecisionRule-OA' as DecisionRule ) as y on 1 = 1 exec QER_PITShopHelperFill_Recalc @RecalcParameter_03, @GenprocID end if update65(UID_OrgType) or update(uid_rulercontainer) or update(uid_rulercontainerIT) or update(uid_parentorg) begin if @PWOTaskToUse > ' ' begin declare @DBQueueElements_0666 QBM_YDBQueueRaw insert into @DBQueueElements_06 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select pwo.UID_PersonWantsOrg as67 uid from BaseTree b join deleted d on b.uid_org = d.uid_org and isnull(b.uid_accproduct,'') <> isnull(d.uid_accproduct,'') join PersonWantsOrg pwo on 68(b.UID_Org = pwo.UID_Org or b.UID_Org = pwo.UID_ITShopOrgFinal ) where b.ItshopInfo = 'PR' and b.uid_OrgRoot = 'QER-V-ITShopOrg' union select pwo.UID_PersonWantsOrg69 as uid from BaseTree b join deleted d on b.uid_org = d.uid_org and ( isnull(b.uid_rulercontainer,'') <> isnull(d.uid_rulercontainer,'') or isnull(b.uid_rulercontainerIT70,'') <> isnull(d.uid_rulercontainerIT,'') or isnull(b.uid_orgdepartment,'') <> isnull(d.uid_orgdepartment,'') or isnull(b.uid_orgProfitCenter,'') <> isnull71(d.uid_orgProfitCenter,'') ) join PersonWantsOrg pwo on (b.UID_Org = pwo.UID_Org or b.UID_Org = pwo.UID_OrgParent or b.UID_Org = pwo.UID_OrgParentOfParent72 ) where b.ItshopInfo in ( 'PR', 'BO', 'SH') and b.uid_OrgRoot = 'QER-V-ITShopOrg' and pwo.OrderState like 'Order%' ) as x exec QBM_PDBQueueInsert_Bulk73 @PWOTaskToUse, @DBQueueElements_06 if exists (select top 1 1 from BaseTree b join deleted d on b.uid_org = d.uid_org where (b.uid_OrgRoot <> 'QER-V-ITShopOrg'74 or isnull(b.ItshopInfo, '') = 'SC' ) and ( isnull(b.uid_rulercontainer,'') <> isnull(d.uid_rulercontainer,'') or isnull(b.uid_rulercontainerIT,'') <> 75isnull(d.uid_rulercontainerIT,'') or isnull(b.uid_orgdepartment,'') <> isnull(d.uid_orgdepartment,'') or isnull(b.uid_orgProfitCenter,'') <> isnull(d.uid_orgProfitCenter76,'') or isnull(b.uid_parentorg,'') <> isnull(d.uid_parentorg,'') ) ) begin exec QBM_PDBQueueInsert_Single 'QBM-K-CommonReCalculate', @PWOTaskToUse, ''77, @GenProcID end end exec QBM_PDBQueueInsert_Single 'QER-K-ShoppingRackPWODecisionMaker', '', '', @GenProcID end if update(uid_Accproduct) begin declare78 @DBQueueElements_07 QBM_YDBQueueRaw insert into @DBQueueElements_07 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select d.uid_org79 as uid from BaseTree b join deleted d on b.uid_org = d.uid_org and isnull(b.uid_accproduct,'') <> isnull(d.uid_accproduct,'') where b.ItshopInfo = 'PR'80 and b.uid_OrgRoot = 'QER-V-ITShopOrg' ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-ShoppingRackProductNode', @DBQueueElements_07 end if update(uid_parentorg81) begin declare @DBQueueElements_08 QBM_YDBQueueRaw insert into @DBQueueElements_08 (object, subobject, genprocid) select x.uid, null, @GenProcID from82 ( select d.uid_org as uid from BaseTree b join deleted d on b.uid_org = d.uid_org and isnull(b.uid_parentorg,'') <> isnull(d.uid_parentorg,'') ) as x 83exec QBM_PDBQueueInsert_Bulk 'QER-K-OrgTreeLEVEL', @DBQueueElements_08 declare @DBQueueElements_09 QBM_YDBQueueRaw insert into @DBQueueElements_09 (object84, subobject, genprocid) select x.uid, null, @GenProcID from ( select d.UID_Org as uid from deleted d union select co.UID_Org from deleted d join BaseTree85 i on d.UID_Org = i.UID_Org join BaseTreeCollectionF co on co.UID_ParentOrg = d.UID_Org where isnull(d.UID_ParentOrg, '') <> isnull(i.UID_ParentOrg, ''86) ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-BaseTreeCollectionF', @DBQueueElements_09 end if update(uid_parentorg) or update(UID_OrgType) begin if exists87 (select top 1 1 from inserted i where i.uid_OrgRoot = 'QER-V-ITShopOrg' ) begin declare @DBQueueElements_10 QBM_YDBQueueRaw insert into @DBQueueElements_1088 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select pr.uid_org as uid from ( select uid_org from inserted union select uid_org89 from deleted union select uid_parentorg from deleted union select uid_parentorg from inserted ) as o join BaseTreecollection co on o.uid_org = co.uid_parentorg90 join BaseTree bo on co.uid_org = bo.uid_org and bo.ITShopInfo = 'BO' and bo.uid_OrgRoot = 'QER-V-ITShopOrg' join BaseTree pr on pr.uid_parentorg = bo.uid_Org91 and pr.ITShopInfo = 'PR' union select uid_Org from inserted pr where pr.ITShopInfo = 'PR' and pr.uid_OrgRoot = 'QER-V-ITShopOrg' ) as x exec QBM_PDBQueueInsert_Bulk92 'QER-K-ShoppingRackProductNode', @DBQueueElements_10 declare @DBQueueElements_11 QBM_YDBQueueRaw insert into @DBQueueElements_11 (object, subobject, genprocid93) select x.uid, null, @GenProcID from ( select b.uid_org as uid from ( select uid_org from inserted union select uid_org from deleted union select uid_parentorg94 from deleted union select uid_parentorg from inserted ) as o join BaseTreecollection co on o.uid_org = co.uid_parentorg join BaseTree b on co.uid_org95 = b.uid_org and b.ITShopInfo = 'BO' and b.uid_OrgRoot = 'QER-V-ITShopOrg' ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-ShoppingRackMethod', @DBQueueElements_1196 end end if update(uid_parentorg) or update(isCutnode) begin declare @DBQueueElements_12 QBM_YDBQueueRaw insert into @DBQueueElements_12 (object, subobject97, genprocid) select x.uid, null, @GenProcID from ( select distinct d.uid_org as uid from BaseTree b join deleted d on b.uid_org = d.uid_org where isnull98(b.uid_parentorg,'') <> isnull(d.uid_parentorg,'') or isnull(d.isCutnode,0) <> isnull(b.isCutnode,0) ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-OrgInherite'99, @DBQueueElements_12 end if update(ITShopInfo) begin declare @DBQueueElements_13 QBM_YDBQueueRaw insert into @DBQueueElements_13 (object, subobject100, genprocid) select x.uid, null, @GenProcID from ( select d.uid_org as uid from BaseTree b join deleted d on b.uid_org = d.uid_org and d.uid_orgroot = 101'QER-V-ITShopOrg' and isnull(d.ITShopInfo,'') <> 'BO' and isnull(b.ITShopInfo,'') = 'BO' ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-OrgAutoChild', @DBQueueElements_13102 end if update(IsNoInheriteToPerson) begin declare @DBQueueElements_14 QBM_YDBQueueRaw insert into @DBQueueElements_14 (object, subobject, genprocid) 103select x.uid, null, @GenProcID from ( select h.uid_person as uid from BaseTree b join deleted d on b.uid_org = d.uid_org join helperPersonOrg h on h.uid_org104 = b.uid_org where isnull(d.IsNoInheriteToPerson,0) <> isnull(b.IsNoInheriteToPerson,0) union select pio.uid_person as uid from BaseTree b join deleted105 d on b.uid_org = d.uid_org join personinBaseTree pio on pio.uid_org = b.uid_org and pio.XOrigin > 0 where isnull(d.IsNoInheriteToPerson,0) <> isnull(b.IsNoInheriteToPerson106,0) ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-AllForOnePerson', @DBQueueElements_14 end if update(IsNoInheriteToHardware) begin declare @DBQueueElements_15107 QBM_YDBQueueRaw insert into @DBQueueElements_15 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select h.uid_Hardware as uid from108 BaseTree b join deleted d on b.uid_org = d.uid_org join helperHardwareOrg h on h.uid_org = b.uid_org where isnull(d.IsNoInheriteToHardware,0) <> isnull109(b.IsNoInheriteToHardware,0) union select pio.uid_Hardware as uid from BaseTree b join deleted d on b.uid_org = d.uid_org join HardwareinBaseTree pio on110 pio.uid_org = b.uid_org and pio.XOrigin > 0 where isnull(d.IsNoInheriteToHardware,0) <> isnull(b.IsNoInheriteToHardware,0) ) as x exec QBM_PDBQueueInsert_Bulk111 'QER-K-AllForOneHardware', @DBQueueElements_15 end if update(IsNoInheriteToWorkDesk) begin declare @DBQueueElements_16 QBM_YDBQueueRaw insert into @DBQueueElements_16112 (object, subobject, genprocid) select x.uid, null, @GenProcID from ( select h.uid_WorkDesk as uid from BaseTree b join deleted d on b.uid_org = d.uid_org113 join helperWorkDeskOrg h on h.uid_org = b.uid_org where isnull(d.IsNoInheriteToWorkDesk,0) <> isnull(b.IsNoInheriteToWorkDesk,0) union select pio.uid_WorkDesk114 as uid from BaseTree b join deleted d on b.uid_org = d.uid_org join WorkDeskinBaseTree pio on pio.uid_org = b.uid_org and pio.XOrigin > 0 where isnull115(d.IsNoInheriteToWorkDesk,0) <> isnull(b.IsNoInheriteToWorkDesk,0) ) as x exec QBM_PDBQueueInsert_Bulk 'QER-K-AllForOneWorkdesk', @DBQueueElements_16 end116 END TRY BEGIN CATCH exec QBM_PSessionErrorAdd default RAISERROR ('', 18, 1) WITH NOWAIT END CATCH return end 117