From 4688e276eee13cd2e521aa55afb5725cb0fda270 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 22 一月 2024 21:21:18 +0800
Subject: [PATCH] backuprentalapply0122

---
 force-app/main/default/pages/RentalApplyQR.page |   26 ++++++++++----------------
 1 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/force-app/main/default/pages/RentalApplyQR.page b/force-app/main/default/pages/RentalApplyQR.page
index f368137..64ff787 100644
--- a/force-app/main/default/pages/RentalApplyQR.page
+++ b/force-app/main/default/pages/RentalApplyQR.page
@@ -23,7 +23,7 @@
                 record = sforce.connection.query("select Id from ContentDocument where Id in (" + idList + ") and Title = \'QRCode-{!Rental_Apply__c.Name}\'");
             }           
              // 鏃€伀銇傘倢銇扮劇瑕�
-             console.log("record.size--------888------------",record.size);
+             console.log("record.size--------888------------",record.size+'~'+record.getArray("records"));
             if (record.size == 0) {
                 console.log("record.size--------777------------",record.size);
                 var version = new sforce.SObject("ContentVersion");
@@ -53,27 +53,21 @@
                 result = sforce.connection.update([es]);
                 // window.location = '/' + '{!Rental_Apply__c.Id}';
             //鐢宠涔︽洿鏂板け璐ョ殑璇濆啀娆℃洿鏂�
-            } else if ("{!Rental_Apply__c.QRId__c}" == '' || "{!Rental_Apply__c.QRId__c}" == null) {
-                console.log("record.size--------666------------",record.size);
-                // var records = record.getArray("records");
-                // var es = new sforce.SObject("Rental_Apply__c");
-                // es.Id = "{!Rental_Apply__c.Id}";
-                // es.QRId__c = records[0].Id;
-                // result = sforce.connection.update([es]);
-                // TODO Name澶夈倧銈嬪彲鑳芥�с亗銈娿�乽psert銇仐銇俱仚
+            } else {
+                // 20240113 ljh update start 
                 var records = record.getArray("records");
+                console.log('zheliupdate:'+records[0].Id);
                 var version = new sforce.SObject("ContentVersion");
-                version = sforce.connection.query("select Id,ContentDocumentId from ContentVersion where ContentDocumentId = \'" + records[0].id + "\'");
+                version = sforce.connection.query("select Id,ContentDocumentId from ContentVersion where ContentDocumentId = \'" + records[0].Id + "\'");
                 version = version.getArray("records"); 
-                if(version[0].id != "{!Rental_Apply__c.QRId__c}"){
+                // 瀛樺湪qr鏃讹紝缁戝埌娓呭崟涓�
+                if(version[0].Id != "{!Rental_Apply__c.QRId__c}"){
                     var es = new sforce.SObject("Rental_Apply__c");
-                    es.Id = "{!Rental_Apply__c.Id}";
-                    es.QRId__c = version[0].id;
+                    es.Id =  "{!Rental_Apply__c.Id}";
+                    es.QRId__c = version[0].Id;
                     result = sforce.connection.update([es]);
                 }
-            } else {
-                
-                // alert(record[0].Id);
+                // 20240113 ljh update end
             }
             // //20231027 ymh娣诲姞娉ㄩ噴  lighting淇敼闄勪欢涓婁紶 end
         }

--
Gitblit v1.9.1