invoice_sections_with_taxes per-agent, RT#79636
[freeside.git] / httemplate / edit / reason.html
1 <& elements/edit.html,
2   'menubar'=> [ "View all $classname Reasons" => 
3                   $p.'browse/reason.html?class='.$class,
4                 "View $classname Reason Types" =>
5                   $p.'browse/reason_type.html?class='.$class,
6               ],
7   'name'   => ucfirst($classname) . ' Reason',
8   
9   'table'  => 'reason',
10   'labels' => { 
11                 'reasonnum'   => $classname .  ' Reason',
12                 'reason_type' => $classname . ' Reason type',
13                 'reason'      => $classname . ' Reason',
14                 'disabled'    => 'Disabled',
15                 'class'       => '',
16                 'feepart'     => 'Charge a suspension fee',
17                 'fee_on_unsuspend'  => 'When a package is',
18                 'fee_hold'          => 'Delay fee until next bill',
19                 'unused_credit'     => 'Credit unused portion of service',
20                 'unsuspend_pkgpart' => 'Order an unsuspension package',
21                 'unsuspend_hold'    => 'Delay package until next bill',
22               },
23   'fields' => \@fields,
24 &>
25 <%init>
26
27 die "access denied"
28   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
29
30 $cgi->param('class') =~ /^(\w)$/ or die "illegal class";
31 my $class=$1;
32
33 my $classname = ucfirst($FS::reason_type::class_name{$class});
34
35 my (@types) = qsearch( 'reason_type', { 'class' => $class } );
36
37 unless (scalar(@types)) {
38   print $cgi->redirect( "reason_type.html?class=$class" );
39 }
40
41 my @fields = (
42   { 'field' => 'reason_type',
43     'type'  => 'select-table',
44     'table' => 'reason_type',
45     'name_col'  => 'type',
46     'value_col' => 'typenum',
47     'hashref'   => { 'class' => $class },
48     'disable_empty' => 1,
49 #     #then fix tr-select.html
50 #
51 #    'value' => { 'vcolumn' => 'typenum',
52 #                 'ccolumn' => 'type',
53 #             'values'  => \@types,
54 #           },
55 #     # that wasn't so hard...did this do something else that I'm missing?
56   },
57   'reason',
58   { 'field' => 'class',
59     'type'  => 'hidden',
60     'value' => $class,
61   },
62   { 'field' => 'disabled',
63     'type'  => 'checkbox',
64     'value' => 'Y'
65   },
66 );
67
68 if ( $class eq 'S' or $class eq 'C' ) {
69   push @fields,
70     { 'field'     => 'unused_credit',
71       'type'      => 'checkbox',
72       'value'     => 'Y',
73     };
74 }
75 if ( $class eq 'S' ) {
76     { 'type' => 'tablebreak-tr-title' },
77     { 'field'     => 'feepart',
78       'type'      => 'select-table',
79       'table'     => 'part_fee',
80       'hashref'   => { disabled => '' },
81       'name_col'  => 'itemdesc',
82       'value_col' => 'feepart',
83       'empty_label' => 'none',
84     },
85     { 'field'     => 'fee_on_unsuspend',
86       'type'      => 'select',
87       'options'   => [ '', 'Y' ],
88       'labels'    => { '' => 'suspended', 'Y' => 'unsuspended' },
89     },
90     { 'field'     => 'fee_hold',
91       'type'      => 'checkbox',
92       'value'     => 'Y',
93     },
94     { 'field'     => 'unsuspend_pkgpart',
95       'type'      => 'select-part_pkg',
96       'hashref'   => { 'disabled' => '',
97                        'freq'     => 0 }, # one-time charges only
98     },
99     { 'field'     => 'unsuspend_hold',
100       'type'      => 'checkbox',
101       'value'     => 'Y',
102     },
103   ;
104 }
105
106 </%init>