summaryrefslogtreecommitdiff
path: root/httemplate/edit/cgp_rule-vacation.html
blob: 8c288852ba0ac16ca2c5bb8d2a67cc25d6160163 (plain)
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
<% include('/elements/header-popup.html', 'Vacation rule') %>

<% include('/elements/error.html') %>

<FORM NAME="VacationForm" ACTION="process/cgp_rule-vacation.html" METHOD=POST>

<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $opt{'svcnum'} %>">

<% ntable("#cccccc", 2) %>

<TR>
  <TD ALIGN="right">Vacation message</TD>
  <TD><textarea name="VacationText" rows="5" cols="50"><% $reply_with ? $reply_with->params : '' %></textarea></TD>
</TR>

<% include('/elements/tr-input-date-field.html', {
             'label'  => 'Ends',
             'name'   => 'vacationTill',
             'format' => '%d %b %Y',
             'value'  => ( $cgi->param('error')
                             ? scalar($cgi->param('vacationTill'))
                             : ( $curr_date ? $curr_date->params : '' )
                         ),
          })
%>

%#Clear 'Replied Addresses' List ?

</TABLE>

<BR>
<INPUT TYPE="submit" VALUE="<% $cgp_rule ? 'Edit' : 'Add' %> vacation message">

</FORM>

</BODY>
</HTML>
<%init>

my %opt = @_;

my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $opt{'svcnum'} } )
  or die "unknown svcnum";

#look for existing rule
my $cgp_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum,
                                      'name'   => '#Vacation'
                                    }
                       );

my( $curr_date, $reply_with ) = ( '', '' );
if ( $cgp_rule ) {
  $curr_date = qsearchs('cgp_rule_condition', {
    'rulenum'       => $cgp_rule->rulenum,
    'conditionname' => 'Current Date',
    'op'            => 'less than',
  });
  $reply_with = qsearchs('cgp_rule_action', {
    'rulenum' => $cgp_rule->rulenum,
    'action'  => 'Reply with',
  });
}

</%init>