From c8bdf37b4d6d1496b217a0af7114c4a86a1348fc Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Aug 2010 02:57:15 +0000 Subject: cleaner timeworked results w/link to customer --- httemplate/misc/timeworked.html | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/timeworked.html b/httemplate/misc/timeworked.html index 46063e8..5c3c955 100755 --- a/httemplate/misc/timeworked.html +++ b/httemplate/misc/timeworked.html @@ -8,22 +8,11 @@ - Trans Ticket - Time + Hours Customer Multiplier - - - # - # - Subject - hours - # - Name - - @@ -35,9 +24,9 @@ % my ($custnum, $name) = split(':', pop @customers, 2); % my $link = $p. 'rt/Ticket/Display.html?id='. $ticketmap{$tr_id}. % '#txn-'. $tr_id; +% my $clink = $p. 'view/cust_main.cgi?'. $custnum; - <% $tr_id %> <% $ticketmap{$tr_id} %> <% $ticket{$ticketmap{$tr_id}} |h %> @@ -47,8 +36,8 @@ % } <% sprintf("%0.2f", $seconds/3600) %> - <% $custnum %> - <% $name %> + <% $custnum %> + <% $name %> @@ -67,7 +56,7 @@ % ($custnum, $name) = split(':', $_, 2); - <% $custnum %> + <% $custnum %> <% $name %> -- cgit v1.1 From 746eb018918ec4660870c79d0ff907fe0920696a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Aug 2010 02:58:47 +0000 Subject: cleaner timeworked results w/link to customer --- httemplate/misc/timeworked.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/timeworked.html b/httemplate/misc/timeworked.html index 5c3c955..672fad8 100755 --- a/httemplate/misc/timeworked.html +++ b/httemplate/misc/timeworked.html @@ -54,10 +54,11 @@ % foreach ( @customers ) { % ($custnum, $name) = split(':', $_, 2); +% $clink = $p. 'view/cust_main.cgi?'. $custnum; - <% $custnum %> - <% $name %> + <% $custnum %> + <% $name %> % $multiplier = $default_multiplier; -- cgit v1.1 From 720cf723d2c8e88760704e2fdc50ebf48e0574f2 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 3 Aug 2010 03:30:20 +0000 Subject: customer view tab for an external info page, RT#8903 --- httemplate/misc/custom_link_proxy.cgi | 24 ++++++++++++++++++++++++ httemplate/view/cust_main.cgi | 6 ++++++ httemplate/view/cust_main/custom.html | 21 +++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 httemplate/misc/custom_link_proxy.cgi create mode 100644 httemplate/view/cust_main/custom.html (limited to 'httemplate') diff --git a/httemplate/misc/custom_link_proxy.cgi b/httemplate/misc/custom_link_proxy.cgi new file mode 100644 index 0000000..e5934e4 --- /dev/null +++ b/httemplate/misc/custom_link_proxy.cgi @@ -0,0 +1,24 @@ +% if( $response->is_success ) { +<% $response->decoded_content %> +% } +% else { +<% $response->error_as_HTML %> +% } +<%init> + +my( $custnum ) = $cgi->param('custnum'); +my $cust_main = qsearchs('cust_main', { custnum => $custnum } ) + or die "custnum '$custnum' not found"; # just check for existence + +my $conf = new FS::Conf; +my $url = $conf->config('cust_main-custom_link') . $cust_main->custnum; +#warn $url; + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('View customer'); + +my $ua = new LWP::UserAgent; +my $response = $ua->get($url); + diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index f6bef43..0b6148d 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -233,6 +233,10 @@ Comments <% include('cust_main/change_history.html', $cust_main ) %> % } +% if ( $view eq 'custom' ) { +<% include('cust_main/custom.html', $cust_main ) %> +% } + <% include('/elements/footer.html') %> <%init> @@ -273,6 +277,8 @@ $views{'Payment History'} = 'payment_history' unless $conf->config('payby-default' eq 'HIDE'); $views{'Change History'} = 'change_history' if $curuser->access_right('View customer history'); +$views{$conf->config('cust_main-custom_title') || 'Custom'} = 'custom' + if $conf->config('cust_main-custom_link'); $views{'Jumbo'} = 'jumbo'; my %viewname = reverse %views; diff --git a/httemplate/view/cust_main/custom.html b/httemplate/view/cust_main/custom.html new file mode 100644 index 0000000..8e2e07b --- /dev/null +++ b/httemplate/view/cust_main/custom.html @@ -0,0 +1,21 @@ + + +<%init> + +my( $cust_main ) = @_; + +my $proxyurl = $p.'/misc/custom_link_proxy.cgi?custnum='.$cust_main->custnum; + -- cgit v1.1 From 3af040458de2eb5825dc4a9718a1a289cedaa706 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Aug 2010 18:00:22 +0000 Subject: spelling --- httemplate/search/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index e65dc71..93519b7 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -270,7 +270,7 @@ % $cgi->param('offset', 0); % print qq!( hide!; % } -% print ' cancelled customers )'; +% print ' canceled customers )'; % } % % if ( $cgi->param('referral_custnum') ) { -- cgit v1.1 From dfb6ad5c96f3a18553ef4b0e81d51c6bc5d44c92 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Aug 2010 23:12:06 +0000 Subject: don't allow addition of a domain rule template to itself, RT#7514 --- httemplate/browse/cgp_rule.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/browse/cgp_rule.html b/httemplate/browse/cgp_rule.html index 8a427b8..8ea7571 100644 --- a/httemplate/browse/cgp_rule.html +++ b/httemplate/browse/cgp_rule.html @@ -44,11 +44,12 @@ my $html_init = if ( $part_svc->svcdb eq 'svc_domain' ) { - #areyousure for adding these? + #XXX add areyousure javscript confirmation for adding these foreach my $line ( FS::Conf->new->config('cgp_rule-domain_templates') ) { $line =~ /^\s*(\d+)\s+(.+)\s*$/ or next; my($t_svcnum, $t_name) = ( $1, $2 ); + next if $t_svcnum == $svcnum; $html_init .= qq!! ."Add $t_name rule
"; -- cgit v1.1 From f936f59edf460c72f4e4c4da4d701b99f4456890 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Aug 2010 23:20:24 +0000 Subject: margin and padding css defined properly in px --- httemplate/elements/header.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html index 90ab0b7..c83529e 100644 --- a/httemplate/elements/header.html +++ b/httemplate/elements/header.html @@ -15,7 +15,6 @@ Example: #old-style include( '/elements/header.html', 'Title', $menubar, $etc, $head); - %# @@ -43,8 +42,8 @@ Example: <% $head |n %> - STYLE="margin-top:0; margin-bottom:0; margin-left:0; margin-right:0"> - + STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px"> +
+% foreach (@head) { + +% } + +% my $r=0; +% foreach my $row (@rows) { + +% foreach (@$row) { + +% } + +% $r++; +% } + +% foreach (@totals) { + +% } + +
freeside -- cgit v1.1 From 42a1267af992831cb8069835a18b8672a5f9afcb Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 4 Aug 2010 19:14:50 +0000 Subject: show cust_pay_pending attempted payments on customer payment history, RT#8815 --- httemplate/view/cust_main/payment_history.html | 10 ++++++ .../payment_history/attempted_payment.html | 41 ++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 httemplate/view/cust_main/payment_history/attempted_payment.html (limited to 'httemplate') diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 0dc4c41..60d33ac 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -422,6 +422,16 @@ foreach my $cust_pay_void ($cust_main->cust_pay_void) { } +#declined payments +foreach my $cust_pay_pending ($cust_main->cust_pay_pending_attempt) { + push @history, { + 'date' => $cust_pay_pending->_date, + 'desc' => include('payment_history/attempted_payment.html', $cust_pay_pending, %opt ), + 'void_payment' => $cust_pay_pending->paid, #?? + #'target' => $target, #XXX + }; +} + #credits (some false laziness w/payments) foreach my $cust_credit ($cust_main->cust_credit) { push @history, { diff --git a/httemplate/view/cust_main/payment_history/attempted_payment.html b/httemplate/view/cust_main/payment_history/attempted_payment.html new file mode 100644 index 0000000..554aa73 --- /dev/null +++ b/httemplate/view/cust_main/payment_history/attempted_payment.html @@ -0,0 +1,41 @@ +Payment attempt <% $info |h %> +<%init> + +my( $cust_pay_pending, %opt ) = @_; + +my $date_format = $opt{'date_format'} || '%m/%d/%Y'; + +my $curuser = $FS::CurrentUser::CurrentUser; + +my $payby = $cust_pay_pending->payby; + +my $payinfo; +if ( $payby eq 'CARD' ) { + $payinfo = $cust_pay_pending->paymask; +} elsif ( $payby eq 'CHEK' ) { + my( $account, $aba ) = split('@', $cust_pay_pending->paymask ); + $payinfo = "ABA $aba, Acct #$account"; +} else { + $payinfo = $cust_pay_pending->payinfo; +} + +$payby =~ s/^BILL$/Check #/ if $payinfo; +$payby =~ s/^CHEK$/Electronic check /; +$payby =~ s/^PREP$/Prepaid card /; +$payby =~ s/^CARD$/Credit card #/; +$payby =~ s/^COMP$/Complimentary by /; +$payby =~ s/^CASH$/Cash/; +$payby =~ s/^WEST$/Western Union/; +$payby =~ s/^MCRD$/Manual credit card/; +$payby =~ s/^BILL$//; +my $info = $payby ? "($payby$payinfo)" : ''; + +if ( $opt{'pkg-balances'} && $cust_pay_pending->pkgnum ) { + my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum'=>$cust_pay_pending->pkgnum } ); + $info .= ' for '. $cust_pkg->pkg_label_long; +} + +$info .= ': '. $cust_pay_pending->statustext + if length($cust_pay_pending->statustext); + + -- cgit v1.1 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') diff --git a/httemplate/edit/msg_template.html b/httemplate/edit/msg_template.html index 67eae18..c38c40e 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.1 From b93983d6758cd67b7bcb6c4118344981d8bb6e8d Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 5 Aug 2010 20:10:42 +0000 Subject: Package summary report, RT#8461 --- httemplate/elements/menu.html | 1 + httemplate/search/cust_pkg_summary.cgi | 87 +++++++++++++++++++++++++++++++++ httemplate/search/cust_pkg_summary.html | 24 +++++++++ 3 files changed, 112 insertions(+) create mode 100644 httemplate/search/cust_pkg_summary.cgi create mode 100644 httemplate/search/cust_pkg_summary.html (limited to 'httemplate') diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index a5bcdeb..2404ef2 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -207,6 +207,7 @@ if ( $curuser->access_right('Financial reports') ) { $report_packages{'separator2'} = ''; } $report_packages{'All customer packages'} = [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ]; +$report_packages{'Package summary'} = [ $fsurl.'search/cust_pkg_summary.html', 'Show package sales summary', ]; $report_packages{'Suspended customer packages'} = [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ]; $report_packages{'Customer packages with unconfigured services'} = [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ]; $report_packages{'FCC Form 477 packages'} = [ $fsurl.'search/report_477.html', 'Summarize packages by census tract for particular types' ] diff --git a/httemplate/search/cust_pkg_summary.cgi b/httemplate/search/cust_pkg_summary.cgi new file mode 100644 index 0000000..fc71c81 --- /dev/null +++ b/httemplate/search/cust_pkg_summary.cgi @@ -0,0 +1,87 @@ +<% include('/elements/header.html', $title) %> +<% include('/elements/table-grid.html') %> +
<% $_ %>
<% $_ %>
<% $_ %>
+<%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('List packages'); + +my $title = 'Package Summary Report'; +my ($begin, $end) = FS::UI::Web::parse_beginning_ending($cgi); +if($begin > 0) { + $title = "$title (". + $cgi->param('beginning').' - '.$cgi->param('ending').')'; +} + +my @h_sql = FS::h_cust_pkg->sql_h_search($end); + +my ($end_sql, $addl_from) = @h_sql[1,3]; +$end_sql =~ s/ORDER BY.*//; # breaks aggregate queries + +my $begin_sql = $end_sql; +$begin_sql =~ s/$end/$begin/g; + +my $active_sql = FS::cust_pkg->active_sql; +my $suspended_sql = FS::cust_pkg->suspended_sql; +my @conds = ( + # SQL WHERE clauses for each column of the table. + " $begin_sql AND ($active_sql OR $suspended_sql)", + '', + " $end_sql AND ($active_sql OR $suspended_sql)", + " $end_sql AND $active_sql", + " $end_sql AND $suspended_sql", + ); + +$_ =~ s/\bcust_pkg/maintable/g foreach @conds; + +my @head = ('Package', 'Before Period', 'Sales', 'Total', 'Active', 'Suspended'); +my @rows = (); +my @totals = ('Total', 0, 0, 0, 0, 0); + +if( !$begin ) { + splice @conds, 1, 1; + splice @head, 1, 1; +} + +foreach my $part_pkg (qsearch('part_pkg', {} )) { + my @row = (); + next if !$part_pkg->freq; # exclude one-time packages + push @row, $part_pkg->pkg; + my $i=1; + foreach my $cond (@conds) { + if($cond) { + my $result = qsearchs({ + 'table' => 'h_cust_pkg', + 'hashref' => {}, + 'select' => 'count(*)', + 'addl_from' => $addl_from, + 'extra_sql' => 'WHERE pkgpart = '.$part_pkg->pkgpart.$cond, + }); + $row[$i] = $result->getfield('count'); + $totals[$i] += $row[$i]; + } + $i++; + } + $row[2] = $row[3]-$row[1]; + $totals[2] += $row[2]; + push @rows, \@row; +} + diff --git a/httemplate/search/cust_pkg_summary.html b/httemplate/search/cust_pkg_summary.html new file mode 100644 index 0000000..a0ef472 --- /dev/null +++ b/httemplate/search/cust_pkg_summary.html @@ -0,0 +1,24 @@ +<% include( '/elements/header.html', 'Package Summary Report' ) %> + +
+ + + + + + + + <% include ('/elements/tr-input-beginning_ending.html') %> + +
+ Search options +
+ +
+ + +
+ +<% include('/elements/footer.html') %> +<%init> + -- cgit v1.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 ++++++++++++ httemplate/view/svc_acct/communigate.html | 21 ++++++--- 6 files changed, 194 insertions(+), 30 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') diff --git a/httemplate/edit/cgp_rule-redirect_all.html b/httemplate/edit/cgp_rule-redirect_all.html index 898eef8..c8c9e01 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 efdc541..8c28885 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 0000000..162d857 --- /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 0000000..60769d4 --- /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 0000000..f10d72b --- /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', + }, + ], + ) +%> diff --git a/httemplate/view/svc_acct/communigate.html b/httemplate/view/svc_acct/communigate.html index 0f090fd..870744a 100644 --- a/httemplate/view/svc_acct/communigate.html +++ b/httemplate/view/svc_acct/communigate.html @@ -54,17 +54,16 @@ value=>$svc_acct->cgp_sendmdnmode ) %> %# vacation message -%#XXX finish me... do we need to search for specific rules -%# (and hide them?) need to see what CGP gives back after we've added a rule <% include('/elements/init_overlib.html') %> Vacation message + <% $vacation_rule ? 'Active' : '' %> <% include('/elements/popup_link.html', 'action' => $p.'edit/cgp_rule-vacation.html?'. 'svcnum='. $svc_acct->svcnum, - 'label' => '(add)', #XXX (edit) + 'label' => $vacation_rule ? '(edit)' : '(add)', 'actionlabel' => 'Vacation message', 'width' => 600, 'height' => 300, @@ -75,15 +74,15 @@ %# redirect all mail -%#XXX finish me... Redirect all mail + <% $redirect_rule ? 'Active' : '' %> <% include('/elements/popup_link.html', 'action' => $p.'edit/cgp_rule-redirect_all.html?'. 'svcnum='. $svc_acct->svcnum, - 'label' => '(add)', #XXX (edit) + 'label' => $redirect_rule ? '(edit)' : '(add)', 'actionlabel' => 'Redirect all mail', 'width' => 763, #'height' @@ -110,6 +109,16 @@ my $svc_acct = $opt{'svc_acct'}; #my $part_svc = $opt{'part_svc'}; my $rule_link = qq(View/edit mail rules'; + $svc_acct->svcnum. '">View/edit mail rules'; #'dum vim + +my $vacation_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum, + 'name' => '#Vacation' + } + ); + +my $redirect_rule = qsearchs('cgp_rule', { 'svcnum' => $svc_acct->svcnum, + 'name' => '#Redirect' + } + ); -- cgit v1.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') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 6fe015a..7f2e3aa 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.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 +++++++ httemplate/view/svc_acct/communigate.html | 8 + httemplate/view/svc_domain/acct_defaults.html | 8 + 8 files changed, 593 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') diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 7f2e3aa..940ea8d 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!