force-app/main/default/classes/FileUploadController.cls
@@ -10,6 +10,9 @@ SObject obj = controller.getRecord(); parentId = obj.Id; system.debug('Parent Id:'+parentId); if((String.isBlank(parentId)||String.isEmpty(parentId))&& ApexPages.currentPage().getParameters().containskey('parentId')){ parentId = ApexPages.currentPage().getParameters().get('parentId'); } fileList=getFileds(parentId); } force-app/main/default/classes/NEWCreateSWOQuoteController.cls
@@ -11,6 +11,8 @@ public String Id {get; set;} public List<EmailInfo> mailList {get; set;} public List<String> awsDataIdList{get; set;}// 20220512 PI改造 by zhj public String awsDataIdStr{get{return JSON.serialize(awsDataIdList);} set;}// 20220512 PI改造 by zhj public String baseUrl { get; set; } public String rtUrl { get; set; } @@ -31,6 +33,7 @@ public String staticResource { get; private set; }// 20220311 PI改造 by Bright public String contactstaticResource { get; private set; }// 20220311 PI改造 by Bright public String staticResourceMailMerge { get; private set; }// 20220512 PI改造 by zhj public NEWCreateSWOQuoteController() { swoId = System.currentPageReference().getParameters().get('swoId'); @@ -48,6 +51,7 @@ staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Quotes__c'));// 20220221 PI改造 by Bright contactstaticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact'));// 20220221 PI改造 by Bright staticResourceMailMerge = JSON.serialize(PIHelper.getPIIntegrationInfo('Mail_Merge__c'));// 20220512 PI改造 by zhj } public NEWCreateSWOQuoteController(ApexPages.StandardController controller) { @@ -301,7 +305,7 @@ List<FileAddress__c> attList = new List<FileAddress__c>(); Map<String, List<FileAddress__c>> attMap = new Map<String, List<FileAddress__c>>(); Map<String, Mail_Merge__c> mailMap = new Map<String, Mail_Merge__c>([select id, FROM__c, ccName__c, SUBJECT__c, MESSAGE__c, DATE__c, toName__c, EMAIL_SENT__c from Mail_Merge__c where Quotes__c = :Id order by id]); Map<String, Mail_Merge__c> mailMap = new Map<String, Mail_Merge__c>([select id, FROM__c, ccName__c, SUBJECT__c, MESSAGE__c, DATE__c, toName__c, EMAIL_SENT__c,AWS_Data_Id__c from Mail_Merge__c where Quotes__c = :Id order by id]); if (mailMap != null) { @@ -330,6 +334,13 @@ } // Mail 页面初始化 End //zhj 20220514 start PIPL start //awsDataIdList awsDataIdList = new List<String>(); for (Integer i = 0; i < mailList.size(); i++) { awsDataIdList.add(mailList[i].mm.AWS_Data_Id__c); } //zhj 20220514 start PIPL end } //首先是从swo创建quotes,有了swoid,就是用新的静态资源显示的免责申明。 //之后,编辑已经创建完了的quotes,15号之前创建的,显示的是旧的。旧的就是aftORbef==false。 force-app/main/default/classes/NEWCreateSWOQuoteControllerTest.cls
@@ -3,7 +3,7 @@ @TestSetup static void setup(){ TestDataUtility.CreatePIPolicyConfigurations(new string[]{'Quotes__c','Contact'}); TestDataUtility.CreatePIPolicyConfigurations(new string[]{'Quotes__c','Contact','Mail_Merge__c'}); } static testMethod void QuotesIdIsNull() { force-app/main/default/classes/SWOController.cls
@@ -7,6 +7,8 @@ public String conId {get; set;} public List<EmailInfo> mailList {get; set;} public String mailListStr {get{return JSON.serialize(mailList);} set;}// 20220512 PI改造 by zhj public List<String> awsDataIdList{get; set;}// 20220512 PI改造 by zhj public String awsDataIdStr{get{return JSON.serialize(awsDataIdList);} set;}// 20220512 PI改造 by zhj public String baseUrl {get; set;} public String type {get; set;} @@ -198,6 +200,12 @@ } // update PIPL 20220426 By Chen Yanan End SwoStatus = swo.SWO_STATUS__c; //awsDataIdList awsDataIdList = new List<String>(); for (Integer i = 0; i < mailList.size(); i++) { awsDataIdList.add(mailList[i].mm.AWS_Data_Id__c); } } /** force-app/main/default/pages/DeliveryConfirmPDF.page
@@ -158,11 +158,11 @@ <apex:outputText styleClass="Customer__r.DivisionName__c" value="{!luLine.lu.Customer__r.DivisionName__c}"/> </td> <td class="dataCell" style="text-align: center;"> <span aws-obj="Contact" aws-api="lastName" aws-id="{!la.AWS_Data_Id__c}">{!luLine.lu.Contact__r.Name}</span> <span aws-obj="Contact" aws-api="lastName" aws-id="{!luLine.lu.Contact__r.AWS_Data_Id__c}">{!luLine.lu.Contact__r.Name}</span> </td> <apex:outputPanel rendered="{!IF(la.Equipment_Type__c == 'BS', true , false)}" layout="none"> <td class="dataCell" style="text-align: center;"> <span aws-obj="Contact" aws-api="phone" aws-id="{!la.AWS_Data_Id__c}">{!luLine.lu.Contact__r.Phone}</span> <span aws-obj="Contact" aws-api="phone" aws-id="{!luLine.lu.Contact__r.AWS_Data_Id__c}">{!luLine.lu.Contact__r.Phone}</span> </td> </apex:outputPanel> <apex:outputPanel rendered="{!IF(la.Equipment_Type__c == 'BS', false , true)}" layout="none"> @@ -289,7 +289,9 @@ <!-- 20220221 PI改造 by 徐亮 start --> <script> AWSService.sfSessionId = '{!GETSESSIONID()}'; sforce.connection.serverUrl = '{!$Site.Prefix}/services/Soap/u/53.0'; var staticResource = JSON.parse('{!staticResource}'); var staticResourceContact = JSON.parse('{!staticResourceContact}'); // Update 20220512 By Chen Yanan function Fun(pdf){ var iframe = document.createElement('iframe'); @@ -382,7 +384,7 @@ } } unblockUI(); //unblockUI(); } let ids = []; for (const id of dataIds) { @@ -391,11 +393,11 @@ } } if (ids.length > 0) { blockme(); //blockme(); AWSService.search(r.searchUrl,JSON.stringify({ "dataIds":ids }),function(data){ unblockUI(); // unblockUI(); if(data.object && data.object.length > 0){ for(let d of data.object){ @@ -420,16 +422,30 @@ } }); Decrypt(staticResource,dataIds); // Update 20220512 By Chen Yanan Start let dataIds2 = []; j$('[aws-id][aws-obj="Contact"]').each((i,e)=>{ let v = j$(e).attr('aws-id'); if (v) { dataIds2.push(v); } }); Decrypt(staticResourceContact,dataIds2); // Update 20220512 By Chen Yanan End } j$(function(){ //DecryptAll(); DecryptAll(); setTimeout(() => { jsPdfDownload(); }, 1500); }) document.body.onclick = function(){ jsPdfDownload(); } // document.body.onclick = function(){ // jsPdfDownload(); // } </script> <!-- 20220221 PI改造 by 徐亮 end --> </html> force-app/main/default/pages/NEWCreateSWOQuote.page
@@ -938,7 +938,7 @@ <th>INTERNAL ONLY</th> </tr> <apex:repeat value="{!mailList}" var="mail" id="lines"> <tr> <tr id="{!mail.mm.AWS_Data_Id__c}" onmouseover="showPI('{!mail.mm.AWS_Data_Id__c}')"> <td><apex:outputLink value="/apex/SendEmail?id={!mail.mm.ID}&type=Quotes&typeid={!Id}&openType=View">View</apex:outputLink> <apex:outputLink value="/apex/SendEmail?id={!mail.mm.ID}&type=Quotes&typeid={!Id}&openType=Reply">Reply</apex:outputLink></td> <td><apex:outputField value="{!mail.mm.DATE__c}" /></td> <td><apex:outputField value="{!mail.mm.FROM__c}" /></td> @@ -967,6 +967,46 @@ <table border="0"> </table> <script> var mailListObj = JSON.parse('{!awsDataIdStr}'); var staticResourceMailMerge = JSON.parse('{!staticResourceMailMerge}') var mailList = [] var PIDataObjList = {} function showPI(awsId) { if (awsId) { document.getElementById(awsId).children[2].children[0].children[0].innerText = PIDataObjList[awsId].author document.getElementById(awsId).children[5].children[0].innerText = PIDataObjList[awsId].premaryRecipient document.getElementById(awsId).children[6].children[0].innerText = PIDataObjList[awsId].cc } } for (var i = 0; i < mailListObj.length; i++) { mailList.push(mailListObj[i]) } var queryBack = function queryBack(data) { console.log(data) if (data.object) { for (var i = 0; i < data.object.length; i++) { var PIDataObj = {}; PIDataObj.author = data.object[i].author PIDataObj.premaryRecipient = data.object[i].premaryRecipient PIDataObj.cc = data.object[i].cc PIDataObjList[data.object[i].dataId] = PIDataObj; } } unblockUI(); }; document.body.onload = function () { blockme(); console.log('appendToOnloadQueue'); let searchPayload = new Object(); searchPayload.dataIds = mailList; AWSService.search(staticResourceMailMerge.searchUrl, JSON.stringify(searchPayload), queryBack, staticResourceMailMerge.token); } </script> </apex:form> <!-- <apex:relatedList list="ProcessSteps"/> --> </apex:page> force-app/main/default/pages/NEWCreateSWOQuoteReadOnly.page
@@ -277,7 +277,7 @@ <tr> <td align="left" ><apex:outputField id="ESTIMATE" value="{!QuotesPage.ESTIMATE__c }" /></td> <td/> <td align="left" ><apex:outputField id="CONTACT_EMAIL" value="{!QuotesPage.CONTACT_EMAIL__c}"/></td> <td align="left" ><apex:outputField id="CONTACT_EMAIL" html-aws-obj="Contact" html-aws-api="emailD" html-aws-id="{!QuotesPage.CONTACT_NAME__r.AWS_Data_Id__c}" value="{!QuotesPage.CONTACT_EMAIL__c}"/></td> </tr> <tr> @@ -890,7 +890,7 @@ <th>INTERNAL ONLY</th> </tr> <apex:repeat value="{!mailList}" var="mail" id="lines"> <tr> <tr id="{!mail.mm.AWS_Data_Id__c}" onmouseover="showPI('{!mail.mm.AWS_Data_Id__c}')"> <td><apex:outputLink value="/apex/SendEmail?id={!mail.mm.ID}&type=Quotes&typeid={!Id}&openType=View">View</apex:outputLink> <apex:outputLink value="/apex/SendEmail?id={!mail.mm.ID}&type=Quotes&typeid={!Id}&openType=Reply">Reply</apex:outputLink></td> <td><apex:outputField value="{!mail.mm.DATE__c}" /></td> <td><apex:outputField value="{!mail.mm.FROM__c}" /></td> @@ -919,6 +919,47 @@ <table border="0"> </table> <script> var mailListObj = JSON.parse('{!awsDataIdStr}'); var staticResourceMailMerge = JSON.parse('{!staticResourceMailMerge}') var mailList = [] var PIDataObjList = {} function showPI(awsId) { if (awsId) { document.getElementById(awsId).children[2].children[0].children[0].innerText = PIDataObjList[awsId].author document.getElementById(awsId).children[5].children[0].innerText = PIDataObjList[awsId].premaryRecipient document.getElementById(awsId).children[6].children[0].innerText = PIDataObjList[awsId].cc } } for (var i = 0; i < mailListObj.length; i++) { mailList.push(mailListObj[i]) } var queryBack = function queryBack(data) { console.log(data) if (data.object) { for (var i = 0; i < data.object.length; i++) { var PIDataObj = {}; PIDataObj.author = data.object[i].author PIDataObj.premaryRecipient = data.object[i].premaryRecipient PIDataObj.cc = data.object[i].cc PIDataObjList[data.object[i].dataId] = PIDataObj; } } unblockUI(); }; document.body.onload = function () { blockme(); console.log('appendToOnloadQueue'); let searchPayload = new Object(); searchPayload.dataIds = mailList; AWSService.search(staticResourceMailMerge.searchUrl, JSON.stringify(searchPayload), queryBack, staticResourceMailMerge.token); } </script> </apex:form> <!-- <apex:relatedList list="ProcessSteps"/> --> </apex:page> force-app/main/default/pages/NewAndEditOrder.page
@@ -768,13 +768,17 @@ if(document.querySelector("[data-id='EndUserD__c']")){ EndUserDLkid = document.getElementById(document.querySelector("[data-id='EndUserD__c']").id + '_lkid').value; //query contact let result = sforce.connection.query("SELECT AWS_Data_Id__c from Contact where id = '" + EndUserDLkid + "'"); let records = result.getArray("records"); let awsDataId = records[0].AWS_Data_Id__c; let queryContactBack = function(data){ document.querySelector("[data-id='EndUserD__c']").value = data.object.lastName; } AWSService.query(staticResourcesContact.queryUrl, awsDataId, queryContactBack, staticResources.token); if(EndUserDLkid){ let result = sforce.connection.query("SELECT AWS_Data_Id__c from Contact where id = '" + EndUserDLkid + "'"); let records = result.getArray("records"); if(records.length>0&&records[0].AWS_Data_Id__c){ let awsDataId = records[0].AWS_Data_Id__c; let queryContactBack = function(data){ document.querySelector("[data-id='EndUserD__c']").value = data.object.lastName; } AWSService.query(staticResourcesContact.queryUrl, awsDataId, queryContactBack, staticResources.token); } } } //Replace Vlookup Field force-app/main/default/pages/NewLoanerApplication.page
@@ -188,6 +188,7 @@ ProcessPI({},GetObj(),function(){ saveBtn(); }); unblockUI(); // Update 20220318 By Yang Kaiyu End } force-app/main/default/pages/OrderPdf2.page
@@ -559,6 +559,7 @@ <!-- 20220221 PI改造 by 徐亮 start --> <script> AWSService.sfSessionId = '{!GETSESSIONID()}'; sforce.connection.serverUrl = '{!$Site.Prefix}/services/Soap/u/53.0'; var staticResources = JSON.parse('{!staticResource}'); function Fun(pdf){ force-app/main/default/pages/QuotesPDF.page
@@ -141,7 +141,7 @@ </apex:outputPanel> <apex:outputPanel layout="none" rendered="{!IF(quo.CONTACT_EMAIL__c != null, true, false)}"> <td colspan="2" style="border-right-width: 0px;">{!quo.CONTACT_EMAIL__c} </td> <td colspan="2" style="border-right-width: 0px;" id="conEmail">{!quo.CONTACT_EMAIL__c} </td> </apex:outputPanel> <apex:outputPanel layout="none" rendered="{!IF(quo.CONTACT_EMAIL__c != null, false, true)}"> <td colspan="2" style="border-right-width: 0px;"> </td> @@ -432,6 +432,8 @@ if('{!quo.CONTACT_NAME__r.AWS_Data_Id__c}'){ AWSService.query(contactStaticResource.queryUrl, '{!quo.CONTACT_NAME__r.AWS_Data_Id__c}', function(data){ let e = document.getElementById("conName");if(e)e.innerHTML = data.object.lastName; debugger; let emailNode = document.getElementById("conEmail");if(emailNode) emailNode.innerHTML = data.object.emailD; i++; Foo(); }, staticResources.token); force-app/main/default/pages/SWOFileUploadPage.page
@@ -1,5 +1,5 @@ <!-- 该页面用于Lead对象上传PDF,未来如果要添加其他对象的上传PDF功能,复制该页面,将**standardController**修改为其他对象API名称即可 --> <apex:page standardController="SWO__c" extensions="FileUploadController" id="page" lightningStyleSheets="true"> <apex:page standardController="SWO__c" showHeader="false" sidebar="false" extensions="FileUploadController" id="page" lightningStyleSheets="true"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <script> var staticResources = JSON.parse('{!staticResource}'); @@ -56,16 +56,22 @@ } function confirmTrans(transId, isSuccess) { AWSService.post(staticResources.updateUrl, JSON.stringify({ "txId":transId, "sfRecordId":"", "isSuccess":isSuccess }), function(result){ 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 => { console.log("confirmTrans-" + JSON.stringify(data)); document.getElementById("file").files[0].name = ''; enableButtonStatus(); refreshFiles(); }, staticResources.token); refreshFiles(); return data.status; }) } function calculateFileSize(fileObject) { force-app/main/default/pages/SWOPage.page
@@ -18,7 +18,59 @@ var isNew = {!isNew}; console.log('isNew: ' + isNew); function Decrypt(r,dataIds,callback){ function Decrypt1(r,dataIds,callback){ if (!(dataIds && dataIds.length)) { if(callback)callback(); return; } let Foo = function(){ for (const id of dataIds) { if (aws_data.hasOwnProperty(id)) { let d = aws_data[id]; let $e =j$("[aws-id='"+d.dataId+ "']"); $e.each((i,e)=>{ j$(e).html(d[j$(e).attr("aws-api")]); //j$(e).attr('value',d[j$(e).attr("aws-api")]) }) } } if(callback)callback(); } let ids = []; for (const id of dataIds) { if (!aws_data.hasOwnProperty(id)) { ids.push(id); } } if (ids.length > 0) { // AWSService.search(r.searchUrl,JSON.stringify({ // "dataIds":ids // }),function(data){ AWSService.query(r.queryUrl,ids[0],function(data){ console.log('data: ' + JSON.stringify(data)); // if(data.object && data.object.length > 0){ if(data.object){ // for(let d of data.object){ // if(d.dataId){ // aws_data[d.dataId] = d; // } // } aws_data[data.object.dataId] = data.object; Foo(); }else{ if(callback)callback(); } },r.token); }else{ Foo(); } } function Decrypt2(r,dataIds,callback){ if (!(dataIds && dataIds.length)) { if(callback)callback(); return; @@ -78,8 +130,7 @@ dataIds1.push(v); } }); Decrypt(contactstaticResource,dataIds1,callback); Decrypt1(contactstaticResource,dataIds1,callback); } @@ -91,7 +142,7 @@ dataIds2.push(v); } }); Decrypt(staticResources,dataIds2,callback); Decrypt2(staticResources,dataIds2,callback); } j$(function(){ @@ -304,6 +355,7 @@ // doctorDivision1 : document.getElementById("Page:mainForm:idSearchVisitor:updateContactDoctorDivision").value, // dataId:selectedAwsDataId contactNameHidden: document.getElementById("Page:mainForm:CONTACT_NAME_HIDDEN__c").value, contactNameHiddenEncrypt: document.getElementById("Page:mainForm:CONTACT_NAME_HIDDEN_Encrypted__c").value, dataId:'{!swoawsDataId}' }]); } @@ -314,6 +366,7 @@ console.log('Result from AWS:'+JSON.stringify(obj)); document.getElementById('Page:mainForm:AWS_Data_Id__c').value = obj.dataId; document.getElementById("Page:mainForm:CONTACT_NAME_HIDDEN__c").value = obj.contactNameHidden; document.getElementById('Page:mainForm:CONTACT_NAME_HIDDEN_Encrypted__c').value = obj.contactNameHiddenEncrypt; // document.getElementById("Page:mainForm:idSearchVisitor:updateContactLastName").value = obj.lastName; // document.getElementById("Page:mainForm:LastName_Encrypted__c").value = obj.lastNameEncrypt; @@ -353,6 +406,11 @@ }), function(result){ //let id = document.getElementById('Page:mainForm:frontSwoId').value let id = j$(escapeVfId("swoid")).value(); if(id == ''){ unblockUI(); alert('数据验证错误') return } window.location.href = '/apex/SWOPageRead?id=' + id +'&type='+'{!type}'; //window.location.reload(); }, staticResources.token); @@ -429,7 +487,7 @@ <apex:actionFunction name="uploadFile" action="{!uploadFile}"></apex:actionFunction> <!-- Add save method for PIPL 20220414 by Li Jun Start --> <apex:inputHidden id="frontSwoId" value="{!frontSwoId}" /> <apex:actionFunction name="saveNew" action="{!save}" reRender="swoid,frontSwoId" onComplete="Trans()"> <apex:actionFunction name="saveNew" action="{!save}" reRender="swoid,frontSwoId,mainForm" onComplete="Trans()"> <apex:param name="frontCaseId" assignto="{!caseId}" value="{!caseId}"/> </apex:actionFunction> <!-- Add save method for PIPL 20220414 by Li Jun End --> @@ -521,6 +579,7 @@ <!-- <td colspan="2"><apex:inputField value="{!swo.CONTACT_NAME_HIDDEN__c}"/></td> --> <td colspan="2" > <apex:inputHidden id="AWS_Data_Id__c" value="{!swo.AWS_Data_Id__c}"/> <apex:inputHidden id="CONTACT_NAME_HIDDEN_Encrypted__c" value="{!swo.CONTACT_NAME_HIDDEN_Encrypted__c}"/> <apex:inputField html-aws-obj="SWO__c" html-aws-api="contactNameHidden" html-aws-id="{!swo.AWS_Data_Id__c}" id="CONTACT_NAME_HIDDEN__c" value="{!swo.CONTACT_NAME_HIDDEN__c }" /> </td> <!-- Update By Yanan --> @@ -722,24 +781,25 @@ <td>INTERNAL ONLY</td> </tr> <apex:repeat value="{!mailList}" var="mail" id="lines"> <tr> <!-- Update 20220513 By Chen Yanan Start --> <tr class="row" id="{!mail.mm.AWS_Data_Id__c}" onmouseover="showPI('{!mail.mm.AWS_Data_Id__c}')"> <td><apex:outputLink value="/apex/SendEmail?id={!mail.mm.ID}&type=SWO&typeid={!swoid}&openType=View">View</apex:outputLink> <apex:outputLink value="/apex/SendEmail?id={!mail.mm.ID}&type=SWO&typeid={!swoid}&openType=Reply">Reply</apex:outputLink></td> <td><apex:outputField value="{!mail.mm.DATE__c}" /></td> <td><apex:outputField value="{!mail.mm.FROM__c}" /></td> <td><apex:outputField value="{!mail.mm.MESSAGE__c}" /></td> <td><apex:outputText value="{!mail.mm.EMAIL_SENT__c}" /></td> <td><apex:outputField value="{!mail.mm.toName__c}" /></td> <td><apex:outputField value="{!mail.mm.ccName__c}" /></td> <td><apex:outputField value="{!mail.mm.DATE__c}"/></td> <td id="{!mail.mm.AWS_Data_Id__c}_FROM"><apex:outputField value="{!mail.mm.FROM__c}" /></td> <td><apex:outputField value="{!mail.mm.MESSAGE__c}"/></td> <td><apex:outputText value="{!mail.mm.EMAIL_SENT__c}"/></td> <td id="{!mail.mm.AWS_Data_Id__c}_toName"><apex:outputField value="{!mail.mm.toName__c}"/></td> <td id="{!mail.mm.AWS_Data_Id__c}_ccName"><apex:outputField value="{!mail.mm.ccName__c}"/></td> <td><apex:outputText value="{!mail.haveAtt}" /></td> <td> <apex:repeat value="{!mail.attList}" var="att" id="lines"> <apex:outputLink value="/{!att.Id}"><c:PDFWbr targetStr="{!att.Name}" /></apex:outputLink> <apex:outputLink value="/{!att.Id}"><c:PDFWbr targetStr="{!att.FileName__c}" /></apex:outputLink> <br/> </apex:repeat> </td> <td><apex:outputText value="YES" /></td> </tr> <!-- Update 20220513 By Chen Yanan End --> </apex:repeat> </table> @@ -1617,10 +1677,11 @@ <apex:outputPanel rendered="{!IF(type = 'General' || type = 'All',true,false)}"> <!-- Before PIPL Update by Li Jun 20220414 Start --> <apex:commandButton value="Attach" action="{!uploadFile}"></apex:commandButton> <!-- <apex:commandButton value="Attach" action="{!uploadFile}"></apex:commandButton> --> <!-- Before PIPL Update by Li Jun 20220414 End --> <!-- After PIPL Update by Li Jun 20220414 Start --> <input class="btn" type="Button" value="PIPL Attach" onclick="window.open('/apex/SWOFileUploadPage')" /> <apex:iframe src="/apex/SWOFileUploadPage?parentId={!swoid}" scrolling="true" height="300" id="fileUploadSection"/> <!-- <input class="btn" type="Button" value="Attach" onclick="window.open('/apex/SWOFileUploadPage?parentId={!swoid}')" /> --> <!-- After PIPL Update by Li Jun 20220414 End --> <table class="tableCss" style="border:1px solid #000000;width: 80%"> <tr style="text-align:center;"> @@ -2016,8 +2077,54 @@ <!-- PIPL Update 20220414 By Chen Yanan --> <!-- <apex:commandButton onclick="blockme();" value="Save" action="{!save}" style="width: 5%;"/> --> <apex:commandButton id="saveSWOs" value="Save" style="width: 5%;" onclick="saveSWOToAWS();" rerender="dummy" /> <script> var mailListObj = JSON.parse('{!awsDataIdStr}'); var staticResourceMailMerge = JSON.parse('{!staticResourceMailMerge}') var mailList = [] var PIDataObjList = {} function showPI(awsId){ if(awsId){ document.getElementById(awsId).children[2].children[0].children[0].innerText = PIDataObjList[awsId].author document.getElementById(awsId).children[5].children[0].innerText = PIDataObjList[awsId].premaryRecipient document.getElementById(awsId).children[6].children[0].innerText = PIDataObjList[awsId].cc } } for(var i=0;i<mailListObj.length;i++){ mailList.push(mailListObj[i]) } var queryBack = function queryBack(data){ console.log(data) if (data.object) { for (var i=0;i<data.object.length;i++) { // var PIDataObj = {}; // var d = {}; // PIDataObj.author = data.object[i].author // PIDataObj.premaryRecipient = data.object[i].premaryRecipient // PIDataObj.cc = data.object[i].cc // d[data.object[i].dataId] = PIDataObj // PIDataObjList.push(d) var PIDataObj = {}; PIDataObj.author = data.object[i].author PIDataObj.premaryRecipient = data.object[i].premaryRecipient PIDataObj.cc = data.object[i].cc PIDataObjList[data.object[i].dataId] = PIDataObj; } } unblockUI(); }; document.body.onload = function(){ blockme(); console.log('appendToOnloadQueue'); let searchPayload = new Object(); searchPayload.dataIds = mailList; AWSService.search(staticResourceMailMerge.searchUrl,JSON.stringify(searchPayload),queryBack,staticResourceMailMerge.token); } </script> <!-- PIPL Update 20220414 By Chen Yanan --> </apex:form> <br/> force-app/main/default/pages/SWOPageRead.page
@@ -1442,9 +1442,10 @@ <apex:outputPanel rendered="{!IF(type = 'General' || type = 'All',true,false)}"> <!-- Before PIPL Update by Li Jun 20220414 Start --> <apex:commandButton value="Attach" action="{!uploadFile}"></apex:commandButton> <!-- <apex:commandButton value="Attach" action="{!uploadFile}"></apex:commandButton> --> <!-- Before PIPL Update by Li Jun 20220414 End --> <input class="btn" type="Button" value="PIPL Attach" onclick="window.open('/apex/SWOFileUploadPage')" /> <apex:iframe src="/apex/SWOFileUploadPage?parentId={!swoid}" scrolling="true" height="300" id="fileUploadSection"/> <!-- <input class="btn" type="Button" value="Attach" onclick="window.open('/apex/SWOFileUploadPage?parentId={!swoid}')" /> --> <table class="tableCss" style="border:1px solid #000000;width: 80%"> <tr style="text-align:center;"> <th style="text-align:center;width: 33%;">File Name</th> @@ -1946,8 +1947,8 @@ return sb.tostring() } console.log('{!mailListStr}'.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\s+/g,"").replace("\"/g","\\\"")) var mailListObj = JSON.parse('{!mailListStr}'.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\s+/g,"")) console.log('awsDataIdStr = ' + '{!awsDataIdStr}') var mailListObj = JSON.parse('{!awsDataIdStr}'); var staticResourceMailMerge = JSON.parse('{!staticResourceMailMerge}') var mailList = [] var PIDataObjList = {} @@ -1965,7 +1966,7 @@ for(var i=0;i<mailListObj.length;i++){ mailList.push(mailListObj[i].mm.AWS_Data_Id__c) mailList.push(mailListObj[i]) } var queryBack = function queryBack(data){ console.log(data) force-app/main/default/pages/ViewOpportunityDecryptInfoForApproval.page
New file @@ -0,0 +1,67 @@ <apex:page standardController="Opportunity" extensions="NewAndEditOpportunityController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> <!--Each section has layoutFields, let's iterate them as well--> <!-- <apex:repeat value="{!layoutEncryptedAPIList}" var="encryptedAPI"> <apex:outputField html-data-id="{!encryptedAPI}" title="{!ApiPrefix}{!encryptedAPI}" value="{!Opportunity[encryptedAPI]}" /> </apex:repeat> --> <!-- Title --> <apex:outputField html-data-id="{!encryptedAPIList[0]}" title="{!ApiPrefix}{!encryptedAPIList[0]}" value="{!Opportunity[encryptedAPIList[0]]}" /> <apex:outputField html-data-id="{!encryptedAPIList[1]}" title="{!ApiPrefix}{!encryptedAPIList[1]}" value="{!Opportunity[encryptedAPIList[1]]}" /> <apex:outputField value="{!Opportunity.Dealer_Sales_Staff_Name_IsChanged__c}" /> <!-- Mobile Phone --> <apex:outputField html-data-id="{!encryptedAPIList[2]}" title="{!ApiPrefix}{!encryptedAPIList[2]}" value="{!Opportunity[encryptedAPIList[2]]}" /> <apex:outputField html-data-id="{!encryptedAPIList[3]}" title="{!ApiPrefix}{!encryptedAPIList[3]}" value="{!Opportunity[encryptedAPIList[3]]}" /> <apex:outputField value="{!Opportunity.Dealer_Service_IsChanged__c}" /> </apex:pageBlockSection> <script> var config = { SobjectName : "{!SobjectName}", ApiPrefix:"{!ApiPrefix}", AWSToSobjectMap:{!AWSToSobjectMapJson}, AWSToSobjectNonEncryptedMap:{!AWSToSobjectNonEncryptedMapJson}, AWSToSobjectEncryptedMap:{!AWSToSobjectEncryptedMapJson} }; var staticResources = JSON.parse('{!staticResource}'); function QuerySobjectFromAWS() { AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); } var queryBack = function queryBack(data) { if(!data.object){ console.log('data.object is ' + data.object); return; } for(let f in config.AWSToSobjectNonEncryptedMap){ let t = "[title='"+config.ApiPrefix+config.AWSToSobjectNonEncryptedMap[f]+"']"; let ele = document.querySelector(t); if(ele){ ele.title = ''; if(data.object.hasOwnProperty(f)){ ele.innerHTML = data.object[f]; } else{ console.log(f + 'is not in data.object'); } }else{ console.log('selector='+t+' not found'); } } // 当不能自动正确替换加密数据时需要在此处添加js,硬编码处理 // document.querySelector("[data-id='LastName']").value = data.object.lastName; }; sfdcPage.appendToOnloadQueue(function () { console.log('sfdcPage.appendToOnloadQueue') // document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[0].innerText = '姓名' QuerySobjectFromAWS(); }); </script> </apex:pageblock> </apex:form> </apex:page> force-app/main/default/pages/ViewOpportunityDecryptInfoForApproval.page-meta.xml
New file @@ -0,0 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexPage xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <availableInTouch>false</availableInTouch> <confirmationTokenRequired>false</confirmationTokenRequired> <label>ViewOpportunityDecryptInfoForApproval</label> </ApexPage> force-app/main/default/pages/ViewOrderDecryptInfoForApproval.page
New file @@ -0,0 +1,194 @@ <apex:page standardController="Order" extensions="NewAndEditOrderController" id="page"> <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }"/> <apex:form id="form"> <apex:pageblock id="pageBlock"> <apex:pageBlockSection showHeader="false" title="" collapsible="true" columns="2" id="pageBlockSection"> <!--Each section has layoutFields, let's iterate them as well--> <!-- <apex:repeat value="{!layoutEncryptedAPIList}" var="encryptedAPI"> <apex:outputField html-data-id="{!encryptedAPI}" title="{!ApiPrefix}{!encryptedAPI}" value="{!Order[encryptedAPI]}" /> </apex:repeat> --> <!-- EndUser --> <apex:outputField html-data-id="EndUser__c" title="{!ApiPrefix}_EndUser__c" value="{!Order['EndUser__c']}" /> <apex:outputField html-data-id="EndUserD__c" title="{!ApiPrefix}_EndUserD__c" value="{!Order['EndUserD__c']}" /> <apex:outputField value="{!Order.EndUser_IsChange__c}" /> <!-- 送达方联系人 --> <apex:outputField html-data-id="SpecialDeliveryContact2__c" title="{!ApiPrefix}_SpecialDeliveryContact2__c" value="{!Order['SpecialDeliveryContact2__c']}" /> <apex:outputField html-data-id="SpecialDeliveryContact2_D__c" title="{!ApiPrefix}_SpecialDeliveryContact2_D__c" value="{!Order['SpecialDeliveryContact2_D__c']}" /> <apex:outputField value="{!Order.SpecialDeliveryContact2_IsChanged__c}" /> <!-- 送货地址 --> <apex:outputField html-data-id="Shipping_Address__c" title="{!ApiPrefix}_Shipping_Address__c" value="{!Order['Shipping_Address__c']}" /> <apex:outputField html-data-id="Shipping_Address_D__c" title="{!ApiPrefix}_Shipping_Address_D__c" value="{!Order['Shipping_Address_D__c']}" /> <apex:outputField value="{!Order.Shipping_Address_IsChanged__c}" /> <!-- SpecialDeliveryContact --> <apex:outputField html-data-id="SpecialDeliveryContact__c" title="{!ApiPrefix}_SpecialDeliveryContact__c" value="{!Order['SpecialDeliveryContact__c']}" /> <apex:outputField html-data-id="SpecialDeliveryContact_D__c" title="{!ApiPrefix}_SpecialDeliveryContact_D__c" value="{!Order['SpecialDeliveryContact_D__c']}" /> <apex:outputField value="{!Order.SpecialDeliveryContact_IsChanged__c}" /> <!-- SpecialDeliveryPhone --> <apex:outputField html-data-id="SpecialDeliveryPhone__c" title="{!ApiPrefix}_SpecialDeliveryPhone__c" value="{!Order['SpecialDeliveryPhone__c']}" /> <apex:outputField html-data-id="SpecialDeliveryPhone_D__c" title="{!ApiPrefix}_SpecialDeliveryPhone_D__c" value="{!Order['SpecialDeliveryPhone_D__c']}" /> <apex:outputField value="{!Order.SpecialDeliveryPhone_IsChanged__c}" /> <!-- SpecialDeliveryAddress --> <apex:outputField html-data-id="SpecialDeliveryAddress__c" title="{!ApiPrefix}_SpecialDeliveryAddress__c" value="{!Order['SpecialDeliveryAddress__c']}" /> <apex:outputField html-data-id="SpecialDeliveryAddress_D__c" title="{!ApiPrefix}_SpecialDeliveryAddress_D__c" value="{!Order['SpecialDeliveryAddress_D__c']}" /> <apex:outputField value="{!Order.SpecialDeliveryAddress_IsChanged__c}" /> </apex:pageBlockSection> <script> var config = { SobjectName : "{!SobjectName}", ApiPrefix:"{!ApiPrefix}", AWSToSobjectMap:{!AWSToSobjectMapJson}, AWSToSobjectNonEncryptedMap:{!AWSToSobjectNonEncryptedMapJson}, AWSToSobjectEncryptedMap:{!AWSToSobjectEncryptedMapJson} }; var staticResources = JSON.parse('{!staticResource}'); var staticResourceContact = JSON.parse('{!staticResourceContact}'); function QuerySobjectFromAWS() { AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); debugger let t = "[title='"+config.ApiPrefix+"_EndUser__c']"; let tD = "[title='"+config.ApiPrefix+"_EndUserD__c']"; let t2 = "[title='"+config.ApiPrefix+"_SpecialDeliveryContact2__c']"; let t2D = "[title='"+config.ApiPrefix+"_SpecialDeliveryContact2_D__c']"; let ele = document.querySelector(t); let eleD = document.querySelector(tD); let ele2 = document.querySelector(t2); let ele2D = document.querySelector(t2D); if('{!contactAWSDataId}' != '无' && '{!contactName}' != '无'){ if('{!contactAWSDataId}' != ''){ AWSService.query(staticResourceContact.queryUrl, '{!contactAWSDataId}', queryContactBack, staticResourceContact.token); }else{ ele.innerHTML = '{!contactName}'; } if('{!endUserDAWSDataId}' != ''){ AWSService.query(staticResourceContact.queryUrl, '{!endUserDAWSDataId}', queryEndUserDBack, staticResourceContact.token); }else{ eleD.innerHTML = '{!endUserDName}'; } if('{!contact2AWSDataId}' != ''){ AWSService.query(staticResourceContact.queryUrl, '{!contact2AWSDataId}', queryContact2Back, staticResourceContact.token); }else{ ele2.innerHTML = '{!contact2Name}'; } if('{!contact2DAWSDataId}' != ''){ AWSService.query(staticResourceContact.queryUrl, '{!contact2DAWSDataId}', queryContact2DBack, staticResourceContact.token); }else{ ele2D.innerHTML = '{!contact2DName}'; } }else{ ele.innerHTML = ''; } } var queryContactBack = function queryContactBack(data){ if(!data.object){ console.log('data.object is ' + data.object); return; } console.log('data.object is ' + data.object); let t = "[title='"+config.ApiPrefix+"_EndUser__c']"; let ele = document.querySelector(t); if(ele){ ele.title=''; ele.innerHTML = data.object.lastName; } }; var queryEndUserDBack = function queryEndUserDBack(data){ if(!data.object){ console.log('data.object is ' + data.object); return; } console.log('data.object is ' + data.object); let t = "[title='"+config.ApiPrefix+"_EndUserD__c']"; let ele = document.querySelector(t); if(ele){ ele.title=''; ele.innerHTML = data.object.lastName; } }; var queryContact2Back = function queryContact2Back(data){ if(!data.object){ console.log('data.object is ' + data.object); return; } console.log('data.object is ' + data.object); let t = "[title='"+config.ApiPrefix+"_SpecialDeliveryContact2__c']"; let ele = document.querySelector(t); let tAddress = "[title='"+config.ApiPrefix+"_Shipping_Address__c']"; let eleAddress = document.querySelector(tAddress); if(ele){ ele.title=''; ele.innerHTML = data.object.lastName; } if(eleAddress){ eleAddress.title=''; eleAddress.innerHTML = data.object.address1; } }; var queryContact2DBack = function queryContact2DBack(data){ if(!data.object){ console.log('data.object is ' + data.object); return; } console.log('data.object is ' + data.object); let t = "[title='"+config.ApiPrefix+"_SpecialDeliveryContact2_D__c']"; let ele = document.querySelector(t); let tAddress = "[title='"+config.ApiPrefix+"_Shipping_Address_D__c']"; let eleAddress = document.querySelector(tAddress); if(ele){ ele.title=''; ele.innerHTML = data.object.lastName; } if(eleAddress){ eleAddress.title=''; eleAddress.innerHTML = data.object.address1; } }; var queryBack = function queryBack(data) { if(!data.object){ console.log('data.object is ' + data.object); return; } for(let f in config.AWSToSobjectNonEncryptedMap){ let t = "[title='"+config.ApiPrefix+'_'+config.AWSToSobjectNonEncryptedMap[f]+"']"; let ele = document.querySelector(t); if(ele){ ele.title = ''; if(data.object.hasOwnProperty(f)){ ele.innerHTML = data.object[f]; } else{ console.log(f + 'is not in data.object'); } }else{ console.log('selector='+t+' not found'); } } // 当不能自动正确替换加密数据时需要在此处添加js,硬编码处理 // document.querySelector("[data-id='LastName']").value = data.object.lastName; }; sfdcPage.appendToOnloadQueue(function () { console.log('sfdcPage.appendToOnloadQueue') // document.querySelector("[data-id='LastName']").parentNode.parentNode.parentNode.children[0].innerText = '姓名' QuerySobjectFromAWS(); }); </script> </apex:pageblock> </apex:form> </apex:page> force-app/main/default/pages/ViewOrderDecryptInfoForApproval.page-meta.xml
New file @@ -0,0 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ApexPage xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>54.0</apiVersion> <availableInTouch>false</availableInTouch> <confirmationTokenRequired>false</confirmationTokenRequired> <label>ViewOrderDecryptInfoForApproval</label> </ApexPage> force-app/main/default/pages/ViewUserFaultInfoDecryptInfo.page
@@ -8,6 +8,8 @@ <apex:outputField html-data-id="{!encryptedAPI}" title="{!ApiPrefix}{!encryptedAPI}" value="{!User_FaultInfo__c[encryptedAPI]}" /> </apex:repeat> <apex:outputField html-data-id="CONTACT__c" title="{!ApiPrefix}CONTACT__c" value="{!User_FaultInfo__c['CONTACT__c']}" /> <apex:outputField html-data-id="PHONE__c" title="{!ApiPrefix}PHONE__c" value="{!User_FaultInfo__c['PHONE__c']}" /> <apex:outputField html-data-id="E_MAIL__c" title="{!ApiPrefix}E_MAIL__c" value="{!User_FaultInfo__c['E_MAIL__c']}" /> <apex:outputField html-data-id="UFContact__c" title="{!ApiPrefix}UFContact__c" value="{!User_FaultInfo__c['UFContact__c']}" /> </apex:pageBlockSection> <script> @@ -39,7 +41,6 @@ }else{ ele.innerHTML = ''; } debugger let contactUserD = "[title='"+config.ApiPrefix+"UFContact__c']"; let eleUserD = document.querySelector(contactUserD); if('{!endUserDAWSDataId}' != '无' && '{!endUserDName}' != '无'){ @@ -65,6 +66,24 @@ ele.title=''; ele.innerHTML = data.object.lastName; } let t1 = "[title='"+config.ApiPrefix+"PHONE__c']"; let ele1 = document.querySelector(t1); if(ele1){ ele1.title=''; if (data.object.phoneD) { ele1.innerHTML = data.object.phoneD; } else { ele1.innerHTML = data.object.mobilePhoneD; } } let t2 = "[title='"+config.ApiPrefix+"E_MAIL__c']"; let ele2 = document.querySelector(t2); if(ele2){ ele2.title=''; ele2.innerHTML = data.object.emailD; } }; var queryEndUserDBack = function queryEndUserDBack(data){