X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Freason_type.html;h=e5f42e8398cdb13a720aa3a7a455db2f4554367d;hb=d5988a9f7a3617de33da3058f2e9f1151b24420e;hp=6b444bad14d01e6304fb8a0349ceee1d75333e03;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git diff --git a/httemplate/browse/reason_type.html b/httemplate/browse/reason_type.html index 6b444bad1..e5f42e839 100644 --- a/httemplate/browse/reason_type.html +++ b/httemplate/browse/reason_type.html @@ -1,49 +1,65 @@ -<% 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, + 'html_form' => qq!
!, + 'html_foot' => $html_foot, +&> <%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!

Add a ! . - $classname . " reason type

"; +$html_init .= include('/elements/init_overlib.html'). + '

' . + $classname . ' reasons ' . + $FS::reason_type::class_purpose{$class} . + '. Reason types allow reasons to be grouped for reporting purposes.' . + qq!

! . + ($classname =~ /^[aeiou]/i ? 'Add an ' : 'Add a ') . + lc($classname) . ' reason type'. + '

'; my $reasons_sub = sub { my $reason_type = shift; - [ map { + [ ( map { [ { 'data' => $_->reason, @@ -51,9 +67,22 @@ my $reasons_sub = sub { 'link' => $p. "edit/reason.html?class=$class&reasonnum=". $_->reasonnum, }, + { + 'data' => q!!, + 'align' => 'right', + }, ]; } - $reason_type->enabled_reasons, + $reason_type->enabled_reasons ), + [ + { + 'data' => '(add)', + 'align' => 'left', + 'link' => $p. "edit/reason.html?class=$class", + 'data_style' => 'i', + }, + { 'data' => '' }, + ] ]; @@ -65,4 +94,13 @@ $count_query .= $where_clause; my $link = [ $p.'edit/reason_type.html?class='.$class.'&typenum=', 'typenum' ]; +my $html_foot = include('/search/elements/checkbox-foot.html', + onclick => include( '/elements/popup_link_onclick.html', + js_action => q!'! . "${p}misc/reason-merge.html?" . q!' + toCGIString()!, + actionlabel => 'Merge reasons', + ), + label => 'merge selected reasons', + minboxes => 2, +) . '
'; +