X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-reason.html;h=9a670a26b50f91cba6b3a0c08d8398eb847ccb8d;hb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125;hp=d85538f0c93851af114cf744bce9bf317b1701f3;hpb=624b2d44625f69d71175c3348cae635d580c890b;p=freeside.git diff --git a/httemplate/elements/tr-select-reason.html b/httemplate/elements/tr-select-reason.html index d85538f0c..9a670a26b 100755 --- a/httemplate/elements/tr-select-reason.html +++ b/httemplate/elements/tr-select-reason.html @@ -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,15 +154,12 @@ 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'; } else { die "illegal class: $class"; @@ -184,6 +195,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;