Li Jun
2022-04-08 ac719375874fd50fad5a11f8e04ac3329081bd0b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Custom_Submit_BTN</fullName>
    <availability>online</availability>
    <description>{!RequireScript(&quot;/soap/ajax/30.0/connection.js&quot;)} 
{!RequireScript(&quot;/soap/ajax/30.0/apex.js&quot;)} 
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)} 
 
var foo = function() {
    if (!confirm(&quot;一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?&quot;)) {
        return;
    }
    //确认已经检查过完整性
    if (&apos;{!IS_Opportunity_Demand__c.Data_Check_TF__c}&apos; !=true ) {
        alert(&apos;请先在编辑页面,检查数据完整性,然后再执行提交&apos;);
        return;
    }
        if(&apos;{!IS_Opportunity_Demand__c.CAD_Upload_Date__c}&apos; == &apos;&apos;){
                alert(&apos;CAD未上传,需求表不能提交批准&apos;);
                return;
        }
    var submit = sforce.apex.execute(&apos;ControllerUtil&apos;,&apos;ISO_Submit_Func&apos;,{isoID:&apos;{!IS_Opportunity_Demand__c.Id}&apos;});
    if (submit != &apos;Fin&apos;) {
        alert(submit);
        return;
    }
    window.location.reload();
};
foo();</description>
    <displayType>button</displayType>
    <linkType>javascript</linkType>
    <masterLabel>提交审批</masterLabel>
    <openType>onClickJavaScript</openType>
    <protected>false</protected>
    <url>{!RequireScript(&quot;/soap/ajax/51.0/connection.js&quot;)} 
{!RequireScript(&quot;/soap/ajax/51.0/apex.js&quot;)} 
{!RequireScript(&quot;/resource/CommonUtilJs&quot;)} 
//2021-10-21 gwy 版本更改为51.0
var foo = function() {
    if (!confirm(&quot;一旦提交此记录以待批准,根据您的设置您可能不再能够编辑此记录或将他从批准过程中调回。是否继续?&quot;)) {
        return;
    }
    //确认已经检查过完整性
    //if (&apos;{!IS_Opportunity_Demand__c.Data_Check_TF__c}&apos; !=true ) {
        //alert(&apos;请先在编辑页面,检查数据完整性,然后再执行提交&apos;);
        //return;
    //}
        if (&apos;{!IS_Opportunity_Demand__c.Data_Check_TF__c}&apos; !=true ) {
        alert(&apos;请营业担当提交审批!&apos;);
        return;
    }
        //状态为终止的不能提交审批
        if(&apos;{!IS_Opportunity_Demand__c.Func_SOD_Status__c}&apos; == &apos;00 已终止&apos;){
                alert(&apos;需求表已终止不能提交审批&apos;);
                return;
        }
        //取消CAD上传的限制 by vivek 2019-10-28 start
        //if(&apos;{!IS_Opportunity_Demand__c.CAD_Upload_Date__c}&apos; == &apos;&apos;){
        //        alert(&apos;CAD未上传,需求表不能提交批准&apos;);
        //        return;
        //}
        //取消CAD上传的限制 by vivek 2019-10-28 end
        //CHAN-BEN68Z 【委托】SI项目需求表权限控制优化 start
        window.$Label = window.$Label || {};
        $Label.customLabel= &apos;{!($Label.ProfileId_SystemAdmin)}&apos;;
        var label =  $Label.customLabel;
        
        sforce.connection.sessionId = &quot;{!$Api.Session_ID}&quot;; 
        var isopd = new sforce.SObject(&quot;IS_Opportunity_Demand__c&quot;); 
        isopd.Id = &quot;{!IS_Opportunity_Demand__c.Id}&quot;; 
        isopd.Submint_TF__c = true; 
        try { 
                var result = sforce.connection.update([isopd]); 
                var messages = getConnectDMLErrorMessages(result); 
                if (messages.length &gt; 0) { 
                        alert(messages.join(&quot;\n&quot;)); 
                        return; 
                } 
        } catch (err) { 
                if(err.faultstring !=undefined &amp;&amp; err.faultstring.indexOf(&apos;INVALID_SESSION_ID&apos;) != -1) { 
                        alert(&apos;当前网页已登出,请您重新登录后刷新该网页!&apos;); 
                } else { 
                        alert(err.faultstring); 
                } 
                return; 
        }
        
        //CHAN-BEN68Z 【委托】SI项目需求表权限控制优化 end
    window.location.reload();
};
foo();</url>
</WebLink>