From 69dc5df6ec51f6f7f6737c61d9c4c1e7757a2b96 Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期四, 17 三月 2022 21:05:08 +0800
Subject: [PATCH] PIPLFixBugs0317V1

---
 force-app/main/default/classes/NewAndEditBaseController.cls |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/force-app/main/default/classes/NewAndEditBaseController.cls b/force-app/main/default/classes/NewAndEditBaseController.cls
index 49c45e5..d8d41e6 100644
--- a/force-app/main/default/classes/NewAndEditBaseController.cls
+++ b/force-app/main/default/classes/NewAndEditBaseController.cls
@@ -1,12 +1,15 @@
 global abstract class NewAndEditBaseController {
 
     public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;}
+    public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute 20220316 by Mingjie
     public String awsToken{set;get;}
     public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
     public String sobjectTypeValue {private set; get;}
     public Boolean isNewMode{set;get;}
     public String rtTypeId {get; set;}
     public String AWSDataId{set;get;}
+    public String CurrentUserId{private set;get;}
+    public String CurrentUserName{private set;get;}
 
     // 褰撳墠瀵硅薄鎵�鏈夌殑鍔犲瘑瀛楁闆嗗悎
     public List<String> encryptedAPIList{private set;get;}
@@ -47,7 +50,7 @@
     public List<String> VLookUpFields{get;private set;}
     public String VLookUpFieldsJson{get{return Json.serialize(VLookUpFields);}}
     public List<String> LookUpOverrideFields{get;private set;}
-    public string LookUpOverrideFieldsMapJson{get;private set;}
+    public string LookUpOverrideFieldsMapJson{get; set;}
     
 
     public NewAndEditBaseController(){
@@ -57,6 +60,8 @@
         VLookUpFields = new List<String>();
         layoutEncryptedAPIList = new List<String>();
         LookUpOverrideFields = new List<String>();
+        CurrentUserName = UserInfo.getName();
+        CurrentUserId = UserInfo.getUserId();
     }
 
     protected virtual void Init(SObject obj){
@@ -98,7 +103,7 @@
             rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
         }
         PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo(sobjectTypeValue);
-        layoutEncryptedAPIList = piIntegration.PIFields;
+        //layoutEncryptedAPIList = piIntegration.PIFields;
         encryptedAPIList = piIntegration.PIFields;
         staticResource = JSON.serialize(piIntegration);
         sobjectPrefix = piIntegration.sobjectPrefix;
@@ -117,7 +122,7 @@
         system.debug(AWSToSobjectNonEncryptedMapJson);
         try{
             LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, sobjectTypeValue,'classic');
-            layoutSections = LayoutWrapperValue.layoutSections;
+            layoutSections = LayoutWrapperValue.layoutSections;         
             List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList;
             Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap;
             List<String> fieldApiList = new List<String>(); 
@@ -131,17 +136,19 @@
                         }
 
                         //鍦╲iew瑙e瘑section涓彧闇�鏄剧ず褰撳墠layout涓殑鍔犲瘑瀛楁
-                        // if (encryptedAPIList.contains(lf.fieldAPI)) {
-                        //     layoutEncryptedAPIList.add(lf.fieldAPI);
-                        // }
+                        if (encryptedAPIList.contains(lf.fieldAPI)) {
+                             layoutEncryptedAPIList.add(lf.fieldAPI);
+                         }
                     }
                 }
             }
+            layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute 20220316 by Mingjie
             fieldApiListStr = JSON.serialize(fieldApiList);
             fieldAPIToLabelMapStr = JSON.serialize(fieldAPIToLabelMap);
             requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList);
             //awsToken = AWSServiceTool.getAWSToken();
         }catch(Exception e){
+            layoutEncryptedAPIList = piIntegration.PIFields;
             system.debug('Exception from get layout service:'+e.getmessage());
         }
     }

--
Gitblit v1.9.1