-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 reason';
-} else {
- die "illegal class: $class";
-}
+my $add_access_right = $FS::reason_type::class_add_access_right{$class}
+ or die "unknown class: $class";