From 03523642de0c4f319d90d0aec8a756f9e80e6a7e Mon Sep 17 00:00:00 2001
From: Li Jun <buli@deloitte.com.cn>
Date: 星期四, 17 三月 2022 21:27:47 +0800
Subject: [PATCH] PIPLFunctionDeployV2

---
 force-app/main/default/classes/RentalApplyController.cls |   34 ++++++++++------------------------
 1 files changed, 10 insertions(+), 24 deletions(-)

diff --git a/force-app/main/default/classes/RentalApplyController.cls b/force-app/main/default/classes/RentalApplyController.cls
index 8fa1e82..1e444f5 100644
--- a/force-app/main/default/classes/RentalApplyController.cls
+++ b/force-app/main/default/classes/RentalApplyController.cls
@@ -1,4 +1,12 @@
+/**
+ * @description       : 
+ * @author            : ChangeMeIn@UserSettingsUnder.SFDoc
+ * @group             : 
+ * @last modified on  : 03-17-2022
+ * @last modified by  : ChangeMeIn@UserSettingsUnder.SFDoc
+**/
 global without sharing class RentalApplyController {
+    public String layoutSectionsStr {get; set;}//for dynamic add readonly attribute
     public List <LayoutDescriberHelper.LayoutSection > layoutSections{set;get;}
     public String awsToken{set;get;}
     public static Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
@@ -36,9 +44,11 @@
         }else{
             //鏂板缓
             rtTypeId = ApexPages.currentPage().getParameters().get('RecordType');
+            obj.put('OwnerId',UserInfo.getUserId());
         }
         LayoutDescriberHelper.LayoutWrapper LayoutWrapperValue = LayoutDescriberHelper.describeSectionWithFieldsWrapper(rtTypeId, 'Rental_Apply__c','classic');
         layoutSections = LayoutWrapperValue.layoutSections;
+        layoutSectionsStr = JSON.serialize(layoutSections); //for dynamic add readonly attribute
         List<String> requiredFieldAPIList = LayoutWrapperValue.requiredFieldAPIList;
         Map<String,String> fieldAPIToLabelMap = LayoutWrapperValue.fieldAPIToLabelMap;
         requiredFieldAPIListStr = JSON.serialize(requiredFieldAPIList);
@@ -85,30 +95,6 @@
             }else {
                 rentalApplyInfo.put(fieldAPI,fieldValue);
             }
-            // system.debug('field API'+fieldAPI);
-            // String fieldValue = String.valueOf(fieldAPIToTypeMap.get(fieldAPI));
-            // if(String.isBlank(fieldValue) || String.isEmpty(fieldValue)){
-            //     continue;
-            // }
-            // Schema.DescribeFieldResult fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe();  
-            // Schema.DisplayType fieldDatas = fielddataType.getType();
-            // system.debug('fieldValue='+fieldValue);
-            // if(String.valueOf(fielddatas)=='DATE'){
-            //     rentalApplyInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-')));
-            // }else if(String.valueOf(fielddatas)=='DATETIME'){
-            //     String dt = String.valueOf(fieldValueMap.get(fieldAPI));
-            //     if(String.isNotBlank(dt)&&dt.contains('T')){
-            //         dt = dt.replace('T',' ');
-            //         rentalApplyInfo.put(fieldAPI, Datetime.valueOfGmt(dt));
-            //     }             
-            // }else if(String.valueOf(fielddatas)=='Number'||String.valueOf(fielddatas)=='DOUBLE'){
-            //     system.debug('decimal error:'+ String.valueOf(fieldValueMap.get(fieldAPI)));
-            //     rentalApplyInfo.put(fieldAPI, decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI))));
-            // } else if(String.valueof(fielddatas)=='BOOLEAN'){
-            //     rentalApplyInfo.put(fieldAPI, fieldValueMap.get(fieldAPI));
-            // }else {
-            //     rentalApplyInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI)));
-            // }                  
         }
         
         //2. Save Record Process

--
Gitblit v1.9.1