[freeside-commits] freeside/httemplate/edit cgp_rule-redirect_all.html, 1.1.2.2, 1.1.2.3 cgp_rule-vacation.html, 1.1.2.2, 1.1.2.3
Ivan,,,
ivan at wavetail.420.am
Thu Aug 5 17:45:31 PDT 2010
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv6156/httemplate/edit
Modified Files:
Tag: FREESIDE_1_9_BRANCH
cgp_rule-redirect_all.html cgp_rule-vacation.html
Log Message:
communigate account rules: vacation & redirect all, RT#7514
Index: cgp_rule-redirect_all.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cgp_rule-redirect_all.html,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -w -d -r1.1.2.2 -r1.1.2.3
--- cgp_rule-redirect_all.html 26 Jul 2010 22:59:04 -0000 1.1.2.2
+++ cgp_rule-redirect_all.html 6 Aug 2010 00:45:29 -0000 1.1.2.3
@@ -1,37 +1,49 @@
<% include('/elements/header-popup.html', 'Redirect all mail') %>
+<% include('/elements/error.html') %>
+
<FORM NAME="RedirectAllForm" ACTION="process/cgp_rule-redirect_all.html" METHOD=POST>
-%# XXX upstream Redirect 1
+<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $opt{'svcnum'} %>">
<% ntable("#cccccc", 2) %>
<TR>
<TD ALIGN="right">Redirect all mail to</TD>
- <TD><textarea name="RedirectText" rows="5" cols="50"></textarea></TD>
+ <TD><textarea name="RedirectText" rows="5" cols="50"><% $mirror_or_redir ? $mirror_or_redir->params : '' %></textarea></TD>
</TR>
<% include('/elements/tr-checkbox.html',
- 'name' => 'RedirKeep',
+ 'field' => 'RedirKeep',
'label' => 'Keep a copy',
'value' => 1,
- 'curr_value' => '', #XXX
+ 'curr_value' => ( $cgi->param('error')
+ ? scalar($cgi->param('RedirKeep'))
+ : ( ($redir_keep || !$cgp_rule) ? '' : 1 )
+ ),
)
%>
<% include('/elements/tr-checkbox.html',
- 'name' => 'RedirHuman',
+ 'field' => 'RedirHuman',
'label' => 'Do not redirect automatic messages',
'value' => 1,
- 'curr_value' => '', #XXX
+ 'curr_value' => ( $cgi->param('error')
+ ? scalar($cgi->param('RedirHuman'))
+ : ( $redir_human ? 1 : '' )
+ ),
)
%>
<% include('/elements/tr-checkbox.html',
- 'name' => 'KeepToAndCc',
+ 'field' => 'KeepToAndCc',
'label' => 'Preserve To/Cc fields',
'value' => 1,
- 'curr_value' => '', #XXX
+ 'curr_value' => ( $cgi->param('error')
+ ? scalar($cgi->param('KeepToAndCc'))
+ : ( $mirror_or_redir &&
+ $mirror_or_redir->action eq 'Mirror To' )
+ ),
)
%>
@@ -39,7 +51,6 @@
<BR>
<INPUT TYPE="submit" VALUE="Redirect all mail">
-%#XXX Add/Edit
</FORM>
@@ -52,6 +63,27 @@
my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $opt{'svcnum'} } )
or die "unknown svcnum";
-#XXX look for existing redirect all rule
+#look for existing rule
+my $cgp_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum,
+ 'name' => '#Redirect'
+ }
+ );
+
+my( $redir_human, $mirror_or_redir, $redir_keep ) = ( '', '', '' );
+if ( $cgp_rule ) {
+ $redir_human = qsearchs('cgp_rule_condition', {
+ 'rulenum' => $cgp_rule->rulenum,
+ 'conditionname' => 'Human Generated',
+ });
+ $mirror_or_redir = qsearchs({
+ 'table' => 'cgp_rule_action',
+ 'hashref' => { 'rulenum' => $cgp_rule->rulenum, },
+ 'extra_sql' => " AND action IN ('Mirror To', 'Redirect To') ",
+ });
+ $redir_keep = qsearchs('cgp_rule_action', {
+ 'rulenum' => $cgp_rule->rulenum,
+ 'action' => 'Discard',
+ });
+}
</%init>
Index: cgp_rule-vacation.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cgp_rule-vacation.html,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -w -d -r1.1.2.2 -r1.1.2.3
--- cgp_rule-vacation.html 26 Jul 2010 22:59:04 -0000 1.1.2.2
+++ cgp_rule-vacation.html 6 Aug 2010 00:45:29 -0000 1.1.2.3
@@ -1,35 +1,35 @@
<% include('/elements/header-popup.html', 'Vacation rule') %>
+<% include('/elements/error.html') %>
+
<FORM NAME="VacationForm" ACTION="process/cgp_rule-vacation.html" METHOD=POST>
-%# XXX upstream Vacation 1
+<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"></textarea></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',
- 'value' => '', #XXX
+ 'format' => '%d %b %Y',
+ 'value' => ( $cgi->param('error')
+ ? scalar($cgi->param('vacationTill'))
+ : ( $curr_date ? $curr_date->params : '' )
+ ),
})
%>
-%# XXX upstream:
-%# VacationTill 1
-%# vacationDay
-%# vacationMonth
-%# vacationYear
-%#XXX Clear 'Replied Addresses' List
+%#Clear 'Replied Addresses' List ?
</TABLE>
<BR>
-<INPUT TYPE="submit" VALUE="Add vacation message">
-%#XXX Add/Edit
+<INPUT TYPE="submit" VALUE="<% $cgp_rule ? 'Edit' : 'Add' %> vacation message">
</FORM>
@@ -42,6 +42,23 @@
my $svc_acct = qsearchs('svc_acct', { 'svcnum' => $opt{'svcnum'} } )
or die "unknown svcnum";
-#XXX look for existing vacation rule
+#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>
More information about the freeside-commits
mailing list