X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-reason.html;h=b7a715b42d2e9d4f8a4d63e83ea02eaf7ebbe179;hb=845a6ea956c4725b800a82cc1b2ae68cd485a015;hp=d85538f0c93851af114cf744bce9bf317b1701f3;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git diff --git a/httemplate/elements/tr-select-reason.html b/httemplate/elements/tr-select-reason.html index d85538f0c..b7a715b42 100755 --- a/httemplate/elements/tr-select-reason.html +++ b/httemplate/elements/tr-select-reason.html @@ -6,8 +6,8 @@ Example: #required 'field' => 'reasonnum', - 'reason_class' => 'C', # currently 'C', 'R', or 'S' - # for cancel, credit, or suspend + 'reason_class' => 'C', # currently 'C', 'R', 'F', or 'S' + # for cancel, credit, refund, or suspend #recommended 'cgi' => $cgi, #easiest way for things to be properly "sticky" on errors @@ -32,8 +32,15 @@ Example: - Reason + <% mt('Reason') |h %> @@ -83,13 +90,13 @@ Example: % if (scalar(@types) < 1) { # we should never reach this -

No reason types. Go add some.

+

<% mt('No reason types. Please add some.') |h %>

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

Reason Type

+

<% mt('Reason Type') |h %>

<% $types[0]->type %> @@ -101,7 +108,7 @@ Example: -

Reason Type

+

<% mt('Reason Type') |h %>

" style="display:<% $display %>"> @@ -140,16 +154,15 @@ my $controlledbutton = $opt{'control_button'}; my $id = $opt{'id'} || $func_suffix; -my( $add_access_right, $access_right ); +my $add_access_right; if ($class eq 'C') { - $access_right = 'Cancel customer'; $add_access_right = 'Add on-the-fly cancel reason'; } elsif ($class eq 'S') { - $access_right = 'Suspend customer package'; $add_access_right = 'Add on-the-fly suspend reason'; } elsif ($class eq 'R') { - $access_right = 'Post credit'; $add_access_right = 'Add on-the-fly credit reason'; +} elsif ($class eq 'F') { + $add_access_right = 'Add on-the-fly refund reason'; } else { die "illegal class: $class"; } @@ -184,6 +197,43 @@ my @reasons = qsearch({ order_by => 'ORDER BY reason_type.type ASC, reason.reason ASC', }); +my @hints; +if ( $class eq 'S' ) { + my $conf = FS::Conf->new; + @hints = ( '' ); + foreach my $reason (@reasons) { + if ( $reason->unsuspend_pkgpart ) { + my $part_pkg = FS::part_pkg->by_key($reason->unsuspend_pkgpart); + if ( $part_pkg ) { + if ( $part_pkg->option('setup_fee',1) > 0 and + $part_pkg->option('recur_fee',1) == 0 ) { + # the usual case + push @hints, + mt('A [_1] unsuspension fee will apply.', + ($conf->config('money_char') || '$') . + sprintf('%.2f', $part_pkg->option('setup_fee')) + ); + } else { + # oddball cases--not really supported + push @hints, + mt('An unsuspension package will apply: [_1]', + $part_pkg->price_info + ); + } + } else { #no $part_pkg + push @hints, + 'Unsuspend pkg #'.$reason->unsuspend_pkgpart. + ' not found.'; + } + } else { #no unsuspend_pkgpart + push @hints, ''; + } + } + push @hints, ''; # for the "new reason" case + @hints = map {''.$_.''} @hints; +} + + my $curuser = $FS::CurrentUser::CurrentUser;