4 <& /elements/xmlhttp.html,
5 url => $p . 'misc/xmlhttp-reason-hint.html',
10 get_hint( reasonnum, function(stuff) { alert(stuff); } )
13 Currently will provide hints for:
14 1. suspension events (new-style reconnection fees, notification)
15 2. unsuspend_pkgpart package info (older reconnection fees)
16 3. crediting for unused time
19 my $sub = $cgi->param('sub');
20 my ($reasonnum) = $cgi->param('arg');
22 my $conf = FS::Conf->new;
25 if ( $reasonnum =~ /^\d+$/ ) {
26 my $reason = FS::reason->by_key($reasonnum);
29 if ( $reason->feepart ) { # XXX
30 my $part_fee = FS::part_fee->by_key($reason->feepart);
32 if ( $reason->fee_hold ) {
33 $when = 'on the next bill after ';
37 if ( $reason->fee_on_unsuspend ) {
38 $when .= 'unsuspension';
40 $when .= 'suspension';
43 my $fee_amt = $part_fee->explanation;
44 push @hints, mt('A fee of [_1] will be charged [_2].',
48 if ( $reason->unsuspend_pkgpart ) {
49 my $part_pkg = FS::part_pkg->by_key($reason->unsuspend_pkgpart);
51 if ( $part_pkg->option('setup_fee',1) > 0 and
52 $part_pkg->option('recur_fee',1) == 0 ) {
55 mt('A [_1] unsuspension fee will apply.',
56 ($conf->config('money_char') || '$') .
57 sprintf('%.2f', $part_pkg->option('setup_fee'))
60 # oddball cases--not really supported
62 mt('An unsuspension package will apply: [_1]',
66 } else { #no $part_pkg
68 '<FONT COLOR="#ff0000">Unsuspend pkg #'.$reason->unsuspend_pkgpart.
73 if ( $reason->unused_credit ) {
74 push @hints, mt('The customer will be credited for unused time.');
77 warn "reasonnum $reasonnum not found; returning no hints\n";
80 warn "reason-hint arg '$reasonnum' not a valid reasonnum\n";
83 <% join('<BR>', @hints) %>