[freeside-commits] freeside/httemplate/edit/process cgp_rule-redirect_all.html, NONE, 1.1.2.2 cgp_rule-simplified.html, NONE, 1.1.2.2 cgp_rule-vacation.html, NONE, 1.1.2.2
Ivan,,,
ivan at wavetail.420.am
Thu Aug 5 17:45:31 PDT 2010
Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail.420.am:/tmp/cvs-serv6156/httemplate/edit/process
Added Files:
Tag: FREESIDE_1_9_BRANCH
cgp_rule-redirect_all.html cgp_rule-simplified.html
cgp_rule-vacation.html
Log Message:
communigate account rules: vacation & redirect all, RT#7514
--- NEW FILE: cgp_rule-simplified.html ---
% if ( $error ) { #redirect back to edit...
% $cgi->param('error', $error);
<% $cgi->redirect(popurl(3).'edit/'.$opt{'redirect'}.'?'. $cgi->query_string) %>
% } else { #success XXX better msg talking about vacation vs. redirect all
<% include('/elements/header-popup.html', 'Rule updated') %>
<SCRIPT TYPE="text/javascript">
window.top.location.reload();
</SCRIPT>
</BODY>
</HTML>
% }
<%init>
my %opt = @_;
my %hash = (
'svcnum' => scalar($cgi->param('svcnum')),
'name' => $opt{'name'},
);
my $cgp_rule = qsearchs('cgp_rule', \%hash);
my $error = '';
if ( $cgp_rule ) { #updating
$error = $cgp_rule->delete;
}
$cgp_rule = new FS::cgp_rule { %hash, 'priority' => $opt{'priority'} };
$error ||= $cgp_rule->insert;
foreach my $condition ( @{ $opt{'conditions'} } ) {
my $cgp_rule_condition = new FS::cgp_rule_condition {
%$condition,
'rulenum' => $cgp_rule->rulenum,
};
$error ||= $cgp_rule_condition->insert;
}
foreach my $action ( @{ $opt{'actions'} } ) {
my $cgp_rule_action = new FS::cgp_rule_action {
%$action,
'rulenum' => $cgp_rule->rulenum,
};
$error ||= $cgp_rule_action->insert;
}
unless ( $error ) {
my $export_error = $cgp_rule->svc_export;
die $export_error if $export_error; #error handling sucks wrt this... shouldn't happen though
}
</%init>
--- NEW FILE: cgp_rule-vacation.html ---
<% include('cgp_rule-simplified.html',
'name' => '#Vacation',
'priority' => 2,
'redirect' => 'cgp_rule-vacation.html',
'conditions' => [
{ conditionname => 'Human Generated', },
{ conditionname => 'From',
op => 'not in',
params => '#RepliedAddresses',
},
( $cgi->param('VacationTill')
? ( { conditionname => 'Current Date',
op => 'less than', #is less?
params => scalar($cgi->param('VacationTill')),
}
)
: ()
),
],
'actions' => [
{ action => 'Reply with',
params => scalar($cgi->param('VacationText')),
},
{ action => "Remember 'From' in",
params => 'RepliedAddresses',
},
],
)
%>
--- NEW FILE: cgp_rule-redirect_all.html ---
<% include('cgp_rule-simplified.html',
'name' => '#Redirect',
'priority' => 1,
'redirect' => 'cgp_rule-redirect_all.html',
'conditions' => [
( $cgi->param('RedirHuman')
? { conditionname => 'Human Generated', }
: ()
),
],
'actions' => [
{ action => ( $cgi->param('KeepToAndCc')
? 'Mirror To'
: 'Redirect To'
),
params => scalar($cgi->param('RedirectText')),
},
( $cgi->param('RedirKeep')
? ()
: ( { 'action' => 'Discard' } )
),
],
)
%>
More information about the freeside-commits
mailing list