From e8a09e945986a32f9b7d0a5d546142ada91654ca Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 4 Dec 2007 18:20:58 +0000 Subject: change credit reasons from freetext to new reason/reason type system (#2777) --- httemplate/elements/menu.html | 1 + httemplate/elements/tr-select-reason.html | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'httemplate/elements') diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 8f86dea0c..da8f58054 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -267,6 +267,7 @@ if ( $curuser->access_right('Configuration') ) { $config_billing{'View/Edit prepaid cards'} = [ $fsurl.'search/prepay_credit.html', 'View outstanding cards, generate new cards' ]; $config_billing{'View/Edit call rates and regions'} = [ $fsurl.'browse/rate.cgi', 'Manage rate plans, regions and prefixes for VoIP and call billing' ]; $config_billing{'View/Edit locales and tax rates'} = [ $fsurl.'browse/cust_main_county.cgi', 'Change tax rates, or break down a country into states, or a state into counties and assign different tax rates to each' ]; + $config_billing{'View/Edit credit reason types'} = [ $fsurl.'browse/reason_type.html?class=R', 'Credit reason types define groups of reasons, for reporting and convenience purposes.' ]; } tie my %config_dialup, 'Tie::IxHash', diff --git a/httemplate/elements/tr-select-reason.html b/httemplate/elements/tr-select-reason.html index 71997c221..23f31ec51 100755 --- a/httemplate/elements/tr-select-reason.html +++ b/httemplate/elements/tr-select-reason.html @@ -53,18 +53,39 @@ +% my @types = qsearch( 'reason_type', { 'class' => $class } ); +% if (scalar(@types) < 1) { # we should never reach this + + +

No reason types. Go add some.

+ + +% }elsif (scalar(@types) == 1) { + + +

Reason Type

+ + +

<% $types[0]->type %> + + + + +% }else{ +

Reason Type

+% } @@ -94,6 +115,9 @@ if ($class eq 'C') { } elsif ($class eq 'S') { $access_right = 'Suspend customer package'; $add_access_right = 'Add on-the-fly suspend reason'; +} elsif ($class eq 'S') { + $access_right = 'Post credit'; + $add_access_right = 'Add on-the-fly credit reason'; } else { die "illegal class: $class"; } @@ -113,7 +137,8 @@ if ($init_reason == -1 || ref($init_reason) ) { } -my $extra_sql = "WHERE class = '$class' ORDER BY reason_type"; +my $extra_sql = "WHERE class = '$class' and (disabled = '' OR disabled is NULL) ". + "ORDER BY reason_type"; my $curuser = $FS::CurrentUser::CurrentUser; -- cgit v1.2.1