From 0953b3b5fcf19c627c6479a6b86648df653c40db Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期一, 09 五月 2022 17:50:33 +0800
Subject: [PATCH] SF PIPL Page Fix Lookup Required issue

---
 force-app/main/default/pages/NewLoanerUser.page |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/force-app/main/default/pages/NewLoanerUser.page b/force-app/main/default/pages/NewLoanerUser.page
index f66ca52..8b94606 100644
--- a/force-app/main/default/pages/NewLoanerUser.page
+++ b/force-app/main/default/pages/NewLoanerUser.page
@@ -7,6 +7,7 @@
 	<apex:includeScript value="{!URLFOR($Resource.CommonUtilJs)}"/>
 	<apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" />
 	<apex:includeScript value="/soap/ajax/40.0/connection.js"/>
+	<script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script>
 	<!-- Update 20220317 By Yang Kaiyu End -->
 	<script>
 		// Update 20220317 By Yang Kaiyu Start
@@ -31,7 +32,8 @@
             console.log(accountValue);
             if(accountValue !='000000000000000'){
                 let baseUrl = "/apex/SearchContactPage";
-                let suffixUrl = "?contactId="+contactNodeId+"&accountId="+accountValue;
+				let searchContactKeyWord = document.getElementById(conid).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) {
@@ -48,15 +50,12 @@
 			dataLinesJson = JSON.parse('{!dataLinesJson}');
 			console.log('dataLinesJson = ' + dataLinesJson);
 			for(var i = 0;i<dataLinesJson.length;i++){
-				//if(document.getElementById('allpage:allForm:allBlock:lines:'+i+':customer') != null){
-				let contactHtmlString = '<img src="/img/s.gif" onclick="searchContact(\'allPage:allForm:contactId\',\'allPage:allForm:allBlock:lines:'+i+':customer_lkid\',\'allPage:allForm:allBlock:lines:'+i+':contact_lkid\',\'allPage:allForm:allBlock:lines:'+i+':contact\')" alt="Reference Document Number Lookup" class="lookupIcon"  title="Reference Document Number Lookup (New Window)"/>';
-				let lookUpNode = htmlToElement(contactHtmlString);
-				console.log(lookUpNode);
-				let parentNode = document.getElementById('allPage:allForm:allBlock:lines:'+i+':contact').parentNode;
-				//parentNode.appendChild(lookUpNode);      
-				parentNode.replaceChild(lookUpNode, document.getElementById('allPage:allForm:allBlock:lines:'+i+':contact').parentNode.children[2]);          
-				//}
+				let ii = i;
+				document.getElementById('allPage:allForm:allBlock:lines:'+ii+':contact').addEventListener('click',function(){
+					searchContact('allPage:allForm:contactId','allPage:allForm:allBlock:lines:'+ii+':customer_lkid','allPage:allForm:allBlock:lines:'+ii+':contactId_Hidden','allPage:allForm:allBlock:lines:'+ii+':contact');
+				});
 			}
+			
             
         }
 		function htmlToElement(html) {
@@ -203,8 +202,9 @@
 							<!-- Update 20220317 By Yang Kaiyu End -->
                    			{!$ObjectType.loaner_user__c.fields.Contact__c.label}:
 							<!-- Update 20220317 By Yang Kaiyu Start -->
-                   			<apex:inputField id="contact"  value="{!line.Contact__c}" html-aws-id="{!line.Contact__r.AWS_Data_Id__c}" />
-							<!-- <apex:inputText id="contact" html-aws-id="{!line.Contact__r.AWS_Data_Id__c}" disabled="false" value="{!line.Contact__r.LastName}" ></apex:inputText>                       -->
+                   			<!-- <apex:inputField id="contact"  value="{!line.Contact__c}" html-aws-id="{!line.Contact__r.AWS_Data_Id__c}" /> -->
+							<apex:inputText id="contact" html-aws-id="{!line.Contact__r.AWS_Data_Id__c}" disabled="false" value="{!line.Contact__r.LastName}" ></apex:inputText> 
+							<apex:inputText id="contactId_Hidden" value="{!line.Contact__c}" style="display:none"/>                     
 							<!-- Update 20220317 By Yang Kaiyu End -->
 
                    			{!$ObjectType.loaner_user__c.fields.FromThePeriod__c.label}:

--
Gitblit v1.9.1