From ca54382924f5a27063eabbc5b2a81b3d44496b58 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期四, 14 四月 2022 15:30:59 +0800
Subject: [PATCH] PIPLController0414

---
 force-app/main/default/triggers/OrderTrigger.trigger         |    8 ++++++++
 force-app/main/default/triggers/UserFaultInfoTrigger.trigger |    3 +++
 force-app/main/default/triggers/loanerAppStatusUp.trigger    |    3 +++
 force-app/main/default/triggers/OpportunityTrigger.trigger   |    3 +++
 force-app/main/default/triggers/SWOTrigger.trigger           |    5 ++++-
 force-app/main/default/triggers/ContactTrigger.trigger       |    5 ++++-
 6 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/force-app/main/default/triggers/ContactTrigger.trigger b/force-app/main/default/triggers/ContactTrigger.trigger
index 9e99031..a878a2e 100644
--- a/force-app/main/default/triggers/ContactTrigger.trigger
+++ b/force-app/main/default/triggers/ContactTrigger.trigger
@@ -1,5 +1,8 @@
 trigger ContactTrigger on Contact (before insert, before update, after insert) {
-	if (Trigger.isBefore && Trigger.isInsert) {
+    if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){
+        return;
+    }
+    if (Trigger.isBefore && Trigger.isInsert) {
 		ContactTriggerHandler.setIsNew(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap);
 	}
 	if (Trigger.isBefore && Trigger.isUpdate) {
diff --git a/force-app/main/default/triggers/OpportunityTrigger.trigger b/force-app/main/default/triggers/OpportunityTrigger.trigger
index 4997717..32a5fd8 100644
--- a/force-app/main/default/triggers/OpportunityTrigger.trigger
+++ b/force-app/main/default/triggers/OpportunityTrigger.trigger
@@ -1,4 +1,7 @@
 trigger OpportunityTrigger on Opportunity (before insert, before update, after insert, after update) {
+    if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){
+        return;
+    }
     
     if(Trigger.new[0].DealerIsOk__c == true && Trigger.new[0].CrossCooperativeDealer__c == null){
         Trigger.new[0].addError('璇峰~鍐欏悎浣滃尯鍩熶唬鐞嗗晢');
diff --git a/force-app/main/default/triggers/OrderTrigger.trigger b/force-app/main/default/triggers/OrderTrigger.trigger
index 291c482..64419a4 100644
--- a/force-app/main/default/triggers/OrderTrigger.trigger
+++ b/force-app/main/default/triggers/OrderTrigger.trigger
@@ -1,4 +1,12 @@
+/*
+ *@Description: OrderTrigger
+ *@Author: Dennis Rodman 
+ *@Date: 2022-04-14 14:31:47
+*/
 trigger OrderTrigger on Order (before insert, before update, after insert, after update) {
+    if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){
+        return;
+    }
     
     if (Trigger.isBefore && Trigger.isInsert) {
         System.debug('@@@@@@@@@@@@@@!!!!!!!!!!!!!!!');
diff --git a/force-app/main/default/triggers/SWOTrigger.trigger b/force-app/main/default/triggers/SWOTrigger.trigger
index 397c7da..8231412 100644
--- a/force-app/main/default/triggers/SWOTrigger.trigger
+++ b/force-app/main/default/triggers/SWOTrigger.trigger
@@ -1,5 +1,8 @@
 trigger SWOTrigger on SWO__c (before insert,after insert,before update) {
-	if(trigger.isBefore){
+     if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){
+        return;
+    }
+    if(trigger.isBefore){
 		SWOTriggerHandler.setDateTimeSendEmail(trigger.new, trigger.newMap, trigger.old, trigger.oldMap);
 	}
 	if(trigger.isAfter && trigger.isInsert){
diff --git a/force-app/main/default/triggers/UserFaultInfoTrigger.trigger b/force-app/main/default/triggers/UserFaultInfoTrigger.trigger
index 57fa782..43654bc 100644
--- a/force-app/main/default/triggers/UserFaultInfoTrigger.trigger
+++ b/force-app/main/default/triggers/UserFaultInfoTrigger.trigger
@@ -1,4 +1,7 @@
 trigger UserFaultInfoTrigger on User_FaultInfo__c (after insert,before update,before insert) {
+     if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){
+        return;
+    }
 
     if(Trigger.isBefore && Trigger.isUpdate){
         UserFaultInfoHandler.UserFaultInfoWorkingHoursAssignment(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap,'');
diff --git a/force-app/main/default/triggers/loanerAppStatusUp.trigger b/force-app/main/default/triggers/loanerAppStatusUp.trigger
index 44c06d6..1d03855 100644
--- a/force-app/main/default/triggers/loanerAppStatusUp.trigger
+++ b/force-app/main/default/triggers/loanerAppStatusUp.trigger
@@ -1,4 +1,7 @@
 trigger loanerAppStatusUp on loaner_application__c (before insert,before update, after update) {
+     if((!Test.isRunningTest())&&UserInfo.getUserId()==System.Label.ByPassTrigger){
+        return;
+    }
     if (Trigger.isBefore && Trigger.isUpdate) {
         loanerAppTriggerHandler.setSubmitUser(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap);
     }

--
Gitblit v1.9.1