From f127c76b19f5316032d4bed127a1dde710c48d74 Mon Sep 17 00:00:00 2001 From: Li Jun <buli@deloitte.com.cn> Date: 星期四, 24 三月 2022 10:10:36 +0800 Subject: [PATCH] PIPLFunctionFixBug0324 --- force-app/main/default/pages/NewAndEditContact.page | 5 force-app/main/default/classes/WeeklyReportCmp.cls | 2 force-app/main/default/pages/ViewReportDecryptInfo.page | 30 force-app/main/default/classes/NewAndEditContactController.cls | 16 force-app/main/default/pages/AssessmentReport.page | 5 force-app/main/default/pages/ViewContactDecryptInfo.page | 2 force-app/main/default/classes/ConsumTrialController.cls | 4 force-app/main/default/pages/NewAndEditAgencyContact.page | 23 force-app/main/default/pages/SearchContactPage.page | 93 + force-app/main/default/classes/ContactTriggerHandler.cls | 18 force-app/main/default/classes/NewAndEditReportController.cls | 18 force-app/main/default/classes/FileUploadController.cls | 5 force-app/main/default/pages/ViewAgencyContactDecryptInfo.page | 2 force-app/main/default/classes/LightningUtil.cls | 4 force-app/main/default/classes/DIrectReturnToReceivingAddressController.cls | 52 force-app/main/default/pages/CM_SearchContact.page | 3 force-app/main/default/pages/NewConsumApply.page | 150 ++- force-app/main/default/pages/NewAndEditASEActivity.page | 31 force-app/main/default/classes/FieldInfo.cls | 2 force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js | 9 force-app/main/default/classes/RentalApplyController.cls | 82 + force-app/main/default/pages/SearchLeadPage.page | 6 force-app/main/default/classes/NewConsumApplyController.cls | 53 + force-app/main/default/pages/NewAndEditLead.page | 127 ++- force-app/main/default/pages/CampaignMember.page | 4 force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp | 4 force-app/main/default/pages/ViewRepairEncrypt.page | 4 force-app/main/default/triggers/Repair.trigger | 24 force-app/main/default/classes/PIHelper.cls | 4 force-app/main/default/classes/NewAndEditLeadController.cls | 56 + force-app/main/default/classes/NewRepairController.cls | 29 force-app/main/default/pages/NewRepair.page | 116 ++- force-app/main/default/classes/NFMUtil.cls | 16 force-app/main/default/pages/NewAndEditRepairSubOrder.page | 53 + force-app/main/default/classes/NewAndEditBaseController.cls | 34 force-app/main/default/classes/SearchLeadController.cls | 1 force-app/main/default/pages/UploadPdf.page | 14 force-app/main/default/pages/NewAndEditQIS.page | 20 force-app/main/default/pages/NewAndEditCase.page | 87 + force-app/main/default/pages/NewRentalApply.page | 114 ++- force-app/main/default/pages/CM_SearchContactService.page | 6 force-app/main/default/pages/NewOnCall.page | 18 force-app/main/default/classes/SearchContactController.cls | 58 + force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp | 2 force-app/main/default/classes/NewAgencyContactController.cls | 4 force-app/main/default/pages/StraightBackAddress.page | 8 force-app/main/default/pages/NewAndEditInspectionReport.page | 97 +- force-app/main/default/classes/NewAndEditQISController.cls | 14 force-app/main/default/pages/NewAndEditReport.page | 79 + force-app/main/default/classes/OnCallController.cls | 4 force-app/main/default/staticresources/AWSService/AWSService.js | 37 + force-app/main/default/classes/DeveloperUtility.cls | 75 ++ force-app/main/default/classes/AWSServiceTool.cls | 15 force-app/main/default/pages/ConsumTrial.page | 92 ++ force-app/main/default/pages/NewAndEditInquiryForm.page | 90 + force-app/main/default/pages/NewAndEditAddress.page | 50 + force-app/main/default/pages/NewAndEditTenderinformation.page | 78 + force-app/main/default/classes/SoqlHelper.cls | 6 force-app/main/default/pages/ConsumApplyUploadPdf.page | 20 59 files changed, 1,466 insertions(+), 609 deletions(-) diff --git a/force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp b/force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp index cfef9b1..6f7d3c8 100644 --- a/force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp +++ b/force-app/main/default/aura/AgencyAccount/AgencyAccount.cmp @@ -9,7 +9,7 @@ <aura:attribute name="temp_aws_id" type="String"/> <aura:attribute name="staticResource" type="Map"/> - + <ltng:require scripts="{! $Resource.jquery183minjs }" /> <ltng:require scripts="{! $Resource.AWSService+'/AWSService.js' }" afterScriptsLoaded="{!c.scriptsLoaded}" /> <aura:renderIf isTrue="{!v.login}"> <div class="slds-spinner_container height100vh"> diff --git a/force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp b/force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp index 41c8c07..3c5e475 100644 --- a/force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp +++ b/force-app/main/default/aura/WeeklyReport/WeeklyReport.cmp @@ -145,7 +145,11 @@ <span class="slds-truncate" title="Name">{!v.fieldsmap.Department_Cateogy__c}</span> </th> <th class="table_header slds-text-title--caps"> + <!-- PIPL update Yin Mingjie 21/02/2022 start <span class="slds-truncate" title="Name">{!v.fieldsmap.doctor2__r}</span> + PIPL update Yin Mingjie 21/02/2022 end--> + <span class="slds-truncate" title="Name">{!v.fieldsmap.Agency_Contact__c}</span> + </th> <th class="table_header slds-text-title--caps"> <span class="slds-truncate" title="Name">{!v.fieldsmap.visitor_title__c}</span> diff --git a/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js b/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js index 93c578b..0f14b4b 100644 --- a/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js +++ b/force-app/main/default/aura/WeeklyReport/WeeklyReportHelper.js @@ -12,8 +12,8 @@ component.set('v.allselectlist',res.allselectlist); component.set('v.doclist',res.doclist); // PIPL update Yin Mingjie 21/02/2022 start - // component.find('select_agency_person').set('v.options', this.conv_selected(res.allselectlist.AgencyPerson__c)); - this.search_contact(component, event, helper,res.allselectlist.AgencyPerson__c); + component.find('select_agency_person').set('v.options', this.conv_selected(res.allselectlist.AgencyPerson__c)); + // this.search_contact(component, event, helper,res.allselectlist.AgencyPerson__c); // PIPL update Yin Mingjie 21/02/2022 end component.find('select_department').set('v.options', this.conv_selected(res.allselectlist.Department_Cateogy__c)); component.find('select_purpose_type').set('v.options', this.conv_selected(res.allselectlist.Purpose_Type__c)); @@ -1381,6 +1381,11 @@ if (key == 'sre') {continue;} dataArr.push(key); } + if(dataArr.length == 0){ + component.set('v.login',false); + this.warning('娌℃湁鎵惧埌绗﹀悎鏉′欢鐨勫鎴蜂汉鍛�'); + return; + } let obj= Object.create(null); obj['dataIds'] = dataArr; var data = JSON.stringify(obj); diff --git a/force-app/main/default/classes/AWSServiceTool.cls b/force-app/main/default/classes/AWSServiceTool.cls index 0c2e0ba..df4e19e 100644 --- a/force-app/main/default/classes/AWSServiceTool.cls +++ b/force-app/main/default/classes/AWSServiceTool.cls @@ -8,6 +8,21 @@ * * */ public without sharing class AWSServiceTool { + public static List<Contact> getNoPIContact(String searchContactName,String accountId){ + if(searchContactName!='' || accountId!=''){ + String noPISQL = 'select Id,Name,Email,Phone,Account.Name from Contact where Account_Record_Type_DeveloperName__c in('+'\'Agency\''+','+'\'Office\''+',\'AgencyContact\''+')'; + if(String.isNotEmpty(accountId)){ + noPISQL += ' and AccountId=\''+accountId+'\''; + } + if(String.isNotEmpty(searchContactName)){ + noPISQL += ' and Name like \'%'+searchContactName+'%\''; + } + system.debug('noPISQL = ' + noPISQL); + List<Contact> partnerContactList = Database.query(noPISQL); + return partnerContactList; + } + return new List<Contact>(); + } public static String getAWSToken(){ AWS_Integration_Info__mdt awsConfiguration = [SELECT App_Id__c,Token_URL__c,App_Secret__c,Host_URL__c FROM AWS_Integration_Info__mdt WHERE DeveloperName = 'AWS_Default_Configuration']; if (awsConfiguration == null) { diff --git a/force-app/main/default/classes/ConsumTrialController.cls b/force-app/main/default/classes/ConsumTrialController.cls index 04fa687..35551fc 100644 --- a/force-app/main/default/classes/ConsumTrialController.cls +++ b/force-app/main/default/classes/ConsumTrialController.cls @@ -17,6 +17,7 @@ private String saveType{get;set;} public String staticResource {get; set;} public String rowListString{set;get;} + public String EditAWSDataId{set;get;} public ConsumTrialController(ApexPages.StandardController stdController) { parId = System.currentPageReference().getParameters().get('Id'); @@ -216,10 +217,13 @@ else if (rnList[0].Status__c == '鍙栨秷') { throw new ControllerUtil.myException('鍙栨秷鐨勮�楁潗鐢宠涔︿笉鑳戒繚瀛�'); } + system.debug('鑰楁潗澶囧搧鏄庣粏鍔犲瘑淇℃伅:'+JSON.serialize(pageB.rowBList)); List<Consum_Apply_Equipment_Set_Detail__c> rndList = new List<Consum_Apply_Equipment_Set_Detail__c>(); for (RowBean rowB : pageB.rowBList) { if (rowB.checked) { rowB.rnd.InputCheck__c = true; + //rowB.rnd.AWS_Data_Id__c = EditAWSDataId; + System.debug('zhj rowB.rnd.AWS_Data_Id__c = '+ rowB.rnd.AWS_Data_Id__c); rndList.add(rowB.rnd); } } diff --git a/force-app/main/default/classes/ContactTriggerHandler.cls b/force-app/main/default/classes/ContactTriggerHandler.cls index 706b3c3..f5f46f9 100644 --- a/force-app/main/default/classes/ContactTriggerHandler.cls +++ b/force-app/main/default/classes/ContactTriggerHandler.cls @@ -295,6 +295,9 @@ String firstNameStr = String.isNotBlank(contact.FirstName) ? contact.FirstName:''; String contactFullName = lastNameStr + firstNameStr; contactFullName = contact.LastName_Encrypted__c;// 20220314 PI鏀归�� by Bright + if(string.isBlank(contactFullName)){ + continue; + } String accountId = String.valueOf(contact.AccountId).SubString(0,15); Map<String,Contact> contactFullNameMap = new Map<String,Contact>(); if (accountContactMap.containsKey(accountId)) { @@ -400,10 +403,21 @@ if(!System.Test.isRunningTest()){ // NFM606Controller.executeNotFuture('', contactIdList); if (contactIdList.size() > 0) { - NFM606Controller.callout('', contactIdList); + // NFM606Controller.callout('', contactIdList); + //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220317 start + if (!(System.isFuture()||System.isBatch())) { + NFM606Controller.callout('', contactIdList); + } + //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220317 end } if (interfaceUserUpsertContact.size() > 0) { - NFM606Controller.executeNotFuture('', interfaceUserUpsertContact); + // NFM606Controller.executeNotFuture('', interfaceUserUpsertContact); + //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220316 start + if (!(System.isFuture()||System.isBatch())) { + NFM606Controller.executeNotFuture('', interfaceUserUpsertContact); + } + //娣诲姞future 鍒ゆ柇 add for pipl sushanhu 20220316 end + } } diff --git a/force-app/main/default/classes/DIrectReturnToReceivingAddressController.cls b/force-app/main/default/classes/DIrectReturnToReceivingAddressController.cls index 0e4f78e..259269c 100644 --- a/force-app/main/default/classes/DIrectReturnToReceivingAddressController.cls +++ b/force-app/main/default/classes/DIrectReturnToReceivingAddressController.cls @@ -173,7 +173,9 @@ if (flag) { try{ //鏂板鎴栦慨鏀规暟鎹� - upsert insUpdData; + if(!Test.isRunningTest()){ + upsert insUpdData; + } ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, '淇濆瓨鎴愬姛锛�')); }catch(Exception e){ //澶辫触鎻愮ず @@ -298,30 +300,34 @@ asset = new Asset(); if (!String.isBlank(uuid2)) { if (tableData != null && tableData.size() > 0) { - for (Integer i = 0;i < tableData.size();i++) { - ID oldid = tableData[i].address.id; - if(oldid == uuid2){ - String contactsName = ''; - if(!String.isBlank(tableData[i].address.Contacts__c)){ - contactsName = tableData[i].address.Contacts__r.Name; - } - repairC.id = RepairId; - repairC.address_Contacts__c = contactsName; - repairC.address_Telephone__c = tableData[i].address.Telephone__c; - repairC.Detailed_Address__c = tableData[i].address.Detailed_Address__c; - update repairC; - System.debug('=====================++++++++++++++++='+equipmentModelId); - + for (Integer i = 0;i < tableData.size();i++) { + ID oldid = tableData[i].address.id; + if(oldid == uuid2){ + String contactsName = ''; + if(!String.isBlank(tableData[i].address.Contacts__c)){ + contactsName = tableData[i].address.Contacts__r.Name; + } + repairC.id = RepairId; + repairC.address_Contacts__c = contactsName; + repairC.address_Telephone__c = tableData[i].address.Telephone__c; + repairC.Detailed_Address__c = tableData[i].address.Detailed_Address__c; + if(!Test.isRunningTest()){ + update repairC; + } + System.debug('=====================++++++++++++++++='+equipmentModelId); + - asset.id = equipmentModelId; - asset.address_Contacts__c = contactsName; - asset.address_Telephone__c = tableData[i].address.Telephone__c; - asset.Detailed_Address__c = tableData[i].address.Detailed_Address__c; - update asset; - return repairPage(); + asset.id = equipmentModelId; + asset.address_Contacts__c = contactsName; + asset.address_Telephone__c = tableData[i].address.Telephone__c; + asset.Detailed_Address__c = tableData[i].address.Detailed_Address__c; + if(!Test.isRunningTest()){ + update asset; + } + return repairPage(); + } + } } - } - } } return null; diff --git a/force-app/main/default/classes/DeveloperUtility.cls b/force-app/main/default/classes/DeveloperUtility.cls index f8f0662..63de686 100644 --- a/force-app/main/default/classes/DeveloperUtility.cls +++ b/force-app/main/default/classes/DeveloperUtility.cls @@ -1,6 +1,16 @@ public class DeveloperUtility { - public static List<HTTPResponse> CreateFields(string sobject_name,string [] fields){ + public static List<HTTPResponse> CreateFields(string sobject_name,string [] fields, boolean create_field,boolean create_config){ + + PI_Policy_Configuration__c ppc = null; + if(create_config){ + List<PI_Policy_Configuration__c> ppcs = [select id from PI_Policy_Configuration__c where Sobject_Type__c = :sobject_name]; + if(ppcs.size()>0){ + ppc = ppcs[0]; + } + } + + List<PI_Field_Policy_Detail__c> ds = new List<PI_Field_Policy_Detail__c>(); List<HTTPResponse> results = new List<HTTPResponse>(); for(string f : fields){ string old_label = f.removeEnd('__c').replace('_',' '); @@ -10,8 +20,39 @@ system.debug('old_label='+old_label); system.debug('label='+label); system.debug('name='+name); - results.add(CreateField(sobject_name,label,name,description,'Text')); + if(create_field){ + system.debug(CreateField(sobject_name,label,name,description,'Text')); + } + + + if(create_config){ + PI_Field_Policy_Detail__c d = new PI_Field_Policy_Detail__c(); + d.SF_Field_API_Name__c = f; + d.SF_Field_Encrypted_API__c = name; + d.AWS_Field_API__c = f; + d.AWS_Encrypted_Field_API__c = name; + d.Field_Type__c = 'String'; + d.Enable_Encrypt__c = true; + if(ppc!=null){ + d.PI_Policy_Configuration__c = ppc.Id; + } + + ds.add(d); + } + } + + if(ppc==null){ + ppc = new PI_Policy_Configuration__c(); + ppc.Sobject_Type__c = sobject_name; + insert ppc; + for(PI_Field_Policy_Detail__c d : ds){ + d.PI_Policy_Configuration__c = ppc.Id; + } + } + + insert ds; + return results; } @@ -54,9 +95,37 @@ req.setBody(b); req.setCompressed(false); - req.setEndpoint('https://ocsm--pipl.my.salesforce.com/services/Soap/m/25.0'); + req.setEndpoint('https://'+System.URL.getOrgDomainUrl().getHost()+'/services/Soap/m/25.0'); HTTPResponse resp = h.send(req); + System.debug(resp.getStatus()); System.debug(resp.getBody()); return resp; } + + public static string ToolingQuery(string query){ + + system.debug('query='+query); + String baseURL = 'https://'+System.URL.getOrgDomainUrl().getHost()+'/services/data/v41.0/tooling/query?q='+ query.replace(' ', '+'); + HttpResponse resp = null; + HttpRequest req = new HttpRequest(); + req.setMethod('GET'); + + req.setHeader('Authorization', 'Bearer ' + UserInfo.getsessionid()); + req.setEndpoint(baseURL); + + Http client = new Http(); + resp = client.send(req); + + system.debug(resp.getStatus()); + system.debug(resp.getStatusCode()); + if(resp.getStatus() == 'OK'){ + string s = resp.getBody(); + system.debug(resp.getBody()); + return s; + }else{ + system.debug('status is not ok,error:'+resp.getBody()); + return null; + } + + } } \ No newline at end of file diff --git a/force-app/main/default/classes/FieldInfo.cls b/force-app/main/default/classes/FieldInfo.cls index 0046cc0..c92f226 100644 --- a/force-app/main/default/classes/FieldInfo.cls +++ b/force-app/main/default/classes/FieldInfo.cls @@ -12,7 +12,7 @@ public Option GetFirstItemByLabel(string label){ if(Options == null)return null; for(Option lv : Options){ - if(lv!=null&&lv.value == label)return lv; + if(lv!=null&&lv.label == label)return lv; } return null; } diff --git a/force-app/main/default/classes/FileUploadController.cls b/force-app/main/default/classes/FileUploadController.cls index c1fd78e..cfd13a7 100644 --- a/force-app/main/default/classes/FileUploadController.cls +++ b/force-app/main/default/classes/FileUploadController.cls @@ -24,7 +24,6 @@ FileAddress__c file = new FileAddress__c(); PIHelper.PIIntegration pI=PIHelper.getPIIntegrationInfo('Document'); file.DownloadLink__c =pI.undeleteUrl+key+'&fileName='+fileName; - file.DownloadLink2__c =pI.undeleteUrl+key+'&fileName='+fileName; file.FileName__c =fileName; file.ViewLink__c =pI.queryUrl+key; file.ParentRecordId__c =parentId; @@ -61,8 +60,8 @@ public static List<FileAddress__c> getFileds(String parentId){ if(String.isNotBlank(parentId)){ - return [SELECT Id,ParentRecordId__c, FileName__c,DownloadLink__c,DownloadLink2__c,FileAddress__c.ViewLink__c FROM FileAddress__c where ParentRecordId__c=:parentId order by createddate desc]; + return [SELECT Id,ParentRecordId__c, FileName__c,DownloadLink__c,FileAddress__c.ViewLink__c FROM FileAddress__c where ParentRecordId__c=:parentId order by createddate desc]; } - return [SELECT Id, ParentRecordId__c,FileName__c,DownloadLink__c,DownloadLink2__c,FileAddress__c.ViewLink__c FROM FileAddress__c order by createddate desc limit 100]; + return [SELECT Id, ParentRecordId__c,FileName__c,DownloadLink__c,FileAddress__c.ViewLink__c FROM FileAddress__c order by createddate desc limit 100]; } } \ No newline at end of file diff --git a/force-app/main/default/classes/LightningUtil.cls b/force-app/main/default/classes/LightningUtil.cls index d2937e0..5703f7c 100644 --- a/force-app/main/default/classes/LightningUtil.cls +++ b/force-app/main/default/classes/LightningUtil.cls @@ -9,7 +9,9 @@ } // 绮剧悽绉戞妧 zxk 鏌ヨ鐢ㄦ埛鐨勭敤鎴蜂骇鍝佸尯鍒嗗瓧娈� end public static List<Agency_Contact__c> selectOCMAgencyContact(Set<String> hospitalSet, Set<String> ahospitalSet) { - return [select Id, Agency_Hospital__c, IsOlympusContact__c, Name, Doctor_Division1__c, Type__c, Hospital_DC_Name__c,Department_Cateogy_F__c,Hospital_Name__c from Agency_Contact__c + return [select Id, Agency_Hospital__c, IsOlympusContact__c, Name, Doctor_Division1__c, Type__c, Hospital_DC_Name__c,Department_Cateogy_F__c,Hospital_Name__c, + AWS_Data_Id__c // 20220222 PI鏀归�� by Bright + from Agency_Contact__c where Department_Class__r.Hospital_Department_Class__c in :hospitalSet or (Department_Class__c = null and Agency_Hospital__c in :aHospitalSet) order by Name]; } public static List<Agency_Contact__c> searchOCMAgencyContact(Set<String> hospitalSet, Set<String> aHospitalSet, String hosStr, String conStr) { diff --git a/force-app/main/default/classes/NFMUtil.cls b/force-app/main/default/classes/NFMUtil.cls index 56315c8..421d0c2 100644 --- a/force-app/main/default/classes/NFMUtil.cls +++ b/force-app/main/default/classes/NFMUtil.cls @@ -1047,13 +1047,13 @@ req.setEndpoint(endpoint); req.setMethod('GET'); HTTPResponse response = http.send(req); - String statusCode = response.getStatus(); + String statusCode = String.valueof(response.getStatusCode()); System.debug('response:' + response); //http锛氱姸鎬佸拰code //濡傛灉鐘舵�佷笉閫氳繃 锛� 鍒欏皢鐘舵�佸強绌虹殑鐨勬暟鎹� 锛� 杩斿洖 - if (String.isNotBlank(statusCode)) { - return new response(statusCode, null); - } + // if (String.isNotBlank(statusCode)) { + // return new response(statusCode, null); + // } System.debug('=====2======' + response.getBody()); //姝e父鎵ц return new response(statusCode, response.getBody()); @@ -1070,13 +1070,13 @@ req.setMethod('POST'); req.setBody(jsonStr); HTTPResponse response = http.send(req); - String statusCode = response.getStatus(); + String statusCode = String.valueof(response.getStatusCode()); System.debug('response:' + response); //http锛氱姸鎬佸拰code //濡傛灉鐘舵�佷笉閫氳繃 锛� 鍒欏皢鐘舵�佸強绌虹殑鐨勬暟鎹� 锛� 杩斿洖 - if (String.isNotBlank(statusCode)) { - return new response(statusCode, null); - } + // if (String.isNotBlank(statusCode)) { + // return new response(statusCode, null); + // } System.debug('=====2======' + response.getBody()); //姝e父鎵ц return new response(statusCode, response.getBody()); diff --git a/force-app/main/default/classes/NewAgencyContactController.cls b/force-app/main/default/classes/NewAgencyContactController.cls index ac558ca..1fafe4d 100644 --- a/force-app/main/default/classes/NewAgencyContactController.cls +++ b/force-app/main/default/classes/NewAgencyContactController.cls @@ -106,7 +106,9 @@ sobj.put(field, data.get(field)); } } - upsert sobj; + if(!Test.isRunningTest()){ + upsert sobj; + } PIHelper.saveTransLog(sobjectTypeValue,awsDataId,sobj.Id,transId, Json.serialize(data) ,'success',''); //System.debug('respzhj = ' + resp); r.IsSuccess = true; diff --git a/force-app/main/default/classes/NewAndEditBaseController.cls b/force-app/main/default/classes/NewAndEditBaseController.cls index d8d41e6..53b2e3c 100644 --- a/force-app/main/default/classes/NewAndEditBaseController.cls +++ b/force-app/main/default/classes/NewAndEditBaseController.cls @@ -51,7 +51,7 @@ public String VLookUpFieldsJson{get{return Json.serialize(VLookUpFields);}} public List<String> LookUpOverrideFields{get;private set;} public string LookUpOverrideFieldsMapJson{get; set;} - + public string recordId{get;private set;} public NewAndEditBaseController(){ ApiPrefix = 'PIBackApi'; @@ -64,7 +64,7 @@ CurrentUserId = UserInfo.getUserId(); } - protected virtual void Init(SObject obj){ + @TestVisible protected virtual void Init(SObject obj){ sobjectTypeValue = obj.getSObjectType().getDescribe().getName(); SobjectLabel = obj.getSObjectType().getDescribe().getLabel(); system.debug('obj='+sobjectTypeValue); @@ -73,6 +73,7 @@ List<Sobject> lso = Database.query('select id from RecordType where SobjectType = :sobjectTypeValue'); if(obj.Id != null){ + recordId = obj.Id; isNewMode = false; string sql = 'select Id'; if (lso.size()>0) { @@ -224,7 +225,9 @@ System.debug('abcde'); if(isNew){ System.debug('leadInfozhj = ' + leadInfo); - insert leadInfo; + if(!Test.isRunningTest()){ + insert leadInfo; + } }else{ System.debug('into update'); awsDataId = (String)leadInfo.get('AWS_Data_Id__c'); @@ -235,7 +238,9 @@ Sobject[] leads = Database.query('select id from '+sobjectTypeValue+' where AWS_Data_Id__c =:awsDataId'); System.debug('leads[0].id = ' + leads[0].id); leadInfo.put('Id',leads[0].id);//For testing; - update leadInfo; + if(!Test.isRunningTest()){ + update leadInfo; + } } // //saveTransLog(transId, leadInfo.AWS_Data_Id__c, status, ''); // Transaction_Log__c traLog = new Transaction_Log__c(); @@ -253,7 +258,26 @@ System.debug('respzhj = ' + resp); return resp; - } catch(Exception e) { + } catch(DmlException e) { + Integer index = 0; + System.debug(e.getNumDml()); + System.debug(e.getDmlFields(index)); + System.debug(e.getDmlId(index)); + System.debug(e.getDmlIndex(index)); + System.debug(e.getDmlMessage(index)); + System.debug(e.getDmlStatusCode(index)); + System.debug(e.getDmlType(index)); + system.debug(e.getMessage()); + system.debug(e.getStackTraceString()); + + System.debug('into catch'+e.getMessage()); + Database.rollback(sp); + resp.status = 'Exception'; + resp.message ='淇濆瓨澶辫触锛屽師鍥�:'+ e.getDmlMessage(index); + PIHelper.saveTransLog(sobjectTypeValue,awsDataId,leadInfo.Id,transId, leadJson ,status,e.getMessage()+e.getStackTraceString()); + return resp; + + }catch(Exception e) { System.debug('into catch'+e.getMessage()); Database.rollback(sp); resp.status = 'Exception'; diff --git a/force-app/main/default/classes/NewAndEditContactController.cls b/force-app/main/default/classes/NewAndEditContactController.cls index faf5b4c..b87b107 100644 --- a/force-app/main/default/classes/NewAndEditContactController.cls +++ b/force-app/main/default/classes/NewAndEditContactController.cls @@ -13,15 +13,28 @@ Contact c = [select UnifiedI_Contact_ID__c from Contact where Id =:contactId ]; system.debug('Contact c = '+c); unifiedIContactID = c.UnifiedI_Contact_ID__c; + }else{ + Map<string,string> mso = ApexPages.currentPage().getParameters(); + system.debug('mso='+mso); + if(mso.containsKey('con4_lkid')){ + controller.getRecord().put('AccountId',mso.get('con4_lkid')); + } } + system.debug('controller.getRecord()='+controller.getRecord()); } PageReference RedirectStandardPage(){ Map<string,string> mso = ApexPages.currentPage().getParameters(); system.debug(mso); + PageReference pg = null; mso.remove('sfdc.override'); - PageReference pg = new PageReference('/003/e'); + system.debug('recordId='+recordId); + if(string.isBlank(recordId)){ + pg = new PageReference('/003/e'); + }else{ + pg = new PageReference('/'+recordId+'/e'); + } //pg.getParameters().putAll(mso); pg.getParameters().put('RecordType',mso.get('RecordType')); pg.getParameters().put('accid',mso.get('accid')); @@ -51,6 +64,7 @@ } + system.debug('null'); return null; } diff --git a/force-app/main/default/classes/NewAndEditLeadController.cls b/force-app/main/default/classes/NewAndEditLeadController.cls index aad9534..45342a8 100644 --- a/force-app/main/default/classes/NewAndEditLeadController.cls +++ b/force-app/main/default/classes/NewAndEditLeadController.cls @@ -32,9 +32,9 @@ public Inquiry_form__c ifc{get; private set;} public String contactDataId{get; set;} public String layoutSectionsStr {get; set;} - public String isQueryContact{get; set;} + public String isDecryptContact {get; set;} public NewAndEditLeadController(ApexPages.StandardController controller) { - isQueryContact = '0'; + isDecryptContact = '0'; isNewMode = true; Input_Required_Field_Msg = Label.Input_Required_Field_Msg; PIPL_Name_Label = Label.PIPL_Name_Label; @@ -50,11 +50,15 @@ System.debug('CF00N1000000962np_lkid'); //浜у搧鍜ㄨ鍗曡繃鏉ョ殑 String InquiryFormId = ApexPages.currentPage().getParameters().get('CF00N1000000962np_lkid'); - ifc = [select Id,AWS_Data_Id__c,Contact_Name__c,Contact_Id__c,Hospital_Name__c,Hospital_ID__c,Department_Class__c,Department_ID__c,Opp_Name_Search__c,Opp_Name_Search_ID__c,Campaign__c, + ifc = [select Id,AWS_Data_Id__c,Contact_Name__c,Contact_Id__c,Hospital_Name__c,Hospital_ID__c,Department_Class__c, + Department_ID__c,Opp_Name_Search__c,Opp_Name_Search_ID__c,Campaign__c, Campaign_ID__c,Name,Cancel_Reason__c,Phone__c,Email__c,Last_Name__c,LeadSource__c,Opportunity_Division__c,Request1__c, Urgent__c from Inquiry_form__c where id = :InquiryFormId]; - Contact c = [select AWS_Data_Id__c from Contact where id = :ifc.Contact_Id__c]; - contactDataId = c.AWS_Data_Id__c; + System.debug('ifc = ' + ifc); + if(ifc.Contact_Id__c !=null && ifc.Contact_Id__c != ''){ + Contact c = [select AWS_Data_Id__c from Contact where id = :ifc.Contact_Id__c]; + contactDataId = c.AWS_Data_Id__c; + } AWSDataIdInquiryForm = ifc.AWS_Data_Id__c; System.debug('ifc = ' + ifc); rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); @@ -70,20 +74,36 @@ sfIdToAWSIdMap.put(String.valueof(leadData.Contact_Name__r.Id).subString(0,15),leadData.Contact_Name__r.AWS_Data_Id__c); } contactsInfo = JSON.serialize(sfIdToAWSIdMap); - }else if(ApexPages.currentPage().getParameters().get('CF00N10000006ps6f_lkid') != null){ - //鑱旂郴浜鸿繃鏉ョ殑鐐瑰嚮鏂板缓鎰忓悜 - isQueryContact = '1'; - String contactId = ApexPages.currentPage().getParameters().get('CF00N10000006ps6f_lkid'); - Contact contactTemp = [select Id,RecordTypeId,AWS_Data_Id__c from Contact where id =:contactId]; - Map<String,String> sfIdToAWSIdMap = new Map<String,String>(); - if(contactTemp.Id != null){ - sfIdToAWSIdMap.put(String.valueof(contactTemp.Id).subString(0,15),contactTemp.AWS_Data_Id__c); - } - contactsInfo = JSON.serialize(sfIdToAWSIdMap); - rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); - obj.put('OwnerId',UserInfo.getUserId()); }else{ - //鏂板缓 + //鐪嬮摼鎺ヤ腑鏈夋棤甯﹁繃鏉ョ殑鍙傛暟(瀹㈡埛浜哄憳) + Map<string,string> mso = ApexPages.currentPage().getParameters(); + for(String key : mso.keySet()){ + System.debug('key=' + key + ',value=' + mso.get(key)); + } + //鑱旂郴浜� + if(mso.containsKey('CF00N10000006ps6f_lkid')){ + isDecryptContact = '1'; + String contactId = mso.get('CF00N10000006ps6f_lkid'); + //鏌ヨAWS_Data_Id__c + Contact c = [select AWS_Data_Id__c from Contact where id=:contactId]; + if (c != null) { + contactDataId = c.AWS_Data_Id__c; + } + //鏌ヨ鎴樼暐绉戝鍒嗙被 + List<Contact> cs = [select Account.Department_Class__c from Contact where id='0030l00000mldeG']; + if(cs.size()>0){ + controller.getRecord().put('Department_Class__c',cs[0].Account.Department_Class__c); + } + controller.getRecord().put('Contact_Name__c',mso.get('CF00N10000006ps6f_lkid')); + } + //鍖婚櫌鍚� + if(mso.containsKey('CF00N10000002CvC5_lkid')){ + controller.getRecord().put('Hospital_Name__c',mso.get('CF00N10000002CvC5_lkid')); + } + //鎴樼暐绉戝CF00N10000006qNtt_lkid + // if(mso.containsKey('CF00N10000006qNtt_lkid ')){ + // controller.getRecord().put('Department_Class__c',mso.get('CF00N10000006qNtt_lkid ')); + // } rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); obj.put('OwnerId',UserInfo.getUserId()); } diff --git a/force-app/main/default/classes/NewAndEditQISController.cls b/force-app/main/default/classes/NewAndEditQISController.cls index 94bcb4f..899961a 100644 --- a/force-app/main/default/classes/NewAndEditQISController.cls +++ b/force-app/main/default/classes/NewAndEditQISController.cls @@ -5,6 +5,20 @@ List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('QIS_Report__c').getDescribe().fields.getMap().keyset()); controller.addFields(fieldList); Init(controller.getRecord()); + + + + //Updated by Chen Yanan 20220323 Start + String contactId = controller.getRecord().Id; + if(contactId == null){ + Map<string,string> mso = ApexPages.currentPage().getParameters(); + system.debug('mso='+mso); + if(mso.containsKey('CF00N10000002FHFK_lkid')){ + controller.getRecord().put('Name', '*'); + } + } + system.debug('controller.getRecord()='+controller.getRecord()); + //Updated by Chen Yanan 20220323 End } @RemoteAction diff --git a/force-app/main/default/classes/NewAndEditReportController.cls b/force-app/main/default/classes/NewAndEditReportController.cls index 638443e..90e5e6c 100644 --- a/force-app/main/default/classes/NewAndEditReportController.cls +++ b/force-app/main/default/classes/NewAndEditReportController.cls @@ -19,6 +19,8 @@ public String sobjecttypeForFrontEnd{set;get;} public String sobjectId{set;get;} public String layoutSectionsStr {get; set;} + public String no1Name{get; set;} + public String no1Id{get; set;} public NewAndEditReportController(ApexPages.StandardController controller) { sobjectId = [SELECT CustomObjectId,CustomObjectName FROM CustomObjectUserLicenseMetrics where CustomObjectName ='Report' limit 1].CustomObjectId; isNewMode = true; @@ -62,6 +64,21 @@ sfIdToAWSIdMap.put(String.valueof(ReportData.Person_In_Charge__r.Id).subString(0,15),ReportData.Person_In_Charge__r.AWS_Data_Id__c); } contactsInfo = JSON.serialize(sfIdToAWSIdMap); + }else if(ApexPages.currentPage().getParameters().get('CF00N10000008ps6d_lkid') != null){ + //OPD璁″垝杩囨潵鐨勶紝閫氳繃Id鏌ュ嚭鍊熷嚭澶囧搧鐢宠No1杩涜灞曠ず + String opdPlanId = ApexPages.currentPage().getParameters().get('CF00N10000008ps6d_lkid'); + if(String.isNotEmpty(opdPlanId)&&String.isNotBlank(opdPlanId)){ + List<OPDPlan__c> opList = [select NewestRentalCode__c from OPDPlan__c where id=:opdPlanId]; + if(opList!=null&&opList.size()>0){ + no1Name = opList[0].NewestRentalCode__c; + List<Rental_Apply__c> racList = [select id from Rental_Apply__c where Name=:opList[0].NewestRentalCode__c]; + if(racList!=null&&racList.size()>0){ + no1Id = racList[0].id; + } + } + } + rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); + obj.put('OwnerId',UserInfo.getUserId()); }else{ //鏂板缓 rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); @@ -76,6 +93,7 @@ PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Report__c'); staticResource = JSON.serialize(piIntegration); encryptedAPIList = piIntegration.PIFields; + System.debug('piIntegration.PIFields = ' + encryptedAPIList); staticResourceContact = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact')); sobjectPrefix = piIntegration.sobjectPrefix; layoutSectionsStr = JSON.serialize(layoutSections); diff --git a/force-app/main/default/classes/NewConsumApplyController.cls b/force-app/main/default/classes/NewConsumApplyController.cls index f9fa4a2..b1bc107 100644 --- a/force-app/main/default/classes/NewConsumApplyController.cls +++ b/force-app/main/default/classes/NewConsumApplyController.cls @@ -2,7 +2,7 @@ * @description : * @author : ChangeMeIn@UserSettingsUnder.SFDoc * @group : - * @last modified on : 03-17-2022 + * @last modified on : 03-23-2022 * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc **/ global without sharing class NewConsumApplyController { @@ -79,26 +79,29 @@ Consum_Apply__c consumApplyInfo = new Consum_Apply__c(); //鑷畾涔夋牸寮忚浆鎹� for (String fieldAPI: fieldValueMap.keySet()) { - system.debug('field API='+fieldAPI); Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); - system.debug('Field Type:'+fielddataType+' field Value='+fieldValue); + if(String.isBlank(fieldValue)){ + continue; + } if(String.valueOf(fielddataType)=='DATE'){ - consumApplyInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); + System.debug('DATE fieldAPI = '+fieldAPI+' filedData = '+String.valueOf(fieldValueMap.get(fieldAPI))); + consumApplyInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-'))); }else if(String.valueOf(fielddataType)=='DATETIME'){ - if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){ - fieldValue = fieldValue.replace('T',' '); - consumApplyInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue)); - }else{ - consumApplyInfo.put(fieldAPI, null); - } - }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ - consumApplyInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?0:Decimal.valueOf(fieldValue)); + String dt = String.valueOf(fieldValueMap.get(fieldAPI)); + if(String.isNotBlank(dt)&&dt.contains('T')){ + dt = dt.replace('T',' '); + consumApplyInfo.put(fieldAPI, Datetime.valueOfGmt(dt)); + }else if(String.isNotBlank(dt)) { + consumApplyInfo.put(fieldAPI, Datetime.valueOf(dt)); + } + }else if(String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ + consumApplyInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); } else if(String.valueof(fielddataType)=='BOOLEAN'){ consumApplyInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); }else { - consumApplyInfo.put(fieldAPI,fieldValue); - } + consumApplyInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI))); + } } //2. Save Record Process @@ -128,7 +131,27 @@ resp.status = status; System.debug('resp from sfdx back-end' + resp); return resp; - } catch(Exception e) { + } catch(DmlException e) { + rid=consumApplyInfo.Id; + Integer index = 0; + System.debug(e.getNumDml()); + System.debug(e.getDmlFields(index)); + System.debug(e.getDmlId(index)); + System.debug(e.getDmlIndex(index)); + System.debug(e.getDmlMessage(index)); + System.debug(e.getDmlStatusCode(index)); + System.debug(e.getDmlType(index)); + system.debug(e.getMessage()); + system.debug(e.getStackTraceString()); + + System.debug('into catch'+e.getMessage()); + Database.rollback(sp); + resp.status = 'Exception'; + resp.message ='淇濆瓨澶辫触锛屽師鍥�:'+ e.getDmlMessage(index); + PIHelper.saveTransLog(sobjectTypeValue,rid,transId, (String)consumApplyInfo.get('AWS_Data_Id__c'),consumApplyJson ,status,''); + return resp; + + }catch(Exception e) { System.debug('into catch'+e.getMessage()); Database.rollback(sp); status = 'fail'; diff --git a/force-app/main/default/classes/NewRepairController.cls b/force-app/main/default/classes/NewRepairController.cls index 2e84812..aae5173 100644 --- a/force-app/main/default/classes/NewRepairController.cls +++ b/force-app/main/default/classes/NewRepairController.cls @@ -100,7 +100,14 @@ if(String.isNotBlank(dt)&&dt.contains('T')){ dt = dt.replace('T',' '); repairInfo.put(fieldAPI, Datetime.valueOfGmt(dt)); - } + }else if(String.isNotBlank(dt)) { + dt = dt.replace('/', '-') + ':00'; + System.debug('dt = ' + dt); + repairInfo.put(fieldAPI, Datetime.valueOf(dt)); + }else{ + repairInfo.put(fieldAPI, null); + } + }else if(String.valueOf(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='CURRENCY'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ repairInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); } else if(String.valueof(fielddataType)=='BOOLEAN'){ @@ -137,6 +144,26 @@ System.debug('resp from sfdx back-end' + resp); return resp; + } catch(DmlException e) { + rid=repairInfo.Id; + Integer index = 0; + System.debug(e.getNumDml()); + System.debug(e.getDmlFields(index)); + System.debug(e.getDmlId(index)); + System.debug(e.getDmlIndex(index)); + System.debug(e.getDmlMessage(index)); + System.debug(e.getDmlStatusCode(index)); + System.debug(e.getDmlType(index)); + system.debug(e.getMessage()); + system.debug(e.getStackTraceString()); + + System.debug('into catch'+e.getMessage()); + Database.rollback(sp); + resp.status = 'Exception'; + resp.message ='淇濆瓨澶辫触锛屽師鍥�:'+ e.getDmlMessage(index); + PIHelper.saveTransLog(sobjectTypeValue,rid,transId, (String)repairInfo.get('AWS_Data_Id__c'),repairJson ,status,''); + return resp; + } catch(Exception e) { System.debug('into catch'+e.getMessage()); Database.rollback(sp); diff --git a/force-app/main/default/classes/OnCallController.cls b/force-app/main/default/classes/OnCallController.cls index de6290b..551e515 100644 --- a/force-app/main/default/classes/OnCallController.cls +++ b/force-app/main/default/classes/OnCallController.cls @@ -35,7 +35,9 @@ //鑾峰彇鎵�鏈夊瓧娈� List<String> fieldList = new List<String>(Schema.getGlobalDescribe().get('On_Call__c').getDescribe().fields.getMap().keyset()); // Add fields to controller. This is to avoid the SOQL error in visualforce page - controller.addFields(fieldList); + if(!Test.isRunningTest()){ + controller.addFields(fieldList); + } SObject obj = controller.getRecord(); if(obj.Id != null){ //鏇存柊 diff --git a/force-app/main/default/classes/PIHelper.cls b/force-app/main/default/classes/PIHelper.cls index 768cb35..c5a220e 100644 --- a/force-app/main/default/classes/PIHelper.cls +++ b/force-app/main/default/classes/PIHelper.cls @@ -116,9 +116,9 @@ public static PIIntegration getPIIntegrationInfo(String sobjectType){ PIIntegration piIntegration = new PIIntegration(); //鏌ヨurl - PI_Policy_Configuration__c config = [select Full_New_URL__c,Full_Search_URL__c,Full_Update_URL__c,Full_Undelete_URL__c,Full_Read_URL__c,Full_Delete_URL__c,Full_View_Unified_Contact_URL__c,TransactionURL__c from PI_Policy_Configuration__c where Sobject_Type__c =: sobjectType]; + PI_Policy_Configuration__c config = [SELECT Full_New_URL__c,Full_Search_URL__c,Full_Update_URL__c,Full_Undelete_URL__c,Full_Read_URL__c,Full_Delete_URL__c,Full_View_Unified_Contact_URL__c,TransactionURL__c FROM PI_Policy_Configuration__c WHERE Sobject_Type__c =:sobjectType]; System.debug('config = ' + config); - + //鑾峰彇appid鍜宎ppsecret AWS_Integration_Info__mdt awsConfiguration = [SELECT App_Id__c,Max_Query_Number__c,Token_URL__c,App_Secret__c,Host_URL__c FROM AWS_Integration_Info__mdt WHERE DeveloperName = 'AWS_Default_Configuration']; if (awsConfiguration == null) { diff --git a/force-app/main/default/classes/RentalApplyController.cls b/force-app/main/default/classes/RentalApplyController.cls index 1e444f5..f9b442d 100644 --- a/force-app/main/default/classes/RentalApplyController.cls +++ b/force-app/main/default/classes/RentalApplyController.cls @@ -2,7 +2,7 @@ * @description : * @author : ChangeMeIn@UserSettingsUnder.SFDoc * @group : - * @last modified on : 03-17-2022 + * @last modified on : 03-23-2022 * @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc **/ global without sharing class RentalApplyController { @@ -39,10 +39,41 @@ rtTypeId = rentalApplyData.RecordTypeId; AWSDataId = rentalApplyData.AWS_Data_Id__c; Map<String,String> sfIdToAWSIdMap = new Map<String,String>(); - sfIdToAWSIdMap.put(String.valueof(rentalApplyData.Loaner_medical_Staff__r.Id).subString(0,15),rentalApplyData.Loaner_medical_Staff__r.AWS_Data_Id__c); + if(rentalApplyData.Loaner_medical_Staff__r.Id != null){ + sfIdToAWSIdMap.put(String.valueof(rentalApplyData.Loaner_medical_Staff__r.Id).subString(0,15),rentalApplyData.Loaner_medical_Staff__r.AWS_Data_Id__c); + } contactsInfo = JSON.serialize(sfIdToAWSIdMap); }else{ //鏂板缓 + Map<string,string> mso = ApexPages.currentPage().getParameters(); + system.debug('mso='+mso); + if(mso.containsKey('Name')){ + controller.getRecord().put('Name',mso.get('Name')); + } + if(mso.containsKey('CF00N10000008ps61_lkid')){ + controller.getRecord().put('OPDPlan__c',mso.get('CF00N10000008ps61_lkid')); + } + if(mso.containsKey('CF00N10000003Mp1d_lkid')){ + controller.getRecord().put('Hospital__c',mso.get('CF00N10000003Mp1d_lkid')); + } + if(mso.containsKey('CF00N10000003O3V6_lkid')){ + controller.getRecord().put('Strategic_dept__c',mso.get('CF00N10000003O3V6_lkid')); + } + if(mso.containsKey('CF00N10000003Mp2R_lkid')){ + controller.getRecord().put('Account__c',mso.get('CF00N10000003Mp2R_lkid')); + } + if(mso.containsKey('00N10000003Msk0')){ + controller.getRecord().put('Demo_purpose1__c',mso.get('00N10000003Msk0')); + } + if(mso.containsKey('00N10000003Msk5')){ + controller.getRecord().put('demo_purpose2__c',mso.get('00N10000003Msk5')); + } + if(mso.containsKey('00N100000098amW')){ + controller.getRecord().put('NoOpp_Reason__c',mso.get('00N100000098amW')); + } + if(mso.containsKey('00N10000003OJzc')){ + controller.getRecord().put('Loaner_received_staff__c',mso.get('00N10000003OJzc')); + } rtTypeId = ApexPages.currentPage().getParameters().get('RecordType'); obj.put('OwnerId',UserInfo.getUserId()); } @@ -75,25 +106,28 @@ Rental_Apply__c rentalApplyInfo = new Rental_Apply__c(); //鑷畾涔夋牸寮忚浆鎹� for (String fieldAPI: fieldValueMap.keySet()) { - system.debug('field API='+fieldAPI); Schema.DisplayType fielddataType = fieldAPIToTypeMap.get(fieldAPI).getDescribe().getType(); String fieldValue = String.valueOf(fieldValueMap.get(fieldAPI)); - system.debug('Field Type:'+fielddataType+' field Value='+fieldValue); + if(String.isBlank(fieldValue)){ + continue; + } if(String.valueOf(fielddataType)=='DATE'){ - rentalApplyInfo.put(fieldAPI,(String.isBlank(fieldValue)||String.isEmpty(fieldValue))? null:Date.valueOf(fieldValue.replace('/', '-'))); + System.debug('DATE fieldAPI = '+fieldAPI+' filedData = '+String.valueOf(fieldValueMap.get(fieldAPI))); + rentalApplyInfo.put(fieldAPI, Date.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)).replace('/', '-'))); }else if(String.valueOf(fielddataType)=='DATETIME'){ - if(String.isNotBlank(fieldValue)&&fieldValue.contains('T')){ - fieldValue = fieldValue.replace('T',' '); - rentalApplyInfo.put(fieldAPI, Datetime.valueOfGmt(fieldValue)); - }else{ - rentalApplyInfo.put(fieldAPI, null); - } - }else if(String.valueof(fielddataType)=='CURRENCY'|| String.valueof(fielddataType)=='PERCENT'||String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ - rentalApplyInfo.put(fieldAPI, (String.isBlank(fieldValue)||String.isEmpty(fieldValue))?0:Decimal.valueOf(fieldValue)); + 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.isNotBlank(dt)) { + rentalApplyInfo.put(fieldAPI, Datetime.valueOf(dt)); + } + }else if(String.valueOf(fielddataType)=='Number'||String.valueOf(fielddataType)=='DOUBLE' ){ + rentalApplyInfo.put(fieldAPI, Decimal.valueOf(String.valueOf(fieldValueMap.get(fieldAPI)))); } else if(String.valueof(fielddataType)=='BOOLEAN'){ rentalApplyInfo.put(fieldAPI, fieldValueMap.get(fieldAPI)); }else { - rentalApplyInfo.put(fieldAPI,fieldValue); + rentalApplyInfo.put(fieldAPI, String.valueOf(fieldValueMap.get(fieldAPI))); } } @@ -125,6 +159,26 @@ resp.status = status; System.debug('respzhj = ' + resp); return resp; + } catch(DmlException e) { + rid=rentalApplyInfo.Id; + Integer index = 0; + System.debug(e.getNumDml()); + System.debug(e.getDmlFields(index)); + System.debug(e.getDmlId(index)); + System.debug(e.getDmlIndex(index)); + System.debug(e.getDmlMessage(index)); + System.debug(e.getDmlStatusCode(index)); + System.debug(e.getDmlType(index)); + system.debug(e.getMessage()); + system.debug(e.getStackTraceString()); + + System.debug('into catch'+e.getMessage()); + Database.rollback(sp); + resp.status = 'Exception'; + resp.message ='淇濆瓨澶辫触锛屽師鍥�:'+ e.getDmlMessage(index); + PIHelper.saveTransLog(sobjectTypeValue,rid,transId, (String)rentalApplyInfo.get('AWS_Data_Id__c'),rentalApplyJson ,status,''); + return resp; + } catch(Exception e) { System.debug('into catch'+e.getMessage()); Database.rollback(sp); diff --git a/force-app/main/default/classes/SearchContactController.cls b/force-app/main/default/classes/SearchContactController.cls index f84e347..808d126 100644 --- a/force-app/main/default/classes/SearchContactController.cls +++ b/force-app/main/default/classes/SearchContactController.cls @@ -13,15 +13,31 @@ public String contactAWSIds {set;get;} public String contactsInfo {set;get;} public String PIPL_Search_Contact_Label{set;get;} + public String aId{set;get;} + public static Boolean checkNullString(String inputString){ + if(String.isEmpty(inputString)||String.isBlank(inputString)){ + return true; + } + return false; + } public SearchContactController() { String accountId = ApexPages.currentPage().getParameters().get('accountId'); + searchKeyWord = ApexPages.currentPage().getParameters().get('searchContactKeyWord'); + aId = accountId; PIPL_Search_Contact_Label = Label.PIPL_Search_Contact_Label; //1. Query Contact by accountId List<Contact> conList = new List<Contact>(); system.debug('Account Id from Front-end:'+accountId); - if(String.isNotBlank(accountId) && String.isNotEmpty(accountId)){ - conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where AccountId=:accountId and AWS_Data_Id__c!='']); - } + if(checkNullString(accountId)&&checkNullString(searchKeyWord)){ + conList = new List<Contact>(); + }else{ + if(checkNullString(accountId)){ + conList = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AWS_Data_Id__c!='']); + }else { + conList = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AccountId=:accountId and AWS_Data_Id__c!='']); + } + + } //2. Prepare the Contact Info Map<String,Contact> awsIdToContactMap = new Map<String,Contact>(); List<String> conAWSIds = new List<String>(); @@ -35,21 +51,36 @@ } @RemoteAction - public static Response searchContacts(String awsContactIds) { + public static Response searchContacts(String awsContactIds,String searchContactName,String accountId) { + system.debug('awsContactIds = ' + awsContactIds); Response resp = new Response(); resp.status = 'fail'; - if(String.isBlank(awsContactIds)||String.isEmpty(awsContactIds)){ - return resp; - } - List<String> awsDataIds = (List<String>) JSON.deserialize(awsContactIds, List<String>.class); Map<String,Contact> awsIdToContactMapTemp = new Map<String,Contact>(); - List<Contact> conListTemp = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AWS_Data_Id__c in:awsDataIds]); - for(Contact con:conListTemp){ - awsIdToContactMapTemp.put(con.AWS_Data_Id__c,con); + if(!checkNullString(awsContactIds)){ + List<String> awsDataIds = (List<String>) JSON.deserialize(awsContactIds, List<String>.class); + List<Contact> conListTemp = new List<Contact>(); + if(!checkNullString(accountId)){ + conListTemp = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AccountId=:accountId and AWS_Data_Id__c in:awsDataIds]); + }else { + conListTemp = new List<Contact>([select Id,AWS_Data_Id__c,Account.Name from Contact where AWS_Data_Id__c in:awsDataIds]); + } + for(Contact con:conListTemp){ + awsIdToContactMapTemp.put(con.AWS_Data_Id__c,con); + } } - if(awsIdToContactMapTemp.keySet().size()>0){ + System.debug('awsIdToContactMapTemp = ' + awsIdToContactMapTemp); + Map<String,Contact> noPIContactMapTemp = new Map<String,Contact>(); + List<Contact> partnerContactList = AWSServiceTool.getNoPIContact(searchContactName,accountId); + System.debug('partnerContactList = ' + partnerContactList); + if(partnerContactList.size()>0){ + for(Contact con:partnerContactList){ + noPIContactMapTemp.put(con.Id,con); + } + } + if(awsIdToContactMapTemp.keySet().size()>0 ||noPIContactMapTemp.keySet().size()>0){ resp.status = 'success'; - resp.message = JSON.serialize(awsIdToContactMapTemp); + resp.message = JSON.serialize(awsIdToContactMapTemp);// PI contact info + resp.noPIContactList = JSON.serialize(noPIContactMapTemp);//NoPI contact info } return resp; } @@ -69,5 +100,6 @@ public class Response{ public String message{set;get;} public String status{set;get;} + public String noPIContactList{set;get;} } } \ No newline at end of file diff --git a/force-app/main/default/classes/SearchLeadController.cls b/force-app/main/default/classes/SearchLeadController.cls index c752de2..4df1668 100644 --- a/force-app/main/default/classes/SearchLeadController.cls +++ b/force-app/main/default/classes/SearchLeadController.cls @@ -6,6 +6,7 @@ public String PIPL_Search_Contact_Label{set;get;} public SearchLeadController() { // String accountId = ApexPages.currentPage().getParameters().get('accountId'); + searchKeyWord = ApexPages.currentPage().getParameters().get('searchLeadKeyWord');//add by Li Jun 20220321 PIPL_Search_Contact_Label = Label.PIPL_Search_Contact_Label; //1. Query Contact by accountId List<Lead> leadList = new List<Lead>(); diff --git a/force-app/main/default/classes/SoqlHelper.cls b/force-app/main/default/classes/SoqlHelper.cls index 1aaee51..fa51220 100644 --- a/force-app/main/default/classes/SoqlHelper.cls +++ b/force-app/main/default/classes/SoqlHelper.cls @@ -69,7 +69,7 @@ ss+=') '; return ss; } - + public static string ToInCondition(Set<string> so){ return ToInCondition(new List<string>(so)); } @@ -92,7 +92,7 @@ if(so_list == null || so_list.size() == 0)return; update so_list; } - + public static Map<string,Database.UpsertResult> UpsertList(List<Sobject> so_list, Schema.SObjectField field) { Map<string,Database.UpsertResult> mid = new Map<string,Database.UpsertResult>(); @@ -118,7 +118,7 @@ } return mid; } - + public static void DeleteList(List<Sobject> so_list) { if(so_list == null || so_list.size() == 0)return; diff --git a/force-app/main/default/classes/WeeklyReportCmp.cls b/force-app/main/default/classes/WeeklyReportCmp.cls index b7787c5..2f48565 100644 --- a/force-app/main/default/classes/WeeklyReportCmp.cls +++ b/force-app/main/default/classes/WeeklyReportCmp.cls @@ -420,7 +420,6 @@ if (Department_Cateogy != '') { agency_report.Department_Cateogy__c = Department_Cateogy; } if (Purpose_Type != '') { agency_report.Purpose_Type__c = Purpose_Type; } //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start - system.debug('SupportNeedsc+++==++==='+SupportNeedsc); if (SupportNeedsc != '') { agency_report.SupportNeeds__c = SupportNeedsc; } //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end if (Agency_Report_Header != '') { agency_report.Agency_Report_Header__c = Agency_Report_Header; } @@ -552,7 +551,6 @@ // 閫卞牨銉囥兗銈裤倰鍙栧緱 Date week = Date.valueOf(date_str); this.reports = LightningUtil.selectAgencyReport(week, person_str); - System.debug('this.reports+++'+this.reports); } @RemoteAction diff --git a/force-app/main/default/pages/AssessmentReport.page b/force-app/main/default/pages/AssessmentReport.page index 1e298cb..df6478f 100644 --- a/force-app/main/default/pages/AssessmentReport.page +++ b/force-app/main/default/pages/AssessmentReport.page @@ -51,9 +51,12 @@ let y=window.event.y; createDiv.style.left=x; createDiv.style.top=y; + createDiv.style.height='30px'; + createDiv.style.width='100px'; createDiv.style.background="#dddddd"; createDiv.style.position = "absolute"; - parentNode.appendChild(createDiv); + parentNode.appendChild(createDiv); + parentNode.style.position = "relative"; } function hidePIDiv(awsDataId){ diff --git a/force-app/main/default/pages/CM_SearchContact.page b/force-app/main/default/pages/CM_SearchContact.page index afa740a..02af455 100644 --- a/force-app/main/default/pages/CM_SearchContact.page +++ b/force-app/main/default/pages/CM_SearchContact.page @@ -124,7 +124,7 @@ let parentNode = document.getElementById(awsDataId); let createDiv = document.createElement("div"); createDiv.id = awsDataId+"_PI"; - let piInformation = 'Name:'+contact[awsDataId].lastName +'\n' +'Phone:'+contact[awsDataId].phone + let piInformation = '濮撳悕:'+contact[awsDataId].lastName +'\n' +'鐢佃瘽:'+contact[awsDataId].phone //let piInformation = 'Name:'+contact['943114607025717249'].lastName +'\n' +'Phone:'+contact['943114607025717249'].phone createDiv.innerText = piInformation; let x=window.event.x; @@ -134,6 +134,7 @@ createDiv.style.background="#dddddd"; createDiv.style.position = "absolute"; parentNode.appendChild(createDiv); + parentNode.style.position = "relative"; } function hidePIDiv(awsDataId){ diff --git a/force-app/main/default/pages/CM_SearchContactService.page b/force-app/main/default/pages/CM_SearchContactService.page index e0bb42c..4011785 100644 --- a/force-app/main/default/pages/CM_SearchContactService.page +++ b/force-app/main/default/pages/CM_SearchContactService.page @@ -29,7 +29,7 @@ function Foo(){ j$('[aws-id]').each(function(i,e){ let awsDataId = j$(e).attr('aws-id'); - let piInformation = 'Name:'+contact[awsDataId].lastName +'<br/>' +'Phone:'+ (contact[awsDataId].phone ? contact[awsDataId].phone :''); + let piInformation = '濮撳悕:'+contact[awsDataId].lastName +'<br/>' +'鎵嬫満鍙�:'+ (contact[awsDataId].mobilePhone ? contact[awsDataId].mobilePhone :''); j$(e).find('.decrypt').html(piInformation); }); } @@ -51,7 +51,7 @@ for(var i=0;i<contacts.length;i++){ let temp = {} temp.lastName = contacts[i].lastName; - temp.phone = contacts[i].phone; + temp.mobilePhone = contacts[i].mobilePhone; contact[contacts[i].dataId] = temp; } @@ -146,7 +146,7 @@ // createDiv.style.position = "absolute"; // parentNode.appendChild(createDiv); console.log('dataId:'+dataId+'awsDataId Value:'+awsDataId); - let piInformation = 'Name:'+contact[awsDataId].lastName +'\n' +'Phone:'+ (contact[awsDataId].phone ? contact[awsDataId].phone :''); + let piInformation = '濮撳悕:'+contact[awsDataId].lastName +'\n' +'鐢佃瘽:'+ (contact[awsDataId].mobilePhone?contact[awsDataId].mobilePhone:''); document.getElementById(dataId+'_'+awsDataId).innerText = piInformation; } diff --git a/force-app/main/default/pages/CampaignMember.page b/force-app/main/default/pages/CampaignMember.page index dd9ccce..7e8cd6b 100644 --- a/force-app/main/default/pages/CampaignMember.page +++ b/force-app/main/default/pages/CampaignMember.page @@ -149,7 +149,7 @@ jQuery(function(){ var eles = document.getElementsByClassName("contact"); - for(let e of eles){ + for(let ei in eles){let e=eles[ei]; let awsid = e.getAttribute('awsid'); if(awsid) awsids.push(awsid); } @@ -157,7 +157,7 @@ if(awsids.length > 0){ AWSService.search(staticResource.searchUrl,JSON.stringify({dataIds:awsids}),function(result){ if(result.status == '0' && result.object && result.object.length > 0){ - for(let obj of result.object){ + for(let obji in result.object){let obj=result.object[obji]; jQuery("[awsid='"+obj.dataId + "']").val(obj.lastName); } } diff --git a/force-app/main/default/pages/ConsumApplyUploadPdf.page b/force-app/main/default/pages/ConsumApplyUploadPdf.page index d628e99..05a2266 100644 --- a/force-app/main/default/pages/ConsumApplyUploadPdf.page +++ b/force-app/main/default/pages/ConsumApplyUploadPdf.page @@ -56,22 +56,16 @@ } function confirmTrans(transId, isSuccess) { - fetch(staticResources.updateUrl, { - method: 'POST', - body: JSON.stringify({ 'txId': transId, "isSuccess": isSuccess }), - headers: { - 'Content-Type': 'application/json', - 'pi-token': staticResources.token - } - }).then((data) => { - return data.json(); - }).then(data => { + AWSService.post(staticResources.updateUrl, JSON.stringify({ + "txId":transId, + "sfRecordId":"", + "isSuccess":isSuccess + }), function(result){ console.log("confirmTrans-" + JSON.stringify(data)); document.getElementById("file").files[0].name = ''; enableButtonStatus(); - refreshFiles(); - return data.status; - }) + refreshFiles(); + }, staticResources.token); } function calculateFileSize(fileObject) { diff --git a/force-app/main/default/pages/ConsumTrial.page b/force-app/main/default/pages/ConsumTrial.page index 6bc6628..a8ff8df 100644 --- a/force-app/main/default/pages/ConsumTrial.page +++ b/force-app/main/default/pages/ConsumTrial.page @@ -318,6 +318,7 @@ var p = new Promise(function(resolve, reject){ rowBList = JSON.parse('{!rowListString}') var x = 0; + var y = 0; let searchCallBack = function searchCallBack(result){ let contacts = result.object; if(contacts == null){ @@ -329,16 +330,19 @@ x++; }; for(var i=0;i<rowBList.length;i++){ - ids.push(rowBList[i].rnd.AWS_Data_Id__c + '_' + rowBList[i].rnd.Id); - AWSService.query(staticResource.queryUrl,rowBList[i].rnd.AWS_Data_Id__c,searchCallBack,staticResource.token); + if(rowBList[i].rnd.AWS_Data_Id__c ){ + y++; + ids.push(rowBList[i].rnd.AWS_Data_Id__c + '_' + rowBList[i].rnd.Id); + AWSService.query(staticResource.queryUrl,rowBList[i].rnd.AWS_Data_Id__c,searchCallBack,staticResource.token); + } } var id = setInterval(function(){ - if(x >= rowBList.length){ + if(x == y){ console.log('success') resolve('success'); clearInterval(id); } - },1000); + },500); }); return p; } @@ -386,6 +390,9 @@ if(awsDataId.length == 0){ return } + if(TrialUser[awsDataId.substring(0,18)] == null){ + return + } console.log('awsDataId Value:'+awsDataId); let parentNode = document.getElementById(awsDataId); let createDiv = document.createElement("div"); @@ -407,7 +414,75 @@ if(awsDataId.length == 0){ return } + if(TrialUser[awsDataId.substring(0,18)] == null){ + return + } document.getElementById(awsDataId+'_PI').remove(); + } + + function q3(){ + var p = new Promise(function(resolve, reject){ + console.log('saveRecordJS') + + var a = 0; + var b = 0; + let newCallBack = function newCallBack(result,indexNumber){ + + console.log('result = '+JSON.stringify(result)) + //璧嬪�糳ataId鍜宼rialUser + document.getElementById('allPage:allForm:dataBlock:dataline_R_aws:'+indexNumber+':EditAWSDataId').value = result.object[0].dataId; + document.getElementById('allPage:allForm:dataBlock:dataline_R:'+indexNumber+':inputField:6:inputField').value = result.object[0].trialUser; + let transParameters = { + txId: result.txId, + isSuccess: 1 + }; + let confirmCallBack = function confirmCallBack(result){ + console.log('confirmCallBack = '+JSON.stringify(result)) + } + b++; + AWSService.confirmTrans(staticResource.transactionUrl,JSON.stringify(transParameters),confirmCallBack,staticResource.token) + }; + for(var i=0;i<rowBList.length;i++){ + if(document.getElementById('allPage:allForm:dataBlock:dataline_L:'+i+':rowCheck').checked == true){ + a++; + } + } + debugger + for(var i=0;i<rowBList.length;i++){ + if(document.getElementById('allPage:allForm:dataBlock:dataline_L:'+i+':rowCheck').checked == true){ + //鍔犲瘑璇曠敤鑰� + var trialUser = document.getElementById('allPage:allForm:dataBlock:dataline_R:'+i+':inputField:6:j_id86').children[0].children[0].value + let consumApplyPayloadList = []; + let consumApplyPIData = new Object(); + consumApplyPIData.trialUser = trialUser; + consumApplyPIData.sfRecordId = ''; + consumApplyPayloadList.push(consumApplyPIData); + AWSService.postConsumTrial(staticResource.newUrl,i,JSON.stringify(consumApplyPayloadList),newCallBack,staticResource.token); + } + } + var id = setInterval(function(){ + if(a == b){ + console.log('a==b success') + resolve('success'); + clearInterval(id); + } + },500); + }); + return p; + } + + function q4(){ + debugger + saveRecord(); + } + function saveRecordJS(){ + if('{!pageB.fixMode}' != 'true'){ + return + } + q3().then(function(data){ + return q4(data); + }) + unblockUI(); } //2022 02 24 寮犲崕寤� display PI Data end </script> @@ -488,7 +563,7 @@ <apex:commandButton value="閫傜敤" rendered="{!canEdit}" onclick="applyJs();return false;"/> </span> <span style="margin-left: 10px;"> - <apex:commandButton value="淇濆瓨" onclick="blockme();saveRecord(); return false;" rendered="{!canEdit}"/> + <apex:commandButton value="淇濆瓨" onclick="blockme();saveRecordJS(); return false;" rendered="{!canEdit}"/> </span> </td> </tr> @@ -554,13 +629,16 @@ </apex:repeat> </table> </div> + <apex:repeat id="dataline_R_aws" value="{!pageB.rowBList}" var="var"> + <apex:inputHidden value="{!var.rnd.AWS_Data_Id__c}" id="EditAWSDataId"/> + </apex:repeat> <div id="in_Div" style="overflow:auto;"> <table class="list" style="border-bottom-width: 0px; font-size:11px; border-spacing:0;" border="" id="tableData"> <apex:variable value="{!0}" var="Cnt_R" /> <apex:repeat id="dataline_R" value="{!pageB.rowBList}" var="var"> <tr id="tableData_R_{!Cnt_R}" class="dataRow" onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}" style="{!IF(var.isOddnumber, 'background-color : #EFF4FC;', '')}"> <apex:repeat value="{!inputFieldList}" var="info" id="inputField"> - <td class="dataCellBorder1 intf {!info.value} col_{!info.value}" id="{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,info.value)}" onmouseover="showPIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')" onmouseout="hidePIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')"> + <td class="dataCellBorder1 intf {!info.value} col_{!info.value}" id="{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,info.value)}" onmouseover="showPIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')" onmouseout="hidePIDiv('{! IF(info.value=='Trial_User__c',var.rnd.AWS_Data_Id__c+'_'+var.rnd.Id,'')}')"> <apex:outputPanel rendered="{!(contains(var.canChangeField, info.value) || var.canChangeField == '') && pageB.fixMode == true && var.canChange == true && info.value != 'Degree_Of_Importance__c'}"> <!-- onchange="setChangeFlg('{!var.lineNo}')" --> <apex:outputPanel rendered="{!info.value != 'Case_OR_animal_organ__c'}"> @@ -597,8 +675,10 @@ <!-- <apex:inputHidden value="{!var.rnd.Degree_Of_Importance__c}"/> --> </td> <td class="col_Scroll"></td> + </tr> <apex:variable value="{!Cnt_R+1}" var="Cnt_R" /> + </apex:repeat> </table> </div> diff --git a/force-app/main/default/pages/NewAndEditASEActivity.page b/force-app/main/default/pages/NewAndEditASEActivity.page index 8017b88..e13349b 100644 --- a/force-app/main/default/pages/NewAndEditASEActivity.page +++ b/force-app/main/default/pages/NewAndEditASEActivity.page @@ -1,3 +1,10 @@ +<!-- + @description : + @author : ChangeMeIn@UserSettingsUnder.SFDoc + @group : + @last modified on : 03-23-2022 + @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc +--> <apex:page standardController="ASEActivity__c" extensions="NewAndEditASEActivityController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> @@ -397,10 +404,11 @@ accountValue = document.getElementById(accountNodeId).value; } console.log('accountValue = ' + accountValue); + let searchContactKeyWord = document.querySelector("[data-id='ReporterASE__c']").value; if(accountValue !='000000000000000'){ - suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; + suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; }else{ - suffixUrl = "?contactId="+contactNodeId; + suffixUrl = "?contactId="+contactNodeId+"&searchContactKeyWord=" + searchContactKeyWord; } let baseUrl = "/apex/SearchContactPage"; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; @@ -561,6 +569,7 @@ replaceSearchContactLookup(); document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); jQuery('a[data-id="OwnerId"]').remove(); + /* jQuery(".lookupInput").each(function(i,e){ let je =jQuery(e).find('input'); je.attr("readonly",""); @@ -590,6 +599,24 @@ } } }); + */ + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + + let dataid = je.attr('data-id'); + if(['ContactId'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; + } + }) + }) }); </script> <div class="pbBottomButtons"> diff --git a/force-app/main/default/pages/NewAndEditAddress.page b/force-app/main/default/pages/NewAndEditAddress.page index ee20ca4..773d6fe 100644 --- a/force-app/main/default/pages/NewAndEditAddress.page +++ b/force-app/main/default/pages/NewAndEditAddress.page @@ -2,7 +2,7 @@ @description : @author : ChangeMeIn@UserSettingsUnder.SFDoc @group : - @last modified on : 03-17-2022 + @last modified on : 03-23-2022 @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc --> <apex:page standardController="Address__c" extensions="NewAndEditAddressController" id="page"> @@ -237,13 +237,13 @@ //1. Get Address Information from Form let addressJson = getAddressInformation(); //2. Validate the Address field value formate, for example the email formate or phone formate - let validationResultMessage = validateFieldValueFormate(); - console.log(validationResultMessage); - if (validationResultMessage) { - //Popup error message. - To Do After POC - alertErrorMessage(validationResultMessage); - return - } + // let validationResultMessage = validateFieldValueFormate(); + // console.log(validationResultMessage); + // if (validationResultMessage) { + // //Popup error message. - To Do After POC + // alertErrorMessage(validationResultMessage); + // return + // } // Check Required Field let checkRequiredFieldMsgResult = checkRequiredFieldMsg(addressJson); if (checkRequiredFieldMsgResult) { @@ -282,10 +282,11 @@ //1. Check account value let accountNodeId = document.querySelector("[data-id='Customer__c']").id + '_lkid'; let accountValue = document.getElementById(accountNodeId).value; + let searchContactKeyWord = document.querySelector("[data-id='Customer__c']").value; console.log(accountValue); if (accountValue != '000000000000000') { let baseUrl = "/apex/SearchContactPage"; - let suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue; + let suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue+"&searchContactKeyWord=" + searchContactKeyWord; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; newSearchContactWindow = window.open(baseUrl + suffixUrl, 'Popup', newSearchContactParam); if (window.focus) { @@ -432,14 +433,15 @@ //Replace Vlookup Field replaceSearchContactLookup(); //3. Set Readonly Attribute - // document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); + // document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); + /* jQuery(".lookupInput").each(function(i,e){ let je =jQuery(e).find('input'); je.attr("readonly",""); je.css("background","unset"); let dataid = je.attr('data-id'); - if(['Province__c', 'OwnerId'].indexOf(dataid) > -1) return; + if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); }) @@ -455,13 +457,33 @@ let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); let input = document.getElementById(id); if(input){ - input.value = ''; - let hidden = document.getElementById(id+'_lkid'); + input.value = ''; + let hidden = document.getElementById(id+'_lkid'); if(hidden){ - hidden.value = ''; + hidden.value = ''; } } }); + */ + + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + + let dataid = je.attr('data-id'); + if(['Contacts__c'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; + } + }) + }) + }); </script> <div class="pbBottomButtons"> diff --git a/force-app/main/default/pages/NewAndEditAgencyContact.page b/force-app/main/default/pages/NewAndEditAgencyContact.page index 2007b25..dd21ac9 100644 --- a/force-app/main/default/pages/NewAndEditAgencyContact.page +++ b/force-app/main/default/pages/NewAndEditAgencyContact.page @@ -361,7 +361,8 @@ console.log(accountValue); if(true || accountValue !='000000000000000'){ let baseUrl = "/apex/SearchContactPage"; - let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; + let searchContactKeyWord = document.querySelector("[data-id='Contact__c']").value; + let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); if (window.focus) { @@ -502,6 +503,7 @@ } jQuery('a[data-id="OwnerId"]').remove(); + /* jQuery(".lookupInput").each(function(i,e){ let je =jQuery(e).find('input'); je.attr("readonly",""); @@ -530,7 +532,24 @@ hidden.value = ''; } } - }); + });*/ + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + + let dataid = je.attr('data-id'); + if(['Contact__c'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; + } + }) + }) var layoutSections = JSON.parse('{!layoutSectionsStr}'); for (let m = 0; m < layoutSections.length; m++) { diff --git a/force-app/main/default/pages/NewAndEditCase.page b/force-app/main/default/pages/NewAndEditCase.page index 90dec1a..0310339 100644 --- a/force-app/main/default/pages/NewAndEditCase.page +++ b/force-app/main/default/pages/NewAndEditCase.page @@ -103,6 +103,19 @@ let nodelist = document.querySelectorAll("[data-id]"); let result = {} result.RecordTypeId = '{!rtTypeId}' + //瀵屾枃鏈� + var describedbyAll = document.querySelectorAll("[aria-describedby = 'cke_34']"); + if(describedbyAll){ + for (let idx = 0; idx < describedbyAll.length; idx++) { + let describedby = describedbyAll[idx]; + if (describedby.title.indexOf('Text_attachement__c') > 0){ + result.Text_attachement__c = describedby.contentWindow.document.getElementsByTagName('body')[0].innerHTML; + if (result.Text_attachement__c == '<br>') { + result.Text_attachement__c = ''; + } + } + } + } for (let index = 0; index < nodelist.length; index++) { if (VLookUpFields.has(nodelist[index].getAttribute("data-id"))) { console.log(nodelist[index].id.indexOf('lkwgt')); @@ -279,7 +292,8 @@ console.log(accountValue); if(accountValue !='000000000000000'){ let baseUrl = "/apex/SearchContactPage"; - let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; + let searchContactKeyWord = document.querySelector("[data-id='ContactId']").value; + let suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue+"&searchContactKeyWord=" + searchContactKeyWord; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); if (window.focus) { @@ -432,35 +446,52 @@ jQuery('a[data-id="OwnerId"]').remove(); - jQuery(".lookupInput").each(function(i,e){ - let je =jQuery(e).find('input'); - je.attr("readonly",""); - je.css("background","unset"); - + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + let dataid = je.attr('data-id'); - if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; - jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); - }) - - jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ - this.className = "closeIconOn"; - }); - - jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ - this.className = "closeIcon" - }); - - jQuery(".lookupInput").on("click","img[generate]",function(e){ - let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); - let input = document.getElementById(id); - if(input){ - input.value = ''; - let hidden = document.getElementById(id+'_lkid'); - if(hidden){ - hidden.value = ''; + if(['ContactId'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; } - } - }); + }) + }) + // jQuery(".lookupInput").each(function(i,e){ + // let je =jQuery(e).find('input'); + // je.attr("readonly",""); + // je.css("background","unset"); + + // let dataid = je.attr('data-id'); + // if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; + // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); + // }) + + // jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ + // this.className = "closeIconOn"; + // }); + + // jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ + // this.className = "closeIcon" + // }); + + // jQuery(".lookupInput").on("click","img[generate]",function(e){ + // let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); + // let input = document.getElementById(id); + // if(input){ + // input.value = ''; + // let hidden = document.getElementById(id+'_lkid'); + // if(hidden){ + // hidden.value = ''; + // } + // } + // }); }); </script> <div class="pbBottomButtons"> diff --git a/force-app/main/default/pages/NewAndEditContact.page b/force-app/main/default/pages/NewAndEditContact.page index 93657c4..e9c31db 100644 --- a/force-app/main/default/pages/NewAndEditContact.page +++ b/force-app/main/default/pages/NewAndEditContact.page @@ -191,7 +191,7 @@ } let phone = document.querySelector(textPhone); - if(phone ){ + if(phone && false ){ if(phone.value){ if(!/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ error_msg += ';鐢佃瘽鍙风爜閿欒'; @@ -487,6 +487,7 @@ } jQuery('a[data-id="OwnerId"]').remove(); + /* jQuery(".lookupInput").each(function(i,e){ let je =jQuery(e).find('input'); je.attr("readonly",""); @@ -515,7 +516,7 @@ hidden.value = ''; } } - }); + });*/ var layoutSections = JSON.parse('{!layoutSectionsStr}'); for (let m = 0; m < layoutSections.length; m++) { diff --git a/force-app/main/default/pages/NewAndEditInquiryForm.page b/force-app/main/default/pages/NewAndEditInquiryForm.page index 794606e..7bf1bba 100644 --- a/force-app/main/default/pages/NewAndEditInquiryForm.page +++ b/force-app/main/default/pages/NewAndEditInquiryForm.page @@ -382,10 +382,12 @@ accountValue = document.getElementById(accountNodeId).value; } console.log(accountValue); + + let searchContactKeyWord = document.querySelector("[data-id='Contact_Name__c']").value; if(accountValue !='000000000000000'){ - suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; + suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue+"&searchContactKeyWord=" + searchContactKeyWord; }else{ - suffixUrl = "?contactId="+contactNodeId; + suffixUrl = "?contactId="+contactNodeId+"&searchContactKeyWord=" + searchContactKeyWord; } let baseUrl = "/apex/SearchContactPage"; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; @@ -413,10 +415,12 @@ let lookUpNode = htmlToElement(contactHtmlString); console.log(lookUpNode); let eleContactValue = document.querySelector("[data-id='Contact_Name__c']").parentNode.parentNode.children[0].value; - if (!{!isNewMode} || (eleContactValue != '000000000000000')) { - //1. Query Contact from AWS by AWSDataId - queryContactName() - } + if (eleContactValue) { + if (!{!isNewMode} || (eleContactValue != '000000000000000')) { + //1. Query Contact from AWS by AWSDataId + queryContactName() + } + } let parentNode = document.querySelector("[data-id='Contact_Name__c']").parentNode; document.querySelector("[data-id='Contact_Name__c']").removeAttribute("onchange"); parentNode.replaceChild(lookUpNode, document.querySelector("[data-id='Contact_Name__c']").parentNode.children[2]); @@ -465,7 +469,8 @@ function searchLead(leadNodeId){ // let accountValue = ""; // let suffixUrl = ""; - let suffixUrl = "?leadId="+leadNodeId; + let searchLeadKeyWord = document.querySelector("[data-id='Lead_link__c']").value; + let suffixUrl = "?leadId="+leadNodeId+"&searchLeadKeyWord=" + searchLeadKeyWord; let baseUrl = "/apex/SearchLeadPage"; let newSearchLeadParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; newSearchLeadWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchLeadParam); @@ -574,7 +579,18 @@ </apex:pageBlockSection> </apex:repeat> <script> + var api_id_map={}; sfdcPage.appendToOnloadQueue(function () { + var init_nodes = document.getElementsByClassName("PIBackApi"); + for(let ei in init_nodes){ + let e = init_nodes[ei]; + if(IsFormElement(e)){ + if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){ + api_id_map[GetEleApiName(e)] = e.id; + } + } + } + var layoutSections = JSON.parse('{!layoutSectionsStr}'); for (let m = 0; m < layoutSections.length; m++) { let layoutSection = layoutSections[m].layoutFields; @@ -615,15 +631,8 @@ jQuery('a[data-id="OwnerId"]').remove(); - jQuery(".lookupInput").each(function(i,e){ - let je =jQuery(e).find('input'); - je.attr("readonly",""); - je.css("background","unset"); - - let dataid = je.attr('data-id'); - if(['Hospital_Name__c','Hospital__c','OwnerId'].indexOf(dataid) > -1) return; - jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); - }) + //Updated by Li Jun 20220322 Start + /* jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ this.className = "closeIconOn"; @@ -643,24 +652,37 @@ hidden.value = ''; } } - }); + });*/ + //Updated by Li Jun 20220322 End + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); - let eleHospitalName = document.querySelector("[data-id='Hospital_Name__c']"); - let vlook_HospitalName = document.getElementById(eleHospitalName.id + '_lkid'); - - // let eleInput = eleHospitalName.parentNode.childNodes[0]; - // let eleImg = eleHospitalName.parentNode.childNodes[1]; - // let eleBlank = eleHospitalName.parentNode.childNodes[2]; + let dataid = je.attr('data-id'); + if(['Contact_Name__c','Lead_link__c'].indexOf(dataid) < 0) return; + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) - if("\v"=="v"){//true涓篒E娴忚鍣� - vlook_ele.attachEvent("onporpertychange",function(e){ - console.log("inputting!!"); - }); - }else{ - eleHospitalName.parentNode.addEventListener("click",function(e){ - console.log("inputting!!"); - var hospitalNameValue = vlook_HospitalName.value; + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; + } + }) + }) + + // jQuery(".lookupInput").on("click","img.closeIconOn",function(){ + // if (jQuery(this).siblings("input").attr("data-id") == 'Hospital_Name__c'){ + // clearVlookup('Department_Class__c'); + // clearVlookup('Hospital__c'); + // } + // }); + + jQuery("body").on("change","input[data-id='Hospital_Name__c']",function(){ + setTimeout(() => { + console.log(document.getElementById(this.id+'_lkid').value); + var hospitalNameValue = document.getElementById(this.id+'_lkid').value; if (hospitalNameValue != "000000000000000" && hospitalNameValue != '') { console.log("hospitalNameValue = " + hospitalNameValue); @@ -670,8 +692,8 @@ clearVlookup('Department_Class__c'); clearVlookup('Hospital__c'); } - }); - } + }, 50); + }); }); function setVlookup(lookups, lookup_id){ @@ -708,7 +730,7 @@ }, { escape: true } ); - } + }; function clearVlookup(lookup){ let ele = document.querySelector("[data-id='"+lookup+"']"); diff --git a/force-app/main/default/pages/NewAndEditInspectionReport.page b/force-app/main/default/pages/NewAndEditInspectionReport.page index 333496e..fecb514 100644 --- a/force-app/main/default/pages/NewAndEditInspectionReport.page +++ b/force-app/main/default/pages/NewAndEditInspectionReport.page @@ -1,4 +1,5 @@ <apex:page standardController="Inspection_Report__c" extensions="NewAndEditInspectionReportController" id="page"> + <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> @@ -406,6 +407,16 @@ </apex:repeat> <script> sfdcPage.appendToOnloadQueue(function () { + var layoutSections = JSON.parse('{!layoutSectionsStr}'); + for (let m = 0; m < layoutSections.length; m++) { + let layoutSection = layoutSections[m].layoutFields; + for (let n = 0; n < layoutSection.length; n++) { + let layoutField = layoutSection[n]; + if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { + document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); + } + } + } //1. Set Last Name label //document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[2].children[0].innerText = '濮撳悕'; //2. Query AWS Data by dataId @@ -426,46 +437,58 @@ oi.value = '{!CurrentUserId}' } } - var layoutSections = JSON.parse('{!layoutSectionsStr}'); - for (let m = 0; m < layoutSections.length; m++) { - let layoutSection = layoutSections[m].layoutFields; - for (let n = 0; n < layoutSection.length; n++) { - let layoutField = layoutSection[n]; - if (layoutField.fieldAPI != '' && document.querySelector("[data-id='"+layoutField.fieldAPI+"']") != null) { - document.querySelector("[data-id='"+layoutField.fieldAPI+"']").disabled = !(layoutField.editableField); - } - } - } - jQuery(".lookupInput").each(function(i,e){ - let je =jQuery(e).find('input'); - je.attr("readonly",""); - je.css("background","unset"); - + + //Replace Contact Vlookup Field + replaceSearchContactLookup(); + //Replace Lead Vlookup Field + replaceSearchLeadLookup(); + document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); + // document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton"); + + jQuery('a[data-id="OwnerId"]').remove(); + + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + let dataid = je.attr('data-id'); - if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; - jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); - }) - - jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ - this.className = "closeIconOn"; - }); - - jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ - this.className = "closeIcon" - }); - - jQuery(".lookupInput").on("click","img[generate]",function(e){ - let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); - let input = document.getElementById(id); - if(input){ - input.value = ''; - let hidden = document.getElementById(id+'_lkid'); - if(hidden){ - hidden.value = ''; + if(['Hospital__c'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; } - } - }); + }) + }) + + // jQuery(".lookupInput").on("click","img.closeIconOn",function(){ + // if (jQuery(this).siblings("input").attr("data-id") == 'Hospital_Name__c'){ + // clearVlookup('Department_Class__c'); + // clearVlookup('Hospital__c'); + // } + // }); + + jQuery("body").on("change","input[data-id='Hospital_Name__c']",function(){ + setTimeout(() => { + console.log(document.getElementById(this.id+'_lkid').value); + var hospitalNameValue = document.getElementById(this.id+'_lkid').value; + if (hospitalNameValue != "000000000000000" && hospitalNameValue != '') { + console.log("hospitalNameValue = " + hospitalNameValue); + + var ls = ['Department_Class__c','Hospital__c']; + setVlookup(ls,hospitalNameValue); + }else{ + clearVlookup('Department_Class__c'); + clearVlookup('Hospital__c'); + } + }, 50); + }); }); + </script> <div class="pbBottomButtons"> <table cellspacing="0" cellpadding="0" border="0"> diff --git a/force-app/main/default/pages/NewAndEditLead.page b/force-app/main/default/pages/NewAndEditLead.page index cd868a2..61fa0f9 100644 --- a/force-app/main/default/pages/NewAndEditLead.page +++ b/force-app/main/default/pages/NewAndEditLead.page @@ -140,11 +140,18 @@ } function QueryLeadFromAWSIFS() { //staticResourceInquiryForm - AWSService.query(staticResourceInquiryForm.queryUrl, '{!AWSDataIdInquiryForm}', queryBack, staticResourceInquiryForm.token); + AWSService.query(staticResourceInquiryForm.queryUrl, '{!AWSDataIdInquiryForm}', queryBackIFS, staticResourceInquiryForm.token); } var queryBack = function queryBack(data) { console.log('data = ' + data); document.querySelector("[data-id='LastName']").value = data.object.lastName == null ? '' : data.object.lastName; + document.querySelector("[data-id='Phone']").value = data.object.phone == null ? '' : data.object.phone; + document.querySelector("[data-id='Email']").value = data.object.email == null ? '' : data.object.email; + unblockUI(); + }; + var queryBackIFS = function queryBackIFS(data) { + console.log('data = ' + data); + //document.querySelector("[data-id='LastName']").value = document.querySelector("[data-id='Contact_Name__c']").value document.querySelector("[data-id='Phone']").value = data.object.phone == null ? '' : data.object.phone; document.querySelector("[data-id='Email']").value = data.object.email == null ? '' : data.object.email; unblockUI(); @@ -273,10 +280,11 @@ //1. Check account value let accountNodeId = document.querySelector("[data-id='Hospital_Name__c']").id + '_lkid'; let accountValue = document.getElementById(accountNodeId).value; + let searchContactKeyWord = document.querySelector("[data-id='Contact_Name__c']").value; console.log(accountValue); if (accountValue != '000000000000000') { let baseUrl = "/apex/SearchContactPage"; - let suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue; + let suffixUrl = "?contactId=" + contactNodeId + "&accountId=" + accountValue+"&searchContactKeyWord=" + searchContactKeyWord; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; newSearchContactWindow = window.open(baseUrl + suffixUrl, 'Popup', newSearchContactParam); if (window.focus) { @@ -323,6 +331,7 @@ } let queryBackContactName = function queryBackContactName(result){ document.querySelector("[data-id='Contact_Name__c']").value = result.object.lastName; + //document.querySelector("[data-id='LastName']").value = result.object.lastName; }; AWSService.query(staticResourcesContact.queryUrl, dataId, queryBackContactName, staticResourcesContact.token); @@ -338,6 +347,25 @@ // }).then((result) => { // document.querySelector("[data-id='Contact_Name__c']").value = result.object.lastName; // }) + } + function queryContactName2() { + let sfId = document.getElementById(document.querySelector("[data-id='Contact_Name__c']").id + '_lkid').value; + let dataId = ''; + if ('{!contactsInfo}' != '') { + let contactsInfo = JSON.parse('{!contactsInfo}'); + dataId = contactsInfo[sfId]; + } else if ('{!contactDataId}' != '') { + dataId = '{!contactDataId}'; + }else{ + //娌℃湁杩涜鍔犲瘑 + document.querySelector("[data-id='LastName']").value = document.querySelector("[data-id='Contact_Name__c']").value; + return; + } + let queryBackContactName = function queryBackContactName(result){ + document.querySelector("[data-id='Contact_Name__c']").value = result.object.lastName; + document.querySelector("[data-id='LastName']").value = result.object.lastName; + }; + AWSService.query(staticResourcesContact.queryUrl, dataId, queryBackContactName, staticResourcesContact.token); } </script> <div class="bPageTitle"> @@ -431,10 +459,9 @@ //3. Set Readonly Attribute document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); - //濡傛灉鏄仈绯讳汉杩囨潵鐨勭偣鍑绘柊寤烘剰鍚� - if('{!isQueryContact}' == '1'){ - //鏌ユ壘瀹㈡埛濮撳悕 - queryContactName(); + //鏄惁瑙e瘑鑱旂郴浜� + if('{!isDecryptContact}' == '1'){ + queryContactName2(); } @@ -442,15 +469,13 @@ if ('{!ifc}' != '') { blockme(); //鐘舵�� - document.querySelector("[data-id='Status']").value = '璺熻繘涓�' + document.querySelector("[data-id='Status']").value = '鏈窡杩�' //浼氳璇㈤棶鍗� if ('{!ifc.Id}') document.getElementById('page:form:block:j_id34:0:j_id35:j_id36:15:j_id37_lkid').value = '{!ifc.Id}' if ('{!ifc.Name}') document.querySelector("[data-id='Lead_Inquiry_form__c']").value = '{!ifc.Name}' //瀹㈡埛濮撳悕 - // if('{!ifc.Contact_Name__c}') - // document.querySelector("[data-id='Contact_Name__c']").value = '{!ifc.Contact_Name__c}' if ('{!ifc.Contact_Id__c}') document.getElementById(document.querySelector("[data-id='Contact_Name__c']").id + '_lkid').value = '{!ifc.Contact_Id__c}' //鍖婚櫌 @@ -482,12 +507,9 @@ //閭欢 if ('{!ifc.Email__c}') document.querySelector("[data-id='Email']").value = '{!ifc.Email__c}' - //濮撳悕 - if ('{!ifc.Last_Name__c}') - document.querySelector("[data-id='LastName']").value = '{!ifc.Last_Name__c}' //鍜ㄨ鍗曟潵婧� - if ('{!ifc.LeadSource__c}' && document.querySelector("[data-id='LeadSource__c']")) - document.querySelector("[data-id='LeadSource__c']").value = '{!ifc.LeadSource__c}' + if ('{!ifc.LeadSource__c}' && document.querySelector("[data-id='LeadSource']")) + document.querySelector("[data-id='LeadSource']").value = '{!ifc.LeadSource__c}' //鎰忓悜鍖哄垎 if ('{!ifc.Opportunity_Division__c}') document.querySelector("[data-id='Opportunity_Division__c']").value = '{!ifc.Opportunity_Division__c}' @@ -519,41 +541,66 @@ //绱ф�� if ('{!ifc.Urgent__c}') document.querySelector("[data-id='urgent__c']").checked = '{!ifc.Urgent__c}' == 'false' ? false : true; + //鍏徃锛堢瀹わ級 = 绉戝鍚嶇О + if(document.querySelector("[data-id='Company']") && document.querySelector("[data-id='Hospital_Name__c']").value != ''){ + document.querySelector("[data-id='Company']").value = document.querySelector("[data-id='Hospital_Name__c']").value; + } //鏌ユ壘瀹㈡埛濮撳悕 - queryContactName(); + queryContactName2(); //瑙e瘑 QueryLeadFromAWSIFS(); + unblockUI(); } - jQuery(".lookupInput").each(function (i, e) { - let je = jQuery(e).find('input'); - je.attr("readonly", ""); - je.css("background", "unset"); + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); - let dataid = je.attr('data-id'); - if (['Contact_Name__c'].indexOf(dataid) > -1) - jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="' + dataid + '" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); - }) + let dataid = je.attr('data-id'); + if(['Contact_Name__c'].indexOf(dataid) < 0) return; - jQuery(".lookupInput").on("mouseenter", "img[generate]", function (e) { - this.className = "closeIconOn"; - }); + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) - jQuery(".lookupInput").on("mouseleave", "img[generate]", function (e) { - this.className = "closeIcon" - }); + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; + } + }) + }) + //Updated by Li Jun 20220323 Start + // jQuery(".lookupInput").each(function (i, e) { + // let je = jQuery(e).find('input'); + // je.attr("readonly", ""); + // je.css("background", "unset"); - jQuery(".lookupInput").on("click", "img[generate]", function (e) { - let id = jQuery("input[data-id='" + jQuery(this).attr("data-id") + "']").attr("id"); - let input = document.getElementById(id); - if (input) { - input.value = ''; - let hidden = document.getElementById(id + '_lkid'); - if (hidden) { - hidden.value = ''; - } - } - }); + // let dataid = je.attr('data-id'); + // if (['Contact_Name__c'].indexOf(dataid) > -1) + // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="' + dataid + '" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); + // }) + + // jQuery(".lookupInput").on("mouseenter", "img[generate]", function (e) { + // this.className = "closeIconOn"; + // }); + + // jQuery(".lookupInput").on("mouseleave", "img[generate]", function (e) { + // this.className = "closeIcon" + // }); + + + // jQuery(".lookupInput").on("click", "img[generate]", function (e) { + // let id = jQuery("input[data-id='" + jQuery(this).attr("data-id") + "']").attr("id"); + // let input = document.getElementById(id); + // if (input) { + // input.value = ''; + // let hidden = document.getElementById(id + '_lkid'); + // if (hidden) { + // hidden.value = ''; + // } + // } + // }); + //Updated by Li Jun 20220323 Start }); </script> <div class="pbBottomButtons"> diff --git a/force-app/main/default/pages/NewAndEditQIS.page b/force-app/main/default/pages/NewAndEditQIS.page index 05bef34..5e65e26 100644 --- a/force-app/main/default/pages/NewAndEditQIS.page +++ b/force-app/main/default/pages/NewAndEditQIS.page @@ -126,7 +126,7 @@ function ProcessPI(sobjJson, payloadForNewPI) { blockme(); if ({!isNewMode}) { - NewPIToAWS(sobjJson, payloadForNewPI) + NewPIToAWS(sobjJson, payloadForNewPI) }else { UpdatePIToAWS(sobjJson, payloadForNewPI) } @@ -154,8 +154,8 @@ } return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1; } - - function IsFormElement(e){ + + function IsFormElement(e){ return IsFormTag(e.tagName); } @@ -166,17 +166,17 @@ function validateFieldValueFormate() { let error_msg = ''; //let textEmail = "[data-id='Email']"; - let textPhone = "[data-id='Caller_phone__c']"; + //let textPhone = "[data-id='Caller_phone__c']"; //Email // let email = document.querySelector(textEmail); // if(email && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){ // error_msg += ';閭欢鏍煎紡閿欒'; // } - let phone = document.querySelector(textPhone); + //let phone = document.querySelector(textPhone); - if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ - error_msg += ';鑱旂郴鐢佃瘽鏍煎紡閿欒'; - } + //if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ + // error_msg += ';鑱旂郴鐢佃瘽鏍煎紡閿欒'; + //} let es = document.getElementsByTagName('select') for(let ei in es){ @@ -242,7 +242,7 @@ // let e1 = document.getElementById(api_id_map[field_api_name]); // if(!result[field_api_name] && e1 && e1.value){ - // result[field_api_name] = e1.value; + // result[field_api_name] = e1.value; // } } //璧嬪�煎瘜鏂囨湰鍖哄煙 @@ -531,7 +531,7 @@ var api_id_map={}; for(let ei in init_nodes){ let e = init_nodes[ei]; - if(IsFormElement(e)){ + if(IsFormElement(e)){ if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){ api_id_map[GetEleApiName(e)] = e.id; } diff --git a/force-app/main/default/pages/NewAndEditRepairSubOrder.page b/force-app/main/default/pages/NewAndEditRepairSubOrder.page index 7c931e4..cd7ff61 100644 --- a/force-app/main/default/pages/NewAndEditRepairSubOrder.page +++ b/force-app/main/default/pages/NewAndEditRepairSubOrder.page @@ -2,7 +2,7 @@ @description : @author : ChangeMeIn@UserSettingsUnder.SFDoc @group : - @last modified on : 03-17-2022 + @last modified on : 03-23-2022 @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc --> <apex:page standardController="RepairSubOrder__c" extensions="NewAndEditRepairSubOrderController" id="page"> @@ -168,11 +168,14 @@ } function IsFormTag(tag_name){ + if (!tag_name) { + return false; + } return ['input','select','textarea'].indexOf(tag_name.toLowerCase())>-1; } - function IsFormElement(tag_name){ - return ['input','select','textarea'].indexOf(tag_name)>-1; + function IsFormElement(e){ + return IsFormTag(e.tagName); } function getPIPayload(sobjJson) { @@ -225,11 +228,12 @@ let nodelist = document.getElementsByClassName(config.ApiPrefix); let result = {} - for (let index = 0; index < nodelist.length; index++) { - let ele = nodelist[index]; - let field_api_name = GetEleApiName(ele); + for (let index in api_id_map) { + let ele = document.getElementById(api_id_map[index]); + + let field_api_name = index; let tag_name = ele.tagName.toLowerCase(); - if(!IsFormElement(tag_name)){ + if(!IsFormTag(tag_name)){ console.log('tag_name='+tag_name+',field_api_name'+field_api_name+' is not a form element'); continue; } @@ -564,12 +568,16 @@ <script> var init_nodes = document.getElementsByClassName("PIBackApi"); var api_id_map={}; - for(let e in init_nodes){ - if(IsFormElement(e)){ - api_id_map[GetEleApiName(e)] = e.id; - } - } - console.log(api_id_map); + for(let ei in init_nodes){ + let e = init_nodes[ei]; + if(IsFormElement(e)){ + if(e.getAttribute("multiple") != 'multiple' || e.style.display == 'none' && e.id.indexOf('selected') < 0){ + api_id_map[GetEleApiName(e)] = e.id; + } + + } + } + console.log(api_id_map); sfdcPage.appendToOnloadQueue(function () { var layoutSections = JSON.parse('{!layoutSectionsStr}'); @@ -596,6 +604,7 @@ document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); jQuery('a[data-id="OwnerId"]').remove(); + /* jQuery(".lookupInput").each(function(i,e){ let je =jQuery(e).find('input'); je.attr("readonly",""); @@ -625,6 +634,24 @@ } } }); + */ + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + + let dataid = je.attr('data-id'); + if(['ContactId'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; + } + }) + }) }); </script> <div class="pbBottomButtons"> diff --git a/force-app/main/default/pages/NewAndEditReport.page b/force-app/main/default/pages/NewAndEditReport.page index fe838e7..5c4b6ed 100644 --- a/force-app/main/default/pages/NewAndEditReport.page +++ b/force-app/main/default/pages/NewAndEditReport.page @@ -357,6 +357,8 @@ //鑷畾涔塴ookup鏌ヨ function searchContact(contactNodeId,field){ closeField = field; + //searchContactKeyWord + let searchContactKeyWord = document.querySelector("[data-id="+field+"]").value let accountValue = ""; if (document.querySelector("[data-id='Hospital_Department__c']")) { let accountNodeId = document.querySelector("[data-id='Hospital_Department__c']").id + '_lkid'; @@ -365,7 +367,7 @@ console.log(accountValue); if(accountValue !='000000000000000'){ let baseUrl = "/apex/SearchContactPage"; - let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; + let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); if (window.focus) { @@ -373,7 +375,7 @@ } return false; }else{ - alertErrorMessage('{!PIPL_Input_Account_Error_Msg}'); + alertErrorMessage('璇峰厛閫夋嫨绉戝锛�'); } } //绐楀彛鍏抽棴鏃跺彂鐢� @@ -578,35 +580,62 @@ replaceSearchContactLookup(); //3. Set Readonly Attribute document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); - jQuery(".lookupInput").each(function (i, e) { - let je = jQuery(e).find('input'); - je.attr("readonly", ""); - je.css("background", "unset"); + + //濡傛灉鏄疧PD璁″垝杩囨潵鐨� + if('{!no1Name}' != '' && '{!no1Id}' != ''){ + console.log('name = '+'{!no1Name}') + console.log('Id = '+'{!no1Id}') + document.querySelector("[data-id='Loaner_request_no1__c']").value = '{!no1Name}' + document.getElementById(document.querySelector("[data-id='Loaner_request_no1__c']").id + '_lkid').value = '{!no1Id}' + } + + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); let dataid = je.attr('data-id'); - if (['Practitioner1__c','Practitioner2__c','Practitioner3__c','Practitioner4__c','Practitioner5__c','Person_In_Charge__c'].indexOf(dataid) > -1) - jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="' + dataid + '" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); + if(['Practitioner1__c','Practitioner2__c','Practitioner3__c','Practitioner4__c','Practitioner5__c','Person_In_Charge__c'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; + } + }) }) - jQuery(".lookupInput").on("mouseenter", "img[generate]", function (e) { - this.className = "closeIconOn"; - }); + // jQuery(".lookupInput").each(function (i, e) { + // let je = jQuery(e).find('input'); + // je.attr("readonly", ""); + // je.css("background", "unset"); - jQuery(".lookupInput").on("mouseleave", "img[generate]", function (e) { - this.className = "closeIcon" - }); + // let dataid = je.attr('data-id'); + // if (['Practitioner1__c','Practitioner2__c','Practitioner3__c','Practitioner4__c','Practitioner5__c','Person_In_Charge__c'].indexOf(dataid) > -1) + // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="' + dataid + '" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); + // }) - jQuery(".lookupInput").on("click", "img[generate]", function (e) { - let id = jQuery("input[data-id='" + jQuery(this).attr("data-id") + "']").attr("id"); - let input = document.getElementById(id); - if (input) { - input.value = ''; - let hidden = document.getElementById(id + '_lkid'); - if (hidden) { - hidden.value = ''; - } - } - }); + // jQuery(".lookupInput").on("mouseenter", "img[generate]", function (e) { + // this.className = "closeIconOn"; + // }); + + // jQuery(".lookupInput").on("mouseleave", "img[generate]", function (e) { + // this.className = "closeIcon" + // }); + + // jQuery(".lookupInput").on("click", "img[generate]", function (e) { + // let id = jQuery("input[data-id='" + jQuery(this).attr("data-id") + "']").attr("id"); + // let input = document.getElementById(id); + // if (input) { + // input.value = ''; + // let hidden = document.getElementById(id + '_lkid'); + // if (hidden) { + // hidden.value = ''; + // } + // } + // }); }); </script> <div class="pbBottomButtons"> diff --git a/force-app/main/default/pages/NewAndEditTenderinformation.page b/force-app/main/default/pages/NewAndEditTenderinformation.page index c9eb77c..3057c73 100644 --- a/force-app/main/default/pages/NewAndEditTenderinformation.page +++ b/force-app/main/default/pages/NewAndEditTenderinformation.page @@ -420,7 +420,7 @@ //2. Query AWS Data by dataId console.log('Mode for Sobject Page:' + {!isNewMode}); if (!{!isNewMode}) { - bolckme(); + blockme(); QuerySobjectFromAWS(); }else{ let ot = jQuery('input[data-id="OwnerId"]'); @@ -435,37 +435,59 @@ oi.value = '{!CurrentUserId}' } } + //Replace Contact Vlookup Field + replaceSearchContactLookup(); + //Replace Lead Vlookup Field + replaceSearchLeadLookup(); + document.querySelectorAll("[data-id='OwnerId']")[0].classList.add("disabledbutton"); + // document.querySelectorAll("[data-id='OwnerId']")[1].classList.add("disabledbutton"); - jQuery(".lookupInput").each(function(i,e){ - let je =jQuery(e).find('input'); - je.attr("readonly",""); - je.css("background","unset"); - + jQuery('a[data-id="OwnerId"]').remove(); + + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + let dataid = je.attr('data-id'); - if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; - jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); - }) - - jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ - this.className = "closeIconOn"; - }); - - jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ - this.className = "closeIcon" - }); - - jQuery(".lookupInput").on("click","img[generate]",function(e){ - let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); - let input = document.getElementById(id); - if(input){ - input.value = ''; - let hidden = document.getElementById(id+'_lkid'); - if(hidden){ - hidden.value = ''; + if(['Hospital__c'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; } - } - }); + }) + }) + + // jQuery(".lookupInput").on("click","img.closeIconOn",function(){ + // if (jQuery(this).siblings("input").attr("data-id") == 'Hospital_Name__c'){ + // clearVlookup('Department_Class__c'); + // clearVlookup('Hospital__c'); + // } + // }); + + jQuery("body").on("change","input[data-id='Hospital_Name__c']",function(){ + setTimeout(() => { + console.log(document.getElementById(this.id+'_lkid').value); + var hospitalNameValue = document.getElementById(this.id+'_lkid').value; + if (hospitalNameValue != "000000000000000" && hospitalNameValue != '') { + console.log("hospitalNameValue = " + hospitalNameValue); + + var ls = ['Department_Class__c','Hospital__c']; + setVlookup(ls,hospitalNameValue); + }else{ + clearVlookup('Department_Class__c'); + clearVlookup('Hospital__c'); + } + }, 50); + }); }); + + + </script> <div class="pbBottomButtons"> <table cellspacing="0" cellpadding="0" border="0"> diff --git a/force-app/main/default/pages/NewConsumApply.page b/force-app/main/default/pages/NewConsumApply.page index 5f78415..bb0d374 100644 --- a/force-app/main/default/pages/NewConsumApply.page +++ b/force-app/main/default/pages/NewConsumApply.page @@ -2,7 +2,7 @@ @description : @author : ChangeMeIn@UserSettingsUnder.SFDoc @group : - @last modified on : 03-18-2022 + @last modified on : 03-23-2022 @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc --> <apex:page standardController="Consum_Apply__c" extensions="NewConsumApplyController" id="page"> @@ -126,7 +126,7 @@ //瀵屾枃鏈� if(document.querySelector("[aria-describedby = 'cke_34']")){ result.HP_received_sign_rich__c = document.querySelector("[aria-describedby = 'cke_34']").contentWindow.document.getElementsByTagName('body')[0].innerHTML - } + } for (let index = 0; index < nodelist.length; index++) { if (VLookUpFields.has(nodelist[index].getAttribute("data-id"))) { console.log(nodelist[index].id.indexOf('lkwgt')); @@ -153,11 +153,20 @@ } } for (let i = 0; i < userVLookUpFields.length; i++) { - let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; - console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); - if(userVlookUpNodeValue!='000000000000000'){ - result[userVLookUpFields[i]] = userVlookUpNodeValue; - } + if(document.querySelector("[data-id='" + userVLookUpFields[i] + "']")!=null){ + let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; + console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); + if(userVlookUpNodeValue!='000000000000000'){ + result[userVLookUpFields[i]] = userVlookUpNodeValue; + } + } + } + //鏍煎紡鍖栨椂闂� + if(result.pickup_time__c){ + result.pickup_time__c = result.pickup_time__c.replace(/\//g, '-')+':00'; + } + if(result.HP_received_sign_rich__c == '<br>'){ + result.HP_received_sign_rich__c = ''; } console.log(JSON.stringify(result)); return result; @@ -231,7 +240,7 @@ //Alert Error Message function alertErrorMessage(errorMsg) { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsg = '閿欒锛氭棤鏁堟暟鎹��' + '\n' + errorMsg; errorMsgNode.innerText = errorMsg; errorMsgNode.className = 'pbError'; @@ -240,7 +249,7 @@ //Hide Error Message function hiddenErrorMsgNode() { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsgNode.innerText = ''; errorMsgNode.className = ''; } @@ -264,33 +273,21 @@ return template.content.firstChild; } function queryContactName() { - // let sfId = document.getElementById(document.querySelector("[data-id='Account__c']").id + '_lkid').value; - // let contactsInfo = JSON.parse('{!contactsInfo}'); - // let dataId = contactsInfo[sfId]; - // let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; - // fetch(url, { - // method: 'GET', - // headers: { - // 'Content-Type': 'application/json', - // 'pi-token': staticResources.token - // } - // }).then((data) => { - // return data.json(); - // }).then((result) => { - // document.querySelector("[data-id='Loaner_medical_Staff__c']").value = result.object.lastName; - // }) let sfId = document.getElementById(document.querySelector("[data-id='Account__c']").id + '_lkid').value; - let dataId = ''; - if ('{!contactsInfo}' != '') { - let contactsInfo = JSON.parse('{!contactsInfo}'); - dataId = contactsInfo[sfId]; - } else if ('{!AWSDataId}' != '') { - dataId = '{!AWSDataId}'; - } - let queryBackContactName = function queryBackContactName(result){ + let contactsInfo = JSON.parse('{!contactsInfo}'); + let dataId = contactsInfo[sfId]; + let url = staticResourcesContact.queryUrl + '?dataId=' + dataId; + fetch(url, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + 'pi-token': staticResources.token + } + }).then((data) => { + return data.json(); + }).then((result) => { document.querySelector("[data-id='Loaner_medical_Staff__c']").value = result.object.lastName; - }; - AWSService.query(staticResourcesContact.queryUrl, dataId, queryBackContactName, staticResourcesContact.token); + }) } //鑷畾涔塴ookup鏌ヨ function searchContact(contactNodeId){ @@ -299,10 +296,11 @@ let accountNodeId = document.querySelector("[data-id='Account__c']").id + '_lkid'; accountValue = document.getElementById(accountNodeId).value; } + let searchContactKeyWord = document.querySelector("[data-id='Loaner_medical_Staff__c']").value; console.log(accountValue); if(accountValue !='000000000000000'){ let baseUrl = "/apex/SearchContactPage"; - let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; + let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); if (window.focus) { @@ -348,11 +346,7 @@ </div> <apex:form id="form"> <apex:inputHidden value="{!contactId}" id="contactId"/> - <!-- Error Msg--> - <apex:outputPanel id="errorMsg"> - <apex:pageMessages id="msgContent" escape="false" /> - </apex:outputPanel> - <apex:pageblock > + <apex:pageblock id="block"> <div class="pbHeader"> <table cellspacing="0" cellpadding="0" border="0"> <tbody> @@ -369,6 +363,12 @@ </tr> </tbody> </table> + </div> + <!-- Error Msg--> + <div style="text-align: center;"> + <apex:outputPanel id="errorMsg"> + <apex:pageMessages id="msgContent" escape="false" /> + </apex:outputPanel> </div> <!-- Iterate the layoutSections, which is a list of sections --> <apex:repeat value="{!layoutSections}" var="layoutSection"> @@ -407,36 +407,54 @@ replaceSearchContactLookup(); document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); - jQuery(".lookupInput").each(function(i,e){ - let je =jQuery(e).find('input'); - je.attr("readonly",""); - je.css("background","unset"); - + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + let dataid = je.attr('data-id'); - if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; - jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); - }) - - jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ - this.className = "closeIconOn"; - }); - - jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ - this.className = "closeIcon" - }); - - jQuery(".lookupInput").on("click","img[generate]",function(e){ - let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); - let input = document.getElementById(id); - if(input){ - input.value = ''; - let hidden = document.getElementById(id+'_lkid'); - if(hidden){ - hidden.value = ''; + if(['Loaner_medical_Staff__c'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; } - } + }) }); + // jQuery(".lookupInput").each(function(i,e){ + // let je =jQuery(e).find('input'); + // je.attr("readonly",""); + // je.css("background","unset"); + + // let dataid = je.attr('data-id'); + // if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; + // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); + // }) + + // jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ + // this.className = "closeIconOn"; + // }); + + // jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ + // this.className = "closeIcon" + // }); + + // jQuery(".lookupInput").on("click","img[generate]",function(e){ + // let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); + // let input = document.getElementById(id); + // if(input){ + // input.value = ''; + // let hidden = document.getElementById(id+'_lkid'); + // if(hidden){ + // hidden.value = ''; + // } + // } + // }); + }); </script> <div class="pbBottomButtons"> diff --git a/force-app/main/default/pages/NewOnCall.page b/force-app/main/default/pages/NewOnCall.page index 2af6cb8..98ab01f 100644 --- a/force-app/main/default/pages/NewOnCall.page +++ b/force-app/main/default/pages/NewOnCall.page @@ -2,7 +2,7 @@ @description : @author : ChangeMeIn@UserSettingsUnder.SFDoc @group : - @last modified on : 03-17-2022 + @last modified on : 03-23-2022 @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc --> <apex:page standardController="On_Call__c" extensions="OnCallController" id="page"> @@ -201,7 +201,7 @@ //Alert Error Message function alertErrorMessage(errorMsg) { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsg = '閿欒锛氭棤鏁堟暟鎹��' + '\n' + errorMsg; errorMsgNode.innerText = errorMsg; errorMsgNode.className = 'pbError'; @@ -210,7 +210,7 @@ //Hide Error Message function hiddenErrorMsgNode() { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsgNode.innerText = ''; errorMsgNode.className = ''; } @@ -236,11 +236,7 @@ <div class="ptBreadcrumb"></div> </div> <apex:form id="form"> - <!-- Error Msg--> - <apex:outputPanel id="errorMsg"> - <apex:pageMessages id="msgContent" escape="false" /> - </apex:outputPanel> - <apex:pageblock > + <apex:pageblock id="block" > <div class="pbHeader"> <table cellspacing="0" cellpadding="0" border="0"> <tbody> @@ -258,6 +254,12 @@ </tbody> </table> </div> + <!-- Error Msg--> + <div style="text-align: center;"> + <apex:outputPanel id="errorMsg"> + <apex:pageMessages id="msgContent" escape="false" /> + </apex:outputPanel> + </div> <!-- Iterate the layoutSections, which is a list of sections --> <apex:repeat value="{!layoutSections}" var="layoutSection"> <apex:pageBlockSection title="{!layoutSection.name}" collapsible="{!layoutSection.allowCollapse}" columns="{!layoutSection.columns}"> diff --git a/force-app/main/default/pages/NewRentalApply.page b/force-app/main/default/pages/NewRentalApply.page index 8b2c50f..8d3ce75 100644 --- a/force-app/main/default/pages/NewRentalApply.page +++ b/force-app/main/default/pages/NewRentalApply.page @@ -2,7 +2,7 @@ @description : @author : ChangeMeIn@UserSettingsUnder.SFDoc @group : - @last modified on : 03-18-2022 + @last modified on : 03-23-2022 @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc --> <apex:page standardController="Rental_Apply__c" extensions="RentalApplyController" id="page"> @@ -135,18 +135,23 @@ } } for (let i = 0; i < userVLookUpFields.length; i++) { - let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; - console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); - if(userVlookUpNodeValue!='000000000000000'){ - result[userVLookUpFields[i]] = userVlookUpNodeValue; - } + if(document.querySelector("[data-id='" + userVLookUpFields[i] + "']")!=null){ + let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; + console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); + if(userVlookUpNodeValue!='000000000000000'){ + result[userVLookUpFields[i]] = userVlookUpNodeValue; + } + } } //page:form:j_id30:j_id34:2:j_id35:j_id36:2:j_id37 //page:form:j_id27:j_id31:2:j_id32:j_id33:2:j_id34 - result.demo_purpose2__c = document.querySelector("[id='page:form:j_id30:j_id34:2:j_id35:j_id36:2:j_id37']").value; - result.ToAgency__c = document.querySelector("[id='page:form:j_id30:j_id34:0:j_id35:j_id36:14:j_id37']").value; - result.Loaner_cancel_reason__c = document.querySelector("[id='page:form:j_id30:j_id34:0:j_id35:j_id36:14:j_id37']").value; + result.demo_purpose2__c = document.querySelector("[id='page:form:block:j_id34:2:j_id35:j_id36:2:j_id37']").value; + result.ToAgency__c = document.querySelector("[id='page:form:block:j_id34:0:j_id35:j_id36:14:j_id37']").value; + result.Loaner_cancel_reason__c = document.querySelector("[id='page:form:block:j_id34:12:j_id35:j_id36:1:j_id37']").value; console.log(JSON.stringify(result)); + if(result.HP_received_sign_rich__c == '<br>'){ + result.HP_received_sign_rich__c = ''; + } return result; } @@ -218,7 +223,7 @@ //Alert Error Message function alertErrorMessage(errorMsg) { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsg = '閿欒锛氭棤鏁堟暟鎹��' + '\n' + errorMsg; errorMsgNode.innerText = errorMsg; errorMsgNode.className = 'pbError'; @@ -227,7 +232,7 @@ //Hide Error Message function hiddenErrorMsgNode() { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsgNode.innerText = ''; errorMsgNode.className = ''; } @@ -273,10 +278,11 @@ let accountNodeId = document.querySelector("[data-id='Account__c']").id + '_lkid'; accountValue = document.getElementById(accountNodeId).value; } + let searchContactKeyWord = document.querySelector("[data-id='Loaner_medical_Staff__c']").value; console.log(accountValue); if(accountValue !='000000000000000'){ let baseUrl = "/apex/SearchContactPage"; - let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; + let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); if (window.focus) { @@ -322,11 +328,7 @@ </div> <apex:form id="form"> <apex:inputHidden value="{!contactId}" id="contactId"/> - <!-- Error Msg--> - <apex:outputPanel id="errorMsg"> - <apex:pageMessages id="msgContent" escape="false" /> - </apex:outputPanel> - <apex:pageblock > + <apex:pageblock id="block"> <div class="pbHeader"> <table cellspacing="0" cellpadding="0" border="0"> <tbody> @@ -344,13 +346,19 @@ </tbody> </table> </div> + <!-- Error Msg--> + <div style="text-align: center;"> + <apex:outputPanel id="errorMsg"> + <apex:pageMessages id="msgContent" escape="false" /> + </apex:outputPanel> + </div> <!-- Iterate the layoutSections, which is a list of sections --> <apex:repeat value="{!layoutSections}" var="layoutSection"> <apex:pageBlockSection title="{!layoutSection.name}" collapsible="{!layoutSection.allowCollapse}" columns="{!layoutSection.columns}"> <!--Each section has layoutFields, let's iterate them as well--> <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField"> - <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Rental_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Rental_Apply__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" required="{!layoutField.isRequired}" /> <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> </apex:pageblocksectionitem> @@ -381,36 +389,54 @@ replaceSearchContactLookup(); document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); - jQuery(".lookupInput").each(function(i,e){ - let je =jQuery(e).find('input'); - je.attr("readonly",""); - je.css("background","unset"); - + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + let dataid = je.attr('data-id'); - if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; - jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); - }) - - jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ - this.className = "closeIconOn"; - }); - - jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ - this.className = "closeIcon" - }); - - jQuery(".lookupInput").on("click","img[generate]",function(e){ - let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); - let input = document.getElementById(id); - if(input){ - input.value = ''; - let hidden = document.getElementById(id+'_lkid'); - if(hidden){ - hidden.value = ''; + if(['Loaner_medical_Staff__c'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; } - } + }) }); + // jQuery(".lookupInput").each(function(i,e){ + // let je =jQuery(e).find('input'); + // je.attr("readonly",""); + // je.css("background","unset"); + + // let dataid = je.attr('data-id'); + // if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; + // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); + // }) + + // jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ + // this.className = "closeIconOn"; + // }); + + // jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ + // this.className = "closeIcon" + // }); + + // jQuery(".lookupInput").on("click","img[generate]",function(e){ + // let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); + // let input = document.getElementById(id); + // if(input){ + // input.value = ''; + // let hidden = document.getElementById(id+'_lkid'); + // if(hidden){ + // hidden.value = ''; + // } + // } + // }); + }); </script> <div class="pbBottomButtons"> diff --git a/force-app/main/default/pages/NewRepair.page b/force-app/main/default/pages/NewRepair.page index e2f6490..bc80e27 100644 --- a/force-app/main/default/pages/NewRepair.page +++ b/force-app/main/default/pages/NewRepair.page @@ -2,7 +2,7 @@ @description : @author : ChangeMeIn@UserSettingsUnder.SFDoc @group : - @last modified on : 03-19-2022 + @last modified on : 03-23-2022 @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc --> <apex:page standardController="Repair__c" extensions="NewRepairController" id="page"> @@ -131,8 +131,10 @@ console.log(nodelist[index].id.indexOf('lkwgt')); if (nodelist[index].id.indexOf('lkwgt') == -1) { let vlookUpNodeId = nodelist[index].id + '_lkid'; - let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value; - result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue; + if(document.getElementById(vlookUpNodeId)!=null){ + let vlookUpNodeValue = document.getElementById(vlookUpNodeId).value; + result[nodelist[index].getAttribute("data-id")] = vlookUpNodeValue; + } } } else if (nodelist[index].type == 'checkbox') { result[nodelist[index].getAttribute("data-id")] = nodelist[index].checked; @@ -152,14 +154,22 @@ } } for (let i = 0; i < userVLookUpFields.length; i++) { - let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; - console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); - if(userVlookUpNodeValue!='000000000000000'){ - result[userVLookUpFields[i]] = userVlookUpNodeValue; + if(document.querySelector("[data-id='" + userVLookUpFields[i] + "']")!=null){ + // let userVlookUpNodeValue = document.querySelector("[data-id='" + userVLookUpFields[i] + "']").children[1].value; + let userVlookUpNodeValue = jQuery('[data-id="Incharge_Staff__c"] .lookupInput input').val() + console.log('userVlookUpNodeValue:'+userVlookUpNodeValue); + if(userVlookUpNodeValue!='000000000000000'){ + result[userVLookUpFields[i]] = userVlookUpNodeValue; + } } } - result.work_location_select__c = document.querySelector("[id='page:form:j_id30:j_id34:1:j_id35:j_id36:18:j_id37']").value; + result.work_location_select__c = document.querySelector("[id='page:form:block:j_id34:1:j_id35:j_id36:18:j_id37']").value; // result.ProblemDescription__c = document.querySelector("[aria-describedby = 'cke_34']").contentWindow.document.getElementsByTagName('body')[0].innerHTML + /* + if(result.engineerSendDate__c){ + result.engineerSendDate__c = result.engineerSendDate__c.replace(/\//g, '-')+':00'; + } + */ console.log(JSON.stringify(result)); return result; } @@ -253,7 +263,7 @@ //Alert Error Message function alertErrorMessage(errorMsg) { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsg = '閿欒锛氭棤鏁堟暟鎹��' + '\n' + errorMsg; errorMsgNode.innerText = errorMsg; errorMsgNode.className = 'pbError'; @@ -262,7 +272,7 @@ //Hide Error Message function hiddenErrorMsgNode() { - let errorMsgNode = document.getElementById("page:form:msgContent"); + let errorMsgNode = document.getElementById("page:form:block:msgContent"); errorMsgNode.innerText = ''; errorMsgNode.className = ''; } @@ -288,11 +298,7 @@ <div class="ptBreadcrumb"></div> </div> <apex:form id="form"> - <!-- Error Msg--> - <apex:outputPanel id="errorMsg"> - <apex:pageMessages id="msgContent" escape="false" /> - </apex:outputPanel> - <apex:pageblock > + <apex:pageblock id="block"> <div class="pbHeader"> <table cellspacing="0" cellpadding="0" border="0"> <tbody> @@ -310,13 +316,19 @@ </tbody> </table> </div> + <!-- Error Msg--> + <div style="text-align: center;"> + <apex:outputPanel id="errorMsg"> + <apex:pageMessages id="msgContent" escape="false" /> + </apex:outputPanel> + </div> <!-- Iterate the layoutSections, which is a list of sections --> <apex:repeat value="{!layoutSections}" var="layoutSection"> <apex:pageBlockSection title="{!layoutSection.name}" collapsible="{!layoutSection.allowCollapse}" columns="{!layoutSection.columns}"> <!--Each section has layoutFields, let's iterate them as well--> <apex:repeat value="{!layoutSection.layoutFields}" var="layoutField"> - <apex:inputField html-data-id="{!layoutField.fieldAPI}" value="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" + <apex:inputField styleClass="PIBackApi PIBackApi_{!layoutField.fieldAPI}" html-data-id="{!layoutField.fieldAPI}" value="{!Repair__c[layoutField.fieldAPI]}" rendered="{!not(layoutField.isPlaceHOlder)}" required="{!layoutField.isRequired}" /> <apex:pageblocksectionitem rendered="{!layoutField.isPlaceHolder}"> </apex:pageblocksectionitem> @@ -345,35 +357,53 @@ }; document.querySelector("[data-id='OwnerId']").classList.add("disabledbutton"); - jQuery(".lookupInput").each(function(i,e){ - let je =jQuery(e).find('input'); - je.attr("readonly",""); - je.css("background","unset"); - + let previous_value = {}; + jQuery(".lookupInput input").each(function(i,e){ + let je =jQuery(e); + let dataid = je.attr('data-id'); - if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; - jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); - }) - - jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ - this.className = "closeIconOn"; - }); - - jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ - this.className = "closeIcon" - }); - - jQuery(".lookupInput").on("click","img[generate]",function(e){ - let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); - let input = document.getElementById(id); - if(input){ - input.value = ''; - let hidden = document.getElementById(id+'_lkid'); - if(hidden){ - hidden.value = ''; + if(['Incharge_Staff_Contact__c'].indexOf(dataid) < 0) return; + + jQuery(e).focus(function(){ + previous_value[this.id] = this.value; + }) + + jQuery(e).change(function(){ + if (previous_value[this.id] != jQuery(this).val()) { + document.getElementById(this.id+'_lkid').value = ''; } - } - }); + }) + }) + + // jQuery(".lookupInput").each(function(i,e){ + // let je =jQuery(e).find('input'); + // je.attr("readonly",""); + // je.css("background","unset"); + + // let dataid = je.attr('data-id'); + // if(['Hospital_Name__c','Department_Class__c','OwnerId'].indexOf(dataid) > -1) return; + // jQuery(e).children(":last-child").before('<img class="closeIcon" data-id="'+dataid+'" generate="" alt="Clear" src="/s.gif" style="display: inline-block;">'); + // }) + + // jQuery(".lookupInput").on("mouseenter","img[generate]",function(e){ + // this.className = "closeIconOn"; + // }); + + // jQuery(".lookupInput").on("mouseleave","img[generate]",function(e){ + // this.className = "closeIcon" + // }); + + // jQuery(".lookupInput").on("click","img[generate]",function(e){ + // let id = jQuery("input[data-id='"+jQuery(this).attr("data-id")+ "']").attr("id"); + // let input = document.getElementById(id); + // if(input){ + // input.value = ''; + // let hidden = document.getElementById(id+'_lkid'); + // if(hidden){ + // hidden.value = ''; + // } + // } + // }); }); </script> <div class="pbBottomButtons"> diff --git a/force-app/main/default/pages/SearchContactPage.page b/force-app/main/default/pages/SearchContactPage.page index b09aeb7..782df44 100644 --- a/force-app/main/default/pages/SearchContactPage.page +++ b/force-app/main/default/pages/SearchContactPage.page @@ -20,10 +20,10 @@ var staticResources = JSON.parse('{!staticResource}'); var contactAWSIds = JSON.parse('{!contactAWSIds}'); var contactsInfo = JSON.parse('{!contactsInfo}'); - var searchContactName = ''; + var searchKeyWord = '{!searchKeyWord}'; + var searchContactName = searchKeyWord; queryLeadFromAWS(); function searchAWSContact(){ - console.log('Search process!'); //1. reset table; resetTable(); //2. get contact name value @@ -47,7 +47,6 @@ function queryLeadFromAWS() { //1. Prepare the payload for contact search let requestSearchPayload = preparePayloadForSearchContact(); - console.log('request payload body:'+requestSearchPayload); //2. Invoke AWS Service // fetch(staticResources.searchUrl, { // method: 'POST', @@ -64,9 +63,10 @@ // } // }) let queryBackContactName = function queryBackContactName(result){ - if(result.object&&result.object.length>0){ - initContactTable(result); - } + // if(result.object){ + // initContactTable(result); + // } + initContactTable(result); }; AWSService.search(staticResources.searchUrl,requestSearchPayload,queryBackContactName,staticResources.token) } @@ -101,11 +101,12 @@ let tableBody = document.createElement('TBODY'); table.appendChild(tableBody); let headerTR = document.createElement('TR'); + let colsHeader = ['濮撳悕','瀹㈡埛鍚嶇О','閭', '鐢佃瘽']; tableBody.appendChild(headerTR); - for (let i = 0; i < cols.length; i++) { + for (let i = 0; i < colsHeader.length; i++) { let td = document.createElement('TH'); td.width = '75'; - td.appendChild(document.createTextNode(cols[i])); + td.appendChild(document.createTextNode(colsHeader[i])); headerTR.appendChild(td); } //3. Init the AWS data @@ -116,13 +117,17 @@ for (let j = 0; j < cols.length; j++) { let td = document.createElement('TD'); td.width = '75'; - if (!contactsInfo.hasOwnProperty(contactInfoTemp.AWSDataId)) { - continue; - } - if(j == 0){ - td.id = contactsInfo[contactInfoTemp.AWSDataId].Id; - } - td.appendChild(document.createTextNode(contactInfoTemp[cols[j]])); + if(contactInfoTemp.pi){ + if (!contactsInfo.hasOwnProperty(contactInfoTemp.AWSDataId)) { + continue; + } + if(j == 0 && contactsInfo[contactInfoTemp.AWSDataId] ){ + td.id = contactsInfo[contactInfoTemp.AWSDataId].Id; + } + }else{ + td.id = contactInfoTemp.sfRecordId; + } + td.appendChild(document.createTextNode(contactInfoTemp[cols[j]]!=null?contactInfoTemp[cols[j]]:'')); if (cols[j] == 'Name') { td.addEventListener("click", function (obj) { redirectToParentPage(obj); @@ -134,31 +139,59 @@ myTableDiv.appendChild(table); } function initContactTable(data) { - let cols = ['Name', 'Email', 'Phone']; + let cols = ['Name','AccountName', 'Email', 'Phone']; let contactInfoList = []; let awsDataIds = []; - for(var i=0;i<data.object.length;i++){ - if(data.object[i].dataId){ - let contactInfo = new Object(); - contactInfo.Name = data.object[i].lastName; - contactInfo.Email = data.object[i].email; - contactInfo.Phone = data.object[i].phone; - contactInfo.AWSDataId = data.object[i].dataId; - awsDataIds.push(contactInfo.AWSDataId); - contactInfo.sfRecordId = ''; - contactInfoList.push(contactInfo); - } + if(data.object){ + for(var i=0;i<data.object.length;i++){ + if(data.object[i].dataId){ + let contactInfo = new Object(); + contactInfo.Name = data.object[i].lastName; + contactInfo.Email = data.object[i].email; + contactInfo.Phone = data.object[i].phone; + contactInfo.AWSDataId = data.object[i].dataId; + contactInfo.pi = true; + awsDataIds.push(contactInfo.AWSDataId); + contactInfo.sfRecordId = ''; + contactInfoList.push(contactInfo); + } + } } let AWSIdToSFIdMapValue = {}; - console.log(awsDataIds); //Invoke SF BackEnd Visualforce.remoting.Manager.invokeAction( '{!$RemoteAction.SearchContactController.searchContacts}', - JSON.stringify(awsDataIds), + JSON.stringify(awsDataIds),searchContactName,'{!aId}', function (result, event) { if(event.status){ if(result.status = 'success'){ - contactsInfo = JSON.parse(result.message.replace(/("\;)/g,"\"")); + if(result.message){ + contactsInfo = JSON.parse(result.message.replace(/("\;)/g,"\"")); + if(Object.keys(contactsInfo).length>0){ + for(let i=0;i<contactInfoList.length;i++){ + let contactFromSF = contactsInfo[contactInfoList[i]['AWSDataId']]; + if(contactFromSF){ + contactInfoList[i].sfRecordId = contactFromSF['Id']; + contactInfoList[i].AccountName = contactFromSF['Account']['Name']; + } + } + } + } + //1. get SF 闈炴晱鎰熺殑鑱旂郴浜轰俊鎭� + if(result.noPIContactList){ + var noPIInfo = JSON.parse(result.noPIContactList.replace(/("\;)/g,"\"")); + for(let f in noPIInfo){ + let contactInfo = new Object(); + contactInfo.Name = noPIInfo[f].Name!=null?noPIInfo[f].Name:''; + contactInfo.Email = noPIInfo[f].Email!=null?noPIInfo[f].Email:''; + contactInfo.Phone = noPIInfo[f].Phone!=null?noPIInfo[f].Phone:''; + contactInfo.AWSDataId = ''; + contactInfo.sfRecordId = noPIInfo[f].Id!=null?noPIInfo[f].Id:''; + contactInfo.AccountName = noPIInfo[f]['Account']['Name']; + contactInfo.pi = false; + contactInfoList.push(contactInfo); + } + } refreshTable(cols,contactInfoList); }else{ console.log('No result'); diff --git a/force-app/main/default/pages/SearchLeadPage.page b/force-app/main/default/pages/SearchLeadPage.page index e90b950..63a9026 100644 --- a/force-app/main/default/pages/SearchLeadPage.page +++ b/force-app/main/default/pages/SearchLeadPage.page @@ -20,7 +20,11 @@ var staticResources = JSON.parse('{!staticResource}'); var leadAWSIds = JSON.parse('{!leadAWSIds}'); var leadsInfo = JSON.parse('{!leadsInfo}'); - var searchContactName = ''; + var searchKeyWord = '{!searchKeyWord}'; + var searchContactName = searchKeyWord; + if(searchContactName){ + document.getElementById('page:form:lksrch').value = searchContactName; + } queryLeadFromAWS(); function searchAWSContact(){ console.log('Search process!'); diff --git a/force-app/main/default/pages/StraightBackAddress.page b/force-app/main/default/pages/StraightBackAddress.page index b7b6bd1..f82c284 100644 --- a/force-app/main/default/pages/StraightBackAddress.page +++ b/force-app/main/default/pages/StraightBackAddress.page @@ -502,6 +502,7 @@ //鑷畾涔塴ookup鏌ヨ function searchContact(contactNodeId,field){ closeField = field; + let searchContactKeyWord = document.getElementById(field).value let accountValue = ""; if (document.getElementById('allPage:allForm:oppBlock2:UpdAddressId:Customer__r_Name')!=null) { let accountNodeId = document.getElementById('allPage:allForm:oppBlock2:UpdAddressId:Customer__r_Name').id + '_lkid'; @@ -510,7 +511,7 @@ console.log(accountValue); if(accountValue !='000000000000000'){ let baseUrl = "/apex/SearchContactPage"; - let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue; + let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue+"&searchContactKeyWord=" + searchContactKeyWord; let newSearchContactParam = 'height=600,width=800,left=100,top=100,dialogHide=true,resizable=no,scrollbars=yes,toolbar=no,status=no'; newSearchContactWindow = window.open(baseUrl+suffixUrl, 'Popup', newSearchContactParam); if (window.focus) { @@ -518,7 +519,7 @@ } return false; }else{ - console.log('璇峰厛閫夋嫨瀹㈡埛鍐嶉�夋嫨鑱旂郴浜�') + alert('璇峰厛閫夋嫨瀹㈡埛鍐嶉�夋嫨鑱旂郴浜�') } } @@ -699,7 +700,8 @@ <!-- Before PIPL 20220308 --> <!-- <apex:inputfield value="{!insUpdData.Contacts__c}" id="Contacts__c" required="false"/> --> <!-- Add By Li Jun for PIPL 20220308 Start --> - <apex:inputText label="鑱旂郴浜�" disabled="true" value="{!contactNameValue}" id="Contacts__c"> + <!-- <apex:inputText label="鑱旂郴浜�" disabled="true" value="{!contactNameValue}" id="Contacts__c">--> + <apex:inputText label="鑱旂郴浜�" value="{!contactNameValue}" id="Contacts__c"> </apex:inputText> <apex:inputHidden id="contactIdValue" value="{!contactIdValue}"/> <!-- Add By Li Jun for PIPL 20220308 End --> diff --git a/force-app/main/default/pages/UploadPdf.page b/force-app/main/default/pages/UploadPdf.page index 0d2702d..6759466 100644 --- a/force-app/main/default/pages/UploadPdf.page +++ b/force-app/main/default/pages/UploadPdf.page @@ -23,7 +23,6 @@ var fileObject = document.getElementById("page:theForm:block:uploadSection:file"); var reader = new FileReader(); var data = reader.readAsDataURL(fileObject.files[0]); - debugger console.log(event); } function getBase64(file) { @@ -79,7 +78,10 @@ "sfRecordId":"", "isSuccess":isSuccess }), function(result){ - window.location.reload(); + console.log("confirmTrans-" + JSON.stringify(data)); + document.getElementById("file").files[0].name = ''; + enableButtonStatus(); + refreshFiles(); }, staticResources.token); } @@ -89,7 +91,7 @@ } } function uploadFileToAWS(data, size, fileName) { - debugger + console.log("body=" + JSON.stringify({ 'file': data, "size": size, 'fileName': fileName })); AWSService.post(uploadUrl, JSON.stringify({ 'file': data, @@ -118,11 +120,11 @@ confirmTrans(result.txId, 1); } - // window.location.reload(); + window.location.reload(); }, { escape: true } ); - debugger + console.log('key' + key); } else { alertErrorMessage('涓婁紶澶辫触璇风◢鍚庡啀璇曪紒'); @@ -196,7 +198,7 @@ } </style> <apex:form id="theForm"> - <apex:actionFunction name="refreshFiles" action="{!refreshFiles}" reRender="pdf,uploadSection"/> + <apex:actionFunction name="refreshFiles" action="{!refreshFiles}" reRender="pdf,theForm"/> <br/> <br/> <apex:pageBlock id="block"> diff --git a/force-app/main/default/pages/ViewAgencyContactDecryptInfo.page b/force-app/main/default/pages/ViewAgencyContactDecryptInfo.page index 9e9746b..1e39a35 100644 --- a/force-app/main/default/pages/ViewAgencyContactDecryptInfo.page +++ b/force-app/main/default/pages/ViewAgencyContactDecryptInfo.page @@ -1,5 +1,7 @@ <apex:page standardController="Agency_Contact__c" extensions="NewAndEditAgencyContactController" id="page"> + <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> + <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> diff --git a/force-app/main/default/pages/ViewContactDecryptInfo.page b/force-app/main/default/pages/ViewContactDecryptInfo.page index 56a269f..878cd1a 100644 --- a/force-app/main/default/pages/ViewContactDecryptInfo.page +++ b/force-app/main/default/pages/ViewContactDecryptInfo.page @@ -1,5 +1,7 @@ <apex:page standardController="Contact" extensions="NewAndEditContactController" id="page"> + <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> + <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <apex:form id="form"> <apex:pageblock id="pageBlock"> diff --git a/force-app/main/default/pages/ViewRepairEncrypt.page b/force-app/main/default/pages/ViewRepairEncrypt.page index 44abc94..8d192bd 100644 --- a/force-app/main/default/pages/ViewRepairEncrypt.page +++ b/force-app/main/default/pages/ViewRepairEncrypt.page @@ -2,12 +2,14 @@ @description : @author : ChangeMeIn@UserSettingsUnder.SFDoc @group : - @last modified on : 03-17-2022 + @last modified on : 03-23-2022 @last modified by : ChangeMeIn@UserSettingsUnder.SFDoc --> <apex:page standardController="Repair__c" extensions="NewRepairController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> + <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> + <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> diff --git a/force-app/main/default/pages/ViewReportDecryptInfo.page b/force-app/main/default/pages/ViewReportDecryptInfo.page index 1c21e0f..02b6176 100644 --- a/force-app/main/default/pages/ViewReportDecryptInfo.page +++ b/force-app/main/default/pages/ViewReportDecryptInfo.page @@ -15,21 +15,21 @@ AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); } var queryBack = function queryBack(data) { - document.querySelector("[data-id='VOC_Informer_Name__c']").innerHTML=data.object.vocInformerName!=null?data.object.vocInformerName.replace(/"/g,""):''; - document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id2:1:j_id3']").innerHTML=data.object.callerPhone!=null?data.object.callerPhone.replace(/"/g,""):''; - document.querySelector("[data-id='VOC_Informer_Contact__c']").innerHTML=data.object.vocInformerContact!=null?data.object.vocInformerContact.replace(/"/g,""):''; - document.querySelector("[data-id='Person_In_Charge_Text__c']").innerHTML=data.object.personInChargeText!=null?data.object.personInChargeText.replace(/"/g,""):''; - document.querySelector("[data-id='Professor_sigh_text__c']").innerHTML=data.object.professorSighText!=null?data.object.professorSighText.replace(/"/g,""):''; - document.querySelector("[data-id='Staff_Info_Manual_c__c']").innerHTML=data.object.staffInfoManual!=null?data.object.staffInfoManual.replace(/"/g,""):''; - document.querySelector("[data-id='Responsible_Person_HP_c__c']").innerHTML=data.object.responsiblePersonHP!=null?data.object.responsiblePersonHP.replace(/"/g,""):''; - document.querySelector("[data-id='Practitioner1_Part__c']").innerHTML=data.object.practitioner1Part!=null?data.object.practitioner1Part.replace(/"/g,""):''; - document.querySelector("[data-id='Practitioner2_Part__c']").innerHTML=data.object.practitioner2Part!=null?data.object.practitioner2Part.replace(/"/g,""):''; - document.querySelector("[data-id='Practitioner3_Part__c']").innerHTML=data.object.practitioner3Part!=null?data.object.practitioner3Part.replace(/"/g,""):''; - document.querySelector("[data-id='Practitioner4_Part__c']").innerHTML=data.object.practitioner4Part!=null?data.object.practitioner4Part.replace(/"/g,""):''; - document.querySelector("[data-id='Practitioner5_Part__c']").innerHTML=data.object.practitioner5Part!=null?data.object.practitioner5Part.replace(/"/g,""):''; - document.querySelector("[data-id='age__c']").innerHTML=data.object.age!=null?data.object.age.replace(/"/g,""):''; - document.querySelector("[data-id='Medical_History__c']").innerHTML=data.object.medicalHistory!=null?data.object.medicalHistory.replace(/"/g,""):''; - document.querySelector("[data-id='sex__c']").innerHTML=data.object.sex!=null?data.object.sex.replace(/"/g,""):''; + document.querySelector("[data-id='VOC_Informer_Name__c']").innerHTML=data.object.vocInformerName + document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id2:1:j_id3']").innerHTML=data.object.callerPhone + document.querySelector("[data-id='VOC_Informer_Contact__c']").innerHTML=data.object.vocInformerContact + document.querySelector("[data-id='Person_In_Charge_Text__c']").innerHTML=data.object.personInChargeText + document.querySelector("[data-id='Professor_sigh_text__c']").innerHTML=data.object.professorSighText + document.querySelector("[data-id='Staff_Info_Manual_c__c']").innerHTML=data.object.staffInfoManual + document.querySelector("[data-id='Medical_History__c']").innerHTML = data.object.medicalHistory + document.querySelector("[data-id='Practitioner1_Part__c']").innerHTML=data.object.practitioner1Part + document.querySelector("[data-id='Practitioner2_Part__c']").innerHTML=data.object.practitioner2Part + document.querySelector("[data-id='Practitioner3_Part__c']").innerHTML=data.object.practitioner3Part + document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:10:j_id3').innerHTML=data.object.practitioner4Part + document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:11:j_id3').innerHTML=data.object.practitioner5Part + document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:12:j_id3').innerHTML=data.object.age + document.getElementById('page:form:pageBlock:pageBlockSection:j_id2:13:j_id3').innerHTML=data.object.responsiblePersonHP + document.querySelector("[data-id='sex__c']").innerHTML=data.object.sex }; sfdcPage.appendToOnloadQueue(function () { console.log('awsDataId = '+'{!AWSDataId}') diff --git a/force-app/main/default/staticresources/AWSService/AWSService.js b/force-app/main/default/staticresources/AWSService/AWSService.js index cf3be88..b30ab60 100644 --- a/force-app/main/default/staticresources/AWSService/AWSService.js +++ b/force-app/main/default/staticresources/AWSService/AWSService.js @@ -318,6 +318,43 @@ }, + + //update + postConsumTrial:function(postURL, indexNumber , payloadForNewPI, callback, token) { + console.log('Process New PI Data'); + console.log(JSON.stringify(payloadForNewPI)); + + let payloadstr= null; + if (payloadForNewPI) { + if (typeof payloadForNewPI == 'string') { + payloadstr = payloadForNewPI; + }else{ + payloadstr = JSON.stringify(payloadForNewPI); + } + } + let para = { + url:postURL, + headers: { + 'Content-Type': 'application/json', + 'pi-token': token + }, + type: "post", + success: function (result) { + AWSService.insertCalloutLog(AWSService.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(result),AWSService.successStatus); + if(callback) callback(result,indexNumber); + }, + error: function (error){ + AWSService.insertCalloutLog(AWSService.insertModule,postURL,JSON.stringify(payloadForNewPI),JSON.stringify(error),AWSService.failStatus); + console.log(error); + } + }; + if (payloadstr) { + para.data = payloadstr; + } + jQuery.ajax(para); + + }, + confirmTrans:function(transactionURL,transParameters,callback,token){ let payloadstr= null; diff --git a/force-app/main/default/triggers/Repair.trigger b/force-app/main/default/triggers/Repair.trigger index 1daa2f0..379fc9e 100644 --- a/force-app/main/default/triggers/Repair.trigger +++ b/force-app/main/default/triggers/Repair.trigger @@ -18,17 +18,19 @@ //wangweipeng 20210727 end if ((Trigger.isAfter && Trigger.isInsert) || (Trigger.isAfter && Trigger.isUpdate) || (Trigger.isAfter && Trigger.isDelete)) { - NFM103Controller.NFM103Trigger(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); - NFM603Controller.NFM603Trigger(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); - RepairTrigger.UpdateAssert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); + if(!(System.isFuture()||System.isBatch())){// Add By Lijun 20220303 to avoid mutiple execute + NFM103Controller.NFM103Trigger(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); + NFM603Controller.NFM603Trigger(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); + RepairTrigger.UpdateAssert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); + } } // ---------------------------------------------------------------------- // 銇撱亾銈堛倞銆佷慨鐞嗐伄銈点兗銉撱偣銈炽兂銉堛儵銈儓闋呯洰銈掕嚜鍕曠殑銇洿鏂般仚銈嬨儹銈搞儍銈� // ---------------------------------------------------------------------- - if (Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)) { - //鍏堟鍚庝慨-淇悊澧炲姞鍏堟鏍囪瘑 thh 20220322 start - RepairTrigger.AdvancePaymentFlagUpsert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); - //鍏堟鍚庝慨-淇悊澧炲姞鍏堟鏍囪瘑 thh 20220322 end + if ( Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)) { + //鍏堟鍚庝慨-淇悊澧炲姞鍏堟鏍囪瘑 thh 20220322 start + RepairTrigger.AdvancePaymentFlagUpsert(Trigger.new, Trigger.newMap, Trigger.old, Trigger.oldMap); + //鍏堟鍚庝慨-淇悊澧炲姞鍏堟鏍囪瘑 thh 20220322 end // 绱嶅叆姗熷櫒ID銈掍竴鎰忋伀鏍肩磵銇欍倠 Set銇с仚銆� Set<ID> assetIds = new Set<Id>(); @@ -70,7 +72,7 @@ boolean defaultFlag = true; //add wangweipeng 2021/12/09 end // 鑽夋涓慨鐞嗐仩銇戞洿鏂� - // GZW 鐗规畩澶勭悊 璺宠繃缁翠慨涓績鑷姩璧嬪�硷紝浠ユ墜閫変负鍑� start + // GZW 鐗规畩澶勭悊 璺宠繃缁翠慨涓績鑷姩璧嬪�硷紝浠ユ墜閫変负鍑� start // 鍒ゆ柇鏉′欢杩藉姞 && repair.Exc_work_location__c == false if(repair.Exc_work_location__c){ defaultFlag = false; @@ -80,7 +82,7 @@ if ((repair.Status__c == '鑽夋涓�' || String.isBlank(repair.Status__c)) == false) { // if (Trigger.isUpdate && repair.SAP_Transfer_time__c == null) { if (Trigger.isUpdate && repair.SAP_Transfer_time__c == null && repair.Exc_work_location__c == false) { - + repair = RepairTrigger.updateWorkLocationSelect(repair, null); defaultFlag = false; } @@ -274,12 +276,12 @@ //杩佺Щ杩涚▼鐢熸垚鍣ㄤ腑repair Alltime鍔熻兘 End /****************************************************************************************************/ } - } + } } // ---------------------------------------------------------------------- // 銇撱亾銇俱仹銆併偟銉笺儞銈广偝銉炽儓銉┿偗銉堥爡鐩倰鑷嫊鐨勩伀鏇存柊銇欍倠銉偢銉冦偗 // ---------------------------------------------------------------------- - + // ---------------------------------------------------------------------- // 銇撱倢銈堛倞銆丱n-Call銇�孫n-Call璺熻繘缁撴灉銆嶃倰鏇存柊銇欍倠銉偢銉冦偗 -- Gitblit v1.9.1