+% # "add new reason" fields
+% # should be a <fieldset>, but that doesn't fit well into the table
+
+% if ( $curuser->access_right($add_access_right) && !$hide_addnew ) {
+<TR id="<% $id %>_new_fields">
+ <TD COLSPAN=2>
+ <TABLE CLASS="inv" STYLE="text-align: left">
+
+ <& tr-input-text.html,
+ label => 'New reason',
+ field => $id.'_new_reason'
+ &>
+
+% my @types = qsearch( 'reason_type', { 'class' => $class } );
+% if (scalar(@types) < 1) { # we should never reach this
+ <TR>
+ <TD ALIGN="right">
+ <P><% mt('No reason types. Please add some.') |h %></P>
+ </TD>
+ </TR>
+% } elsif (scalar(@types) == 1) {
+ <& tr-fixed.html,
+ label => 'Reason type',
+ field => $id.'_new_reason_type',
+ curr_value => $types[0]->typenum,
+ formatted_value => $types[0]->type,
+ &>
+% } else { # more than one type, the normal case
+ <& tr-select-table.html,
+ label => 'Reason type',
+ field => $id.'_new_reason_type',
+ table => 'reason_type',
+ name_col => 'type',
+ hashref => { 'class' => $class },
+ disable_empty => 1,
+ &>
+% } # 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',
+ field => $id.'_new_unused_credit',
+ value => 'Y'
+ &>
+ <& tr-select-table.html,
+ label => 'Charge a suspension fee',
+ field => $id.'_new_feepart',
+ table => 'part_fee',
+ hashref => { disabled => '' },
+ name_col => 'itemdesc',
+ value_col => 'feepart',
+ empty_label => 'none',
+ &>
+ <& tr-select.html,
+ label => 'When this package is',
+ field => $id.'_new_fee_on_unsuspend',
+ options => [ '', 'Y' ],
+ labels => { '' => 'suspended', 'Y' => 'unsuspended' },
+ &>
+ <& tr-checkbox.html,
+ label => 'Delay fee until the next bill',
+ field => $id.'_new_fee_hold',
+ value => 'Y',
+ &>
+%# deprecated, but still accessible through the "Suspend Reasons" UI
+%# <& tr-select-part_pkg.html,
+%# label => 'Charge this fee when unsuspending',
+%# field => $id.'_new_unsuspend_pkgpart',
+%# hashref => { disabled => '', freq => '0' },
+%# empty_label => 'none',
+%# &>
+%# <& tr-checkbox.html,
+%# label => 'Hold unsuspension fee until the next bill',
+%# field => $id.'_new_unsuspend_hold',
+%# value => 'Y',
+%# &>
+% }
+ </table>
+ </td>
+</tr>
+% } # if the current user can add a reason
+
+% # container for hints (hints themselves come from xmlhttp-reason-hint)