From f50c0ec115e25dc7f980bafda8169ed5ddfe1a8f Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 08 四月 2022 21:04:16 +0800
Subject: [PATCH] Session
---
force-app/main/default/pages/OpportunityOpenAlert.page | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 114 insertions(+), 5 deletions(-)
diff --git a/force-app/main/default/pages/OpportunityOpenAlert.page b/force-app/main/default/pages/OpportunityOpenAlert.page
index 7d640ea..cd8f0a3 100644
--- a/force-app/main/default/pages/OpportunityOpenAlert.page
+++ b/force-app/main/default/pages/OpportunityOpenAlert.page
@@ -1,10 +1,119 @@
<apex:page standardController="Opportunity" showHeader="false" sidebar="false">
+ <apex:includeScript value="{!URLFOR($Resource.connection20)}"/>
+ <apex:includeScript value="{!URLFOR($Resource.apex20)}"/>
<script type="text/javascript">
- var stage = '{!Opportunity.Last_opportunity_file_stage__c}';
- var bid = '{!Opportunity.Bid_Date__c}';
- var closingbid = '{!Opportunity.Closing_Bid_Date__c}';
- if ((stage == 'A.涓爣閫氱煡/鎴浘' || stage == 'B.閲囪喘閫氱煡涔�') && (bid == '' || closingbid == '')) {
- alert('濉啓璇环涓殑鈥滄嫑鏍囨棩鈥濆拰鈥滀腑鏍囨棩鈥�');
+ var is_new = '{!Opportunity.IsNew__c}' == 'true';
+ var approval_status = '{!Opportunity.ApprovalStatus_D__c}';
+ var productSegment = '{!Opportunity.ProductSegment__c}';
+ var recordTypeId = '{!Opportunity.RecordTypeId}';
+
+ if (productSegment == 'BS' || productSegment == 'IE' || productSegment == 'RVI' || recordTypeId.substring(0,15) == '01228000000NJt5') {
+ if (approval_status == 'Pass' && '{!Opportunity.DealerSelectOwner__c}' != '{!Opportunity.OwnerId}') {
+ var oid = "{!Opportunity.Id}";
+ var uid = "{!Opportunity.OwnerId}";
+
+ var rac = new sforce.SObject("Opportunity");
+ rac.Id = "{!Opportunity.Id}";
+ rac.OwnerId = '{!Opportunity.DealerSelectOwner__c}';
+ var result = sforce.connection.update([rac]);
+ var messages = getConnectDMLErrorMessages(result);
+ if (messages.length > 0) {
+ alert(messages.join("\n"));
+ } else {
+ var rs = sforce.apex.execute("OpportunityWebService", "UpdateShare", {opportunityId: oid, userId: uid});
+ if (rs == '1') {
+ window.top.location.reload();
+ } else {
+ alert(rs);
+ }
+ }
+ }
+ } else {
+ var now_status = '{!Opportunity.Amount_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Budget_Amount_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Cancel_Reason_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Cancel_reason_IsChangedc__c}' == 'true' ||
+ '{!Opportunity.CloseDate_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Company_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product2_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product3_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product4_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product5_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product6_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product7_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product8_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product_Code_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product_Code2_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product_Code3_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product_Code4_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product_Code5_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product_Code6_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product_Code7_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Competitor_Product_Code8_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Dealer_Sales_Staff_Name_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Dealer_Service_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Expected_delivery_date_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Expected_Order_Date_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Inquiry_result_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Inquiry_result_cancel_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Inquiry_result_lost_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Inquiry_result_order_IsChanged__c}' == 'true' ||
+ '{!Opportunity.LeadSource_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Lost_competitor_product_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Lost_Reason_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Lost_reason_IsChangedc__c}' == 'true' ||
+ '{!Opportunity.New_Inquiry_Date_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Phase1Date_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Phase2Date_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Phase3Date_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Sales_Channel_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Sub_Dealer_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Trade_Type_IsChanged__c}' == 'true' ||
+ '{!Opportunity.Sub_Dealer_IsChanged__c}' == 'true';
+ if ((is_new || now_status) && approval_status != 'Submit') {
+ //alert("鏂板缓鎴栦慨鏀硅浠蜂俊鎭悗锛岃鍙婃椂鎻愪氦瀹℃壒銆�");
+ }
}
+ var syncquo = '{!Opportunity.SyncedQuote_No__c}';
+ var uploadquo = '{!Opportunity.the_Upload_of_quotation_number__c}';
+ if (uploadquo != '' && uploadquo != syncquo) {
+ alert("鍚屾鐨勬姤浠峰拰鏈�杩戜笂浼犵殑鎶ヤ环涓嶄竴鑷达紝璇蜂笂浼犲綋鍓嶅悓姝ョ殑鎶ヤ环銆�");
+ }
+
+
+function getConnectDMLErrorMessages(results) {
+var messages = [],
+i = 0,
+len = results.length,
+r;
+for (; i < len; i++) {
+r = results[i];
+if (! r.getBoolean("success")) {
+messages = messages.concat(getConnectDMLMessagesOfAResult(r));
+}
+}
+return messages;
+};
+function getConnectDMLMessagesOfAResult(res) {
+var messages = [],
+errors = res.getArray("errors"),
+i = 0,
+len = errors.length,
+e;
+for (; i < len; i++) {
+e = errors[i];
+messages.push(e.message + " " + getConnectDMLErrorFields(e));
+}
+return messages;
+};
+function getConnectDMLErrorFields(error) {
+var fields = error.getArray('fields');
+if (fields.length > 0) {
+return "[" + fields.join(",") + "]"
+} else {
+return "";
+}
+};
</script>
</apex:page>
\ No newline at end of file
--
Gitblit v1.9.1