1 <% include( 'elements/edit.html',
2 'table' => 'rate_tier',
3 'name_singular' => 'tiering plan',
6 #{ field=>'disabled', type=>'checkbox', value=>'Y' },
7 { 'field' => 'tierdetailnum',
8 'type' => 'rate_tier_detail',
10 'o2m_table' => 'rate_tier_detail',
12 'm2_error_callback' => $m2_error_callback,
15 'labels' => { 'tiernum' => 'Plan #',
16 'tiername' => 'Tiering plan',
17 'tierdetailnum' => 'Tier',
19 'viewall_dir' => 'browse',
25 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
27 my $m2_error_callback = sub {
28 my($cgi, $object) = @_;
30 #process_o2m fields in process/rate_tier.html
31 my @fields = qw( min_quan min_charge );
32 my @gfields = ( '', map "_$_", @fields );
35 if ( /^tierdetailnum(\d+)$/ ) {
37 if ( grep $cgi->param("tierdetailnum$num$_"), @gfields ) {
38 my $x = new FS::rate_tier_detail {
39 'tierdetailnum' => scalar($cgi->param("tierdetailnum$num")),
40 map { $_ => scalar($cgi->param("tierdetailnum${num}_$_")) }