Option to ignore old CDRs, RT#81480
[freeside.git] / httemplate / edit / cgp_rule-vacation.html
1 <% include('/elements/header-popup.html', 'Vacation rule') %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM NAME="VacationForm" ACTION="process/cgp_rule-vacation.html" METHOD=POST>
6
7 <INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $opt{'svcnum'} %>">
8
9 <% ntable("#cccccc", 2) %>
10
11 <TR>
12   <TD ALIGN="right">Vacation message</TD>
13   <TD><textarea name="VacationText" rows="5" cols="50"><% $reply_with ? $reply_with->params : '' %></textarea></TD>
14 </TR>
15
16 <% include('/elements/tr-input-date-field.html', {
17              'label'  => 'Ends',
18              'name'   => 'vacationTill',
19              'format' => '%d %b %Y',
20              'value'  => ( $cgi->param('error')
21                              ? scalar($cgi->param('vacationTill'))
22                              : ( $curr_date ? $curr_date->params : '' )
23                          ),
24           })
25 %>
26
27 %#Clear 'Replied Addresses' List ?
28
29 </TABLE>
30
31 <BR>
32 <INPUT TYPE="submit" VALUE="<% $cgp_rule ? 'Edit' : 'Add' %> vacation message">
33
34 </FORM>
35
36 </BODY>
37 </HTML>
38 <%init>
39
40 my %opt = @_;
41
42 my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $opt{'svcnum'} } )
43   or die "unknown svcnum";
44
45 #look for existing rule
46 my $cgp_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum,
47                                       'name'   => '#Vacation'
48                                     }
49                        );
50
51 my( $curr_date, $reply_with ) = ( '', '' );
52 if ( $cgp_rule ) {
53   $curr_date = qsearchs('cgp_rule_condition', {
54     'rulenum'       => $cgp_rule->rulenum,
55     'conditionname' => 'Current Date',
56     'op'            => 'less than',
57   });
58   $reply_with = qsearchs('cgp_rule_action', {
59     'rulenum' => $cgp_rule->rulenum,
60     'action'  => 'Reply with',
61   });
62 }
63
64 </%init>