diff options
author | jeff <jeff> | 2006-10-23 04:21:04 +0000 |
---|---|---|
committer | jeff <jeff> | 2006-10-23 04:21:04 +0000 |
commit | 9811b8ce65909a293810ddbcd8c9b5ca963fba01 (patch) | |
tree | f6b76e94f276eaabbaf58b50a39493cb91d0c7ab /httemplate | |
parent | 1043b612a287f6ccc6bbe32357483019d390f840 (diff) |
events should attach reasons
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/edit/part_bill_event.cgi | 10 | ||||
-rwxr-xr-x | httemplate/edit/process/part_bill_event.cgi | 31 | ||||
-rw-r--r-- | httemplate/edit/reason.html | 3 | ||||
-rwxr-xr-x | httemplate/elements/tr-select-reason.html | 8 | ||||
-rwxr-xr-x | httemplate/misc/cancel_pkg.html | 4 | ||||
-rwxr-xr-x | httemplate/misc/process/cancel_pkg.html | 13 |
6 files changed, 34 insertions, 35 deletions
diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi index dda0bef69..77aa82887 100755 --- a/httemplate/edit/part_bill_event.cgi +++ b/httemplate/edit/part_bill_event.cgi @@ -162,34 +162,34 @@ Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> % }, % 'suspend' => { % 'name' => 'Suspend', -% 'code' => '$cust_main->suspend();', +% 'code' => '$cust_main->suspend(reason => %%%sreason%%%);', % 'weight' => 10, % 'reason' => 'S', % }, % 'suspend-if-balance' => { % 'name' => 'Suspend if balance (this invoice and previous) over', -% 'code' => '$cust_bill->cust_suspend_if_balance_over( %%%balanceover%%% );', +% 'code' => '$cust_bill->cust_suspend_if_balance_over( %%%balanceover%%%, reason => %%%sreason%%%, );', % 'html' => " $money_char ". '<INPUT TYPE="text" SIZE="7" NAME="balanceover" VALUE="%%%balanceover%%%">', % 'weight' => 10, % 'reason' => 'S', % }, % 'suspend-if-pkgpart' => { % 'name' => 'Suspend packages', -% 'code' => '$cust_main->suspend_if_pkgpart(%%%if_pkgpart%%%);', +% 'code' => '$cust_main->suspend_if_pkgpart({pkgparts => [%%%if_pkgpart%%%,], reason => %%%sreason%%%,});', % 'html' => sub { &select_pkgpart('if_pkgpart', @_) }, % 'weight' => 10, % 'reason' => 'S', % }, % 'suspend-unless-pkgpart' => { % 'name' => 'Suspend packages except', -% 'code' => '$cust_main->suspend_unless_pkgpart(%%%unless_pkgpart%%%);', +% 'code' => '$cust_main->suspend_unless_pkgpart({unless_pkgpart => [%%%unless_pkgpart%%%], reason => %%%sreason%%%,});', % 'html' => sub { &select_pkgpart('unless_pkgpart', @_) }, % 'weight' => 10, % 'reason' => 'S', % }, % 'cancel' => { % 'name' => 'Cancel', -% 'code' => '$cust_main->cancel();', +% 'code' => '$cust_main->cancel(reason => %%%creason%%%);', % 'weight' => 10, % 'reason' => 'C', % }, diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi index dd5cd0c8e..cedba1e9f 100755 --- a/httemplate/edit/process/part_bill_event.cgi +++ b/httemplate/edit/process/part_bill_event.cgi @@ -31,23 +31,19 @@ % my $rnum; % my $rtype; % my $reasonm; -% if ($eventcode =~ /cancel/) { -% $cgi->param('creason') =~ /^(-?\d+)$/ || die "Invalid creason"; +% my $class = ''; +% $class='c' if ($eventcode =~ /cancel/); +% $class='s' if ($eventcode =~ /suspend/); +% if ($class) { +% $cgi->param("${class}reason") =~ /^(-?\d+)$/ +% or $error = "Invalid ${class}reason"; % $rnum = $1; % if ($rnum == -1) { -% $cgi->param('newcreasonT') =~ /^(\d+)$/ || die "Invalid newcreasonT"; +% $cgi->param("new${class}reasonT") =~ /^(\d+)$/ +% or $error = "Invalid new${class}reasonT"; % $rtype = $1; -% $cgi->param('newcreason') =~ /^([\s\w]+)$/ || die "Invalid newcreasonT"; -% $reasonm = $1; -% } -% } -% if ($eventcode =~ /suspend/) { -% $cgi->param('sreason') =~ /^(-?\d+)$/ || die "Invalid sreason"; -% $rnum = $1; -% if ($rnum == -1) { -% $cgi->param('newsreasonT') =~ /^(\d+)$/ || die "Invalid newsreasonT"; -% $rtype = $1; -% $cgi->param('newsreason') =~ /^([\s\w]+)$/ || die "Invalid newsreasonT"; +% $cgi->param("new${class}reason") =~ /^([\s\w]+)$/ +% or $error = "Invalid new${class}reason"; % $reasonm = $1; % } % } @@ -57,6 +53,11 @@ % 'reason_type' => $rtype, % }); % $error = $reason->insert or $rnum = $reason->reasonnum; +% unless ($error) { +% $cgi->param("${class}reason", $rnum); +% $cgi->param("new${class}reason", ''); +% $cgi->param("new${class}reasonT", ''); +% } % } % % unless($error){ @@ -84,5 +85,3 @@ %} % % - - diff --git a/httemplate/edit/reason.html b/httemplate/edit/reason.html index 2f5932846..7c0722cea 100644 --- a/httemplate/edit/reason.html +++ b/httemplate/edit/reason.html @@ -9,6 +9,9 @@ % % my (@types) = qsearch( 'reason_type', { 'class' => $class } ); % +% unless (scalar(@types)) { +% print $cgi->redirect( "reason_type.html?class=$class" ); +% } <% include( 'elements/edit.html', 'name' => ucfirst($classname) . ' Reason', 'table' => 'reason', diff --git a/httemplate/elements/tr-select-reason.html b/httemplate/elements/tr-select-reason.html index 6c66e8170..0c05ae74e 100755 --- a/httemplate/elements/tr-select-reason.html +++ b/httemplate/elements/tr-select-reason.html @@ -4,6 +4,11 @@ { %if ($curuser->access_right($access_right)){ + if (document.getElementById('<% $name %>').selectedIndex == 0){ + <% $controlledbutton ? $controlledbutton.'.disabled = true;' : ';' %> + }else{ + <% $controlledbutton ? $controlledbutton.'.disabled = false;' : ';' %> + } if (document.getElementById('<% $name %>').selectedIndex == (document.getElementById('<% $name %>').length - 1)) { @@ -36,6 +41,7 @@ % extra_sql => $extra_sql, % addl_from => 'LEFT JOIN reason_type ON reason_type.typenum = reason.reason_type', % }); + <OPTION VALUE="" <% ($init_reason eq "") ? 'SELECTED' : '' %>>Select Reason...</OPTION> % foreach my $reason (@reasons) { <OPTION VALUE="<% $reason->reasonnum %>" <% ($init_reason == $reason->reasonnum) ? 'SELECTED' : '' %>><% $reason->reason %></OPTION> % } @@ -68,7 +74,7 @@ </TR> <%init> -my($name, $class, $init_reason, $init_type, $init_newreason) = @_; +my($name, $class, $init_reason, $init_type, $init_newreason, $controlledbutton) = @_; my($extra_sql, $curuser, $access_right, $display, $disabled); if ($class eq 'C') { diff --git a/httemplate/misc/cancel_pkg.html b/httemplate/misc/cancel_pkg.html index bfb0893e9..e61000618 100755 --- a/httemplate/misc/cancel_pkg.html +++ b/httemplate/misc/cancel_pkg.html @@ -42,12 +42,12 @@ %} % -<% include('/elements/tr-select-reason.html', 'reasonnum', $class) %> +<% include('/elements/tr-select-reason.html', 'reasonnum', $class, '', '', '', 'document.sc_popup.submit' ) %> </TABLE> <BR> -<INPUT TYPE="submit" VALUE="<% $submit %>"> +<INPUT TYPE="submit" NAME="submit" VALUE="<% $submit %>" disabled='true'> </FORM> </BODY> diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html index b53809854..01433a3dc 100755 --- a/httemplate/misc/process/cancel_pkg.html +++ b/httemplate/misc/process/cancel_pkg.html @@ -55,22 +55,13 @@ %} % %unless ($error) { -% my $cust_pkg_reason = new FS::cust_pkg_reason({ 'pkgnum' => $pkgnum, -% 'reasonnum' => $reasonnum, -% 'otaker' => $otaker, -% 'date' => $date, -% }); -% $error = $cust_pkg_reason->insert; -%} -% -%unless ($error) { % if ($method eq 'expire'){ % my %hash = $cust_pkg->hash; % $hash{'expire'}=$date; % my $new = new FS::cust_pkg (\%hash); -% $error = $new->replace($cust_pkg); +% $error = $new->replace($cust_pkg, 'reason' => $reasonnum); % }else{ -% $error = $cust_pkg->$method +% $error = $cust_pkg->$method( 'reason' => $reasonnum ); % } %} % |