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
<?xml version="1.0" encoding="UTF-8"?>
<WebLink xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>submit_Extension_approval_process</fullName>
    <availability>online</availability>
    <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-22 gwy 版本更改为51.0
var foo = function() {
    var buttons = document.getElementsByName(&apos;submit_Extension_approval_process&apos;.toLowerCase());
    for (var i=0; i&lt;buttons.length; i++) {
        buttons[i].className = &quot;btnDisabled&quot;;
        buttons[i].disabled = true;
    }
 
    //追加备品申请状态确认,已经提交过的申请,不能重复提交Status__c
    if (&apos;{!Rental_Apply__c.ExtensionStatus__c}&apos; == &apos;填写完毕&apos; ||
        &apos;{!Rental_Apply__c.ExtensionStatus__c}&apos; == &apos;申请中&apos;) {
        alert(&apos;请确认延期申请状态,已经提交过的申请,不能重复提交&apos;);
        return;
    }
    //update    批量延期和办事处延期              2021/11/26         wangweipeng      start
    var raid = &quot;{!Rental_Apply__c.Id}&quot;;
    var rs1 = sforce.apex.execute(&quot;RentalApplyWebService&quot;, &quot;extension_approval_processCheck&quot;, {rentalApplyId: raid}); 
    if (rs1 != &apos;1&apos;) {
        if(rs1 == &apos;2&apos;){
            //返回值为2,判断入口为从单还是主单,如果是从单,那么就需要跳原来的单个延期页面
            if(&apos;{!Rental_Apply__c.Root_Rental_Apply__c}&apos; == &apos;&apos; || &apos;{!Rental_Apply__c.Root_Rental_Apply__c}&apos; == null){
                window.open(&quot;/apex/RentalApplyMultiPostpone?parentId={!Rental_Apply__c.Id}&quot;);
            }else{
                window.open(&quot;/apex/RentalApplyExtensions?parentId={!Rental_Apply__c.Id}&quot;);
            }
        }else{
            alert(rs1);
            return;
        }
    }else{
        if(&apos;{!Rental_Apply__c.demo_purpose2__c}&apos; == &apos;协议借用&apos;) {
            alert(&apos;请在[附件]内上传新的合同附件,并依据合同内期限进行日期填写,之后提交审批&apos;);
            if (&apos;{!Rental_Apply__c.AgreementBorrowingExtensionDate__c}&apos; == &apos;&apos; || &apos;{!Rental_Apply__c.AgreementBorrowingExtensionDate__c}&apos; == null) {
                alert(&apos;协议借用的延期申请的【协议借用延期日期】不能为空&apos;);
                return;
            }
            if (&apos;{!Rental_Apply__c.AgreementBorrowingExtensionDate__c}&apos; &lt;= &apos;{!Rental_Apply__c.Return_dadeline_final__c}&apos;) {
                alert(&apos;协议借用的延期申请的【协议借用延期日期】必须大于最新预定归还日&apos;);
                return;
            }
            if (&apos;{!Rental_Apply__c.AgreementBorrowingExtensionDate__c}&apos; &lt;= {!TODAY()}) {
                alert(&apos;协议借用的延期申请的【协议借用延期日期】必须大于今天&apos;);
                return;
            }
        }
        //window.open(&quot;/apex/RentalApplyExtensions?parentId={!URLENCODE(Rental_Apply__c.Id)}&quot;);
        window.open(&quot;/apex/RentalApplyExtensions?parentId={!Rental_Apply__c.Id}&quot;);
    }
    //update    批量延期和办事处延期              2021/11/26         wangweipeng      start
};
foo();</url>
</WebLink>