X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Ftr-select-reason.html;h=9a430222c8b6ffe5ae0b39b46918a1253dda4e04;hp=125874694c409e386e56451a75b582fefdc40285;hb=ff27c3f36240aee48ed50153dd5d8fe3ac3f2443;hpb=92b6628c08e4478e48b6f250320a3e3e93262ec2 diff --git a/httemplate/elements/tr-select-reason.html b/httemplate/elements/tr-select-reason.html index 125874694..9a430222c 100755 --- a/httemplate/elements/tr-select-reason.html +++ b/httemplate/elements/tr-select-reason.html @@ -6,8 +6,7 @@ Example: #required 'field' => 'reasonnum', - 'reason_class' => 'C', # currently 'C', 'R', 'F', 'S' or 'X' - # for cancel, credit, refund, suspend or void credit + 'reason_class' => 'C', # one of those in %FS::reason_type::class_name #recommended 'cgi' => $cgi, #easiest way for things to be properly "sticky" on errors @@ -121,6 +120,13 @@ Example: &> % } # scalar(@types) +% if ( $class eq 'C' ) { + <& tr-checkbox.html, + label => 'Credit the unused portion of service when canceling', + field => $id.'_new_unused_credit', + value => 'Y' + &> +% } % if ( $class eq 'S' ) { <& tr-checkbox.html, label => 'Credit the unused portion of service when suspending', @@ -182,27 +188,14 @@ my $class = $opt{'reason_class'}; my $init_reason; if ( $opt{'cgi'} ) { $init_reason = $opt{'cgi'}->param($name); -} else { - $init_reason = $opt{'curr_value'}; } +$init_reason ||= $opt{'curr_value'}; my $id = $opt{'id'} || $name; $id =~ s/\./_/g; # for edit/part_event -my $add_access_right; -if ($class eq 'C') { - $add_access_right = 'Add on-the-fly cancel reason'; -} elsif ($class eq 'S') { - $add_access_right = 'Add on-the-fly suspend reason'; -} elsif ($class eq 'R') { - $add_access_right = 'Add on-the-fly credit reason'; -} elsif ($class eq 'F') { - $add_access_right = 'Add on-the-fly refund reason'; -} elsif ($class eq 'X') { - $add_access_right = 'Add on-the-fly void credit reason'; -} else { - die "illegal class: $class"; -} +my $add_access_right = $FS::reason_type::class_add_access_right{$class} + or die "unknown class: $class"; my @reasons = qsearch({ 'table' => 'reason',