diff options
author | Mark Wells <mark@freeside.biz> | 2015-11-05 15:24:38 -0800 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-11-05 15:56:18 -0800 |
commit | 5ac8279c29897a5dc620047b5579f83a7ed0ae9c (patch) | |
tree | 9b587d8d2111bb1eb8ebcde511a8c7edf272c382 /httemplate | |
parent | 4f223dd481c3a9c7816bed964ff45171f9b5d014 (diff) |
UI cleanup for separate reason classes, #38532
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/browse/reason_type.html | 89 | ||||
-rw-r--r-- | httemplate/elements/menu.html | 19 |
2 files changed, 62 insertions, 46 deletions
diff --git a/httemplate/browse/reason_type.html b/httemplate/browse/reason_type.html index 6b444bad1..0cb6e7a39 100644 --- a/httemplate/browse/reason_type.html +++ b/httemplate/browse/reason_type.html @@ -1,49 +1,62 @@ -<% include( 'elements/browse.html', - 'title' => ucfirst($classname) . " Reason Types", - 'menubar' => [ ucfirst($classname) . " reasons" => - $p.'browse/reason.html?class=' . $class, - ], - 'html_init' => $html_init, - 'name' => $classname . " reason types", - 'query' => { 'table' => 'reason_type', - 'hashref' => {}, - 'extra_sql' => $where_clause . - 'ORDER BY typenum', - }, - 'count_query' => $count_query, - 'header' => [ '#', - ucfirst($classname) . ' Reason Type', - ucfirst($classname) . ' Reasons', - ], - 'fields' => [ 'typenum', - 'type', - $reasons_sub, - ], - 'links' => [ $link, - $link, - '', - ], - ) -%> +<& elements/browse.html, + 'title' => ucwords($classname) . " Reasons", + 'html_init' => $html_init, + 'name' => $classname . " reason types", + 'query' => { 'table' => 'reason_type', + 'hashref' => {}, + 'extra_sql' => $where_clause . + 'ORDER BY typenum', + }, + 'count_query' => $count_query, + 'header' => [ '#', + ucwords($classname) . ' Reason Type', + ucwords($classname) . ' Reasons', + ], + 'fields' => [ 'typenum', + 'type', + $reasons_sub, + ], + 'links' => [ $link, + $link, + '', + ], + 'disable_total' => 1, +&> <%init> +sub ucwords { + join(' ', map ucfirst($_), split(/ /, shift)); +} + die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); $cgi->param('class') =~ /^(\w)$/ or die "illegal class"; my $class=$1; -my $classname = $FS::reason_type::class_name{$class}; +my $classname = ucfirst($FS::reason_type::class_name{$class}); + +my $html_init = 'Reasons: ' . + include('/elements/menubar.html', + map { + ucfirst($FS::reason_type::class_name{$_}), + $p.'browse/reason_type.html?class=' . $_ + } keys (%FS::reason_type::class_name) + ); -my $html_init = ucfirst($classname) . - " reason types allow groups of $classname reasons for reporting purposes." . - qq!<BR><BR><A HREF="${p}edit/reason_type.html?class=$class"><I>Add a ! . - $classname . " reason type</I></A><BR><BR>"; +$html_init .= '<BR><P>' . + $classname . ' reasons ' . + $FS::reason_type::class_purpose{$class} . + '. Reason types allow reasons to be grouped for reporting purposes.' . + qq!<BR><BR><A HREF="${p}edit/reason_type.html?class=$class"><I>! . + ($classname =~ /^[aeiou]/i ? 'Add an ' : 'Add a ') . + lc($classname) . ' reason type</I></A>'. + '</P>'; my $reasons_sub = sub { my $reason_type = shift; - [ map { + [ ( map { [ { 'data' => $_->reason, @@ -53,7 +66,15 @@ my $reasons_sub = sub { }, ]; } - $reason_type->enabled_reasons, + $reason_type->enabled_reasons ), + [ + { + 'data' => '(add)', + 'align' => 'left', + 'link' => $p. "edit/reason.html?class=$class", + 'data_style' => 'i', + } + ] ]; diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 81c121259..fa44e86e7 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -621,10 +621,8 @@ $config_export_svc{'Hardware types'} = [ $fsurl.'browse/hardware_class.html', 'S if $curuser->access_right('Configuration'); tie my %config_pkg_reason, 'Tie::IxHash', - 'Cancel reasons' => [ $fsurl.'browse/reason.html?class=C', 'Cancel reasons explain why a service was cancelled.' ], - 'Cancel reason types' => [ $fsurl.'browse/reason_type.html?class=C', 'Cancel reason types define groups of reasons.' ], - 'Suspend reasons' => [ $fsurl.'browse/reason.html?class=S', 'Suspend reasons explain why a service was suspended.' ], - 'Suspend reason types' => [ $fsurl.'browse/reason_type.html?class=S', 'Suspend reason types define groups of reasons.' ], + 'Cancel reasons' => [ $fsurl.'browse/reason_type.html?class=C', 'Cancel reasons explain why a service was cancelled.' ], + 'Suspend reasons' => [ $fsurl.'browse/reason_type.html?class=S', 'Suspend reasons explain why a service was suspended.' ], ; tie my %config_pkg, 'Tie::IxHash', (); @@ -715,16 +713,13 @@ if ( $curuser->access_right('Configuration') ) { } $config_billing{'separator4'} = ''; #its a separator! - $config_billing{'Credit reasons'} = [ $fsurl.'browse/reason.html?class=R', 'Credit reasons explain why a credit was issued.' ]; - $config_billing{'Credit reason types'} = [ $fsurl.'browse/reason_type.html?class=R', 'Credit reason types define groups of reasons.' ]; + $config_billing{'Credit reasons'} = [ $fsurl.'browse/reason_type.html?class=R', 'Credit reasons explain why a credit was issued.' ]; - $config_billing{'separator5'} = ''; #its a separator! - $config_billing{'Refund reasons'} = [ $fsurl.'browse/reason.html?class=F', 'Refund reasons explain why a refund was issued.' ]; - $config_billing{'Refund reason types'} = [ $fsurl.'browse/reason_type.html?class=F', 'Refund reason types define groups of reasons.' ]; + $config_billing{'Refund reasons'} = [ $fsurl.'browse/reason_type.html?class=F', 'Refund reasons explain why a refund was issued.' ]; - $config_billing{'separator6'} = ''; #its a separator! - $config_billing{'Void reasons'} = [ $fsurl.'browse/reason.html?class=X', 'Void reasons explain why a void was issued.' ]; - $config_billing{'Void reason types'} = [ $fsurl.'browse/reason_type.html?class=X', 'Void reason types define groups of reasons.' ]; + $config_billing{'Invoice void reasons'} = [ $fsurl.'browse/reason_type.html?class=I', 'Invoice void reasons explain why an invoice was voided.' ]; + $config_billing{'Payment void reasons'} = [ $fsurl.'browse/reason_type.html?class=P', 'Payment void reasons explain why a payment was voided.' ]; + $config_billing{'Credit void reasons'} = [ $fsurl.'browse/reason_type.html?class=X', 'Credit void reasons explain why a credit was voided.' ]; } #XXX also to be unified |