X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-reason.html;h=c12962ee237f3b0551502c3dda5cc0e52c63837a;hb=3d7f98ef055d07d16512fb9bebe76f44da68eb56;hp=0c05ae74e674902114e54d37343e0fdd20c21639;hpb=9811b8ce65909a293810ddbcd8c9b5ca963fba01;p=freeside.git diff --git a/httemplate/elements/tr-select-reason.html b/httemplate/elements/tr-select-reason.html index 0c05ae74e..c12962ee2 100755 --- a/httemplate/elements/tr-select-reason.html +++ b/httemplate/elements/tr-select-reason.html @@ -3,13 +3,14 @@ function sh_add<% $name %>() { -%if ($curuser->access_right($access_right)){ if (document.getElementById('<% $name %>').selectedIndex == 0){ <% $controlledbutton ? $controlledbutton.'.disabled = true;' : ';' %> }else{ <% $controlledbutton ? $controlledbutton.'.disabled = false;' : ';' %> } +%if ($curuser->access_right($access_right)){ + if (document.getElementById('<% $name %>').selectedIndex == (document.getElementById('<% $name %>').length - 1)) { document.getElementById('new<% $name %>').disabled = false; @@ -36,14 +37,9 @@ Reason + + + +% }else{ +

Reason Type

+% }

New Reason

- + <%init> my($name, $class, $init_reason, $init_type, $init_newreason, $controlledbutton) = @_; -my($extra_sql, $curuser, $access_right, $display, $disabled); +my($access_right, $display, $disabled); if ($class eq 'C') { $access_right='Add on-the-fly cancel reason'; }elsif ($class eq 'S') { $access_right='Add on-the-fly suspend reason'; +}elsif ($class eq 'R') { + $access_right='Add on-the-fly credit reason'; }else{ print "illegal class: $class"; } @@ -93,8 +112,18 @@ if ($init_reason == -1){ $disabled = 'true'; } -$extra_sql = "WHERE class = '$class' ORDER BY reason_type"; -$curuser = $FS::CurrentUser::CurrentUser; +my $extra_sql = + "WHERE class = '$class' and (disabled = '' OR disabled is NULL)"; - +my @reasons = qsearch({ + table => 'reason', + hashref => {}, + extra_sql => $extra_sql, + addl_from => 'LEFT JOIN reason_type '. + ' ON reason_type.typenum = reason.reason_type', + order_by => 'ORDER BY reason_type.type ASC, reason.reason ASC', +}); +my $curuser = $FS::CurrentUser::CurrentUser; + +