From 824b97e97e4e5ee914a4c936815a4413def71a4f Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 5 Aug 2010 00:24:57 +0000 Subject: error message in decline templates, RT#9507 --- httemplate/edit/msg_template.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate/edit') diff --git a/httemplate/edit/msg_template.html b/httemplate/edit/msg_template.html index 67eae185d..c38c40e4a 100644 --- a/httemplate/edit/msg_template.html +++ b/httemplate/edit/msg_template.html @@ -51,6 +51,7 @@ my %substitutions = ( '$ucfirst_cust_status' => 'Status, capitalized', '$cust_statuscolor' => 'Status color code', '$company_name' => 'Our company name', + '$company_address'=> 'Our company address', ], 'contact' => [ # duplicate this for shipping '$name' => 'Company and contact name', @@ -101,6 +102,7 @@ my %substitutions = ( '$payby' => 'Payment method', '$date' => 'Payment date', '$payinfo' => 'Card/account# (masked)', + '$error' => 'Decline reason', ], ); my @c = @{ $substitutions{'contact'} }; -- cgit v1.2.1 From 0715eb639658bfde2c21c39cd5ccaf4bf22b18d4 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 6 Aug 2010 00:45:29 +0000 Subject: communigate account rules: vacation & redirect all, RT#7514 --- httemplate/edit/cgp_rule-redirect_all.html | 52 +++++++++++++++++---- httemplate/edit/cgp_rule-vacation.html | 45 ++++++++++++------ httemplate/edit/process/cgp_rule-redirect_all.html | 24 ++++++++++ httemplate/edit/process/cgp_rule-simplified.html | 53 ++++++++++++++++++++++ httemplate/edit/process/cgp_rule-vacation.html | 29 ++++++++++++ 5 files changed, 179 insertions(+), 24 deletions(-) create mode 100644 httemplate/edit/process/cgp_rule-redirect_all.html create mode 100644 httemplate/edit/process/cgp_rule-simplified.html create mode 100644 httemplate/edit/process/cgp_rule-vacation.html (limited to 'httemplate/edit') diff --git a/httemplate/edit/cgp_rule-redirect_all.html b/httemplate/edit/cgp_rule-redirect_all.html index 898eef8fc..c8c9e010c 100644 --- a/httemplate/edit/cgp_rule-redirect_all.html +++ b/httemplate/edit/cgp_rule-redirect_all.html @@ -1,37 +1,49 @@ <% include('/elements/header-popup.html', 'Redirect all mail') %> +<% include('/elements/error.html') %> +
-%# XXX upstream Redirect 1 + <% ntable("#cccccc", 2) %> Redirect all mail to - + <% 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 @@
-%#XXX Add/Edit
@@ -52,6 +63,27 @@ my %opt = @_; 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', + }); +} diff --git a/httemplate/edit/cgp_rule-vacation.html b/httemplate/edit/cgp_rule-vacation.html index efdc5417e..8c288852b 100644 --- a/httemplate/edit/cgp_rule-vacation.html +++ b/httemplate/edit/cgp_rule-vacation.html @@ -1,35 +1,35 @@ <% include('/elements/header-popup.html', 'Vacation rule') %> +<% include('/elements/error.html') %> +
-%# XXX upstream Vacation 1 + <% ntable("#cccccc", 2) %> Vacation message - + <% include('/elements/tr-input-date-field.html', { - 'label' => 'Ends', - 'name' => 'vacationTill', - 'value' => '', #XXX + 'label' => 'Ends', + 'name' => 'vacationTill', + '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 ?
- -%#XXX Add/Edit +
@@ -42,6 +42,23 @@ my %opt = @_; 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', + }); +} diff --git a/httemplate/edit/process/cgp_rule-redirect_all.html b/httemplate/edit/process/cgp_rule-redirect_all.html new file mode 100644 index 000000000..162d857c2 --- /dev/null +++ b/httemplate/edit/process/cgp_rule-redirect_all.html @@ -0,0 +1,24 @@ +<% 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' } ) + ), + ], + ) +%> diff --git a/httemplate/edit/process/cgp_rule-simplified.html b/httemplate/edit/process/cgp_rule-simplified.html new file mode 100644 index 000000000..60769d4e6 --- /dev/null +++ b/httemplate/edit/process/cgp_rule-simplified.html @@ -0,0 +1,53 @@ +% 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') %> + + + + +% } +<%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 +} + + diff --git a/httemplate/edit/process/cgp_rule-vacation.html b/httemplate/edit/process/cgp_rule-vacation.html new file mode 100644 index 000000000..f10d72b73 --- /dev/null +++ b/httemplate/edit/process/cgp_rule-vacation.html @@ -0,0 +1,29 @@ +<% 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', + }, + ], + ) +%> -- cgit v1.2.1 From d311f62f655dc5cad8b9319f07f8c0e6bf344cc2 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 6 Aug 2010 21:28:09 +0000 Subject: communigate phase 3: archive messages, RT#7515 --- httemplate/edit/part_svc.cgi | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'httemplate/edit') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 6fe015ab5..7f2e3aa3c 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -291,12 +291,22 @@ that field. % (grep(/^$rvalue$/, split(',',$value)) ? ' SELECTED>' : '>' ). % $record->$select_label(). ''; % } #next $record -% } else { # select_list +% } elsif ( $def->{select_list} ) { % foreach my $item ( @{$def->{select_list}} ) { % $html .= qq!'; % } #next $item +% } elsif ( $def->{select_hash} ) { +% $def->{select_hash} = tie %{ $def->{select_hash} }, +% 'Tie::IxHash', +% @{ $def->{select_hash} } +% if ref($def->{select_hash}) eq 'ARRAY'; +% foreach my $key ( keys %{$def->{select_hash}} ) { +% $html .= qq!'; +% } #next $key % } #endif % $html .= ''; % -- cgit v1.2.1 From 89da4b96c4e2fce7079be8d2729750c088f8035b Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 6 Aug 2010 21:31:04 +0000 Subject: communigate phase 3: archive messages, RT#7515 --- httemplate/edit/part_svc.cgi | 8 +- httemplate/edit/svc_acct.cgi | 222 +---------------- httemplate/edit/svc_acct/communigate.html | 249 +++++++++++++++++++ httemplate/edit/svc_domain.cgi | 272 +-------------------- .../edit/svc_domain/communigate-acct_defaults.html | 223 +++++++++++++++++ httemplate/edit/svc_domain/communigate-basics.html | 82 +++++++ 6 files changed, 577 insertions(+), 479 deletions(-) create mode 100644 httemplate/edit/svc_acct/communigate.html create mode 100644 httemplate/edit/svc_domain/communigate-acct_defaults.html create mode 100644 httemplate/edit/svc_domain/communigate-basics.html (limited to 'httemplate/edit') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 7f2e3aa3c..940ea8d25 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -298,10 +298,10 @@ that field. % $item. ''; % } #next $item % } elsif ( $def->{select_hash} ) { -% $def->{select_hash} = tie %{ $def->{select_hash} }, -% 'Tie::IxHash', -% @{ $def->{select_hash} } -% if ref($def->{select_hash}) eq 'ARRAY'; +% if ( ref($def->{select_hash}) eq 'ARRAY' ) { +% tie my %hash, 'Tie::IxHash', @{ $def->{select_hash} }; +% $def->{select_hash} = \%hash; +% } % foreach my $key ( keys %{$def->{select_hash}} ) { % $html .= qq!