X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=80a61f813654482616e37c12c9a7167f7b4c0db8;hb=dea176cdec2d5ed43c6f4304681b109a11da4fa0;hp=bfa5d50ea061722e0058986c8f6303fdf6109bb3;hpb=817c1ce0e1cbcfd1f684222c66f46dd13b2d6dd7;p=freeside.git diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index bfa5d50ea..80a61f813 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -28,7 +28,7 @@ 'onsubmit' => 'confirm_submit', - 'labels' => { + 'labels' => { 'pkgpart' => 'Package Definition', 'pkg' => 'Package', %locale_field_labels, @@ -69,6 +69,10 @@ 'supp_dst_pkgpart' => 'When ordering package, also order', 'report_option' => 'Report classes', 'delay_start' => 'Default delay (days)', + 'adjourn_months' => 'Suspend the package after ', + 'contract_end_months' => 'Contract ends after ', + 'expire_months' => 'Cancel the package after ', + 'change_to_pkgpart'=> 'and replace it with ', }, 'fields' => [ @@ -164,6 +168,37 @@ sort $conf->config('currencies') ), + ( $conf->exists('part_pkg-delay_start') + ? ( { type => 'tablebreak-tr-title', + value => 'Delayed start', + }, + { field => 'delay_start', + type => 'text', size => 6 }, + ) + : () + ), + + { type => 'tablebreak-tr-title', + value => 'Limited duration', + }, + { field => 'adjourn_months', + type => 'select-months', + }, + { field => 'contract_end_months', + type => 'select-months', + }, + { field => 'expire_months', + type => 'select-expire_months', + }, + { field => 'change_to_pkgpart', + type => 'select-part_pkg', + extra_sql => sub { $pkgpart + ? "AND part_pkg.pkgpart != $pkgpart" + : '' + }, + empty_label => 'no package', + }, + #price plan #setup fee #recurring frequency @@ -200,7 +235,6 @@ include_opt_callback => sub { pkgpart => $_[0]->pkgpart }, }, - { type => 'tablebreak-tr-title', value => 'Promotions', #better name? @@ -220,16 +254,6 @@ ) ), - ( $conf->exists('part_pkg-delay_start') - ? ( { type => 'tablebreak-tr-title', - value => 'Delayed start', - }, - { field => 'delay_start', - type => 'text', size => 6 }, - ) - : () - ), - { type => 'columnnext' }, {type=>'justtitle', value=>'Agent (reseller) types' }, @@ -273,7 +297,7 @@ { field=>'agent_pkgpartid', type=>'text', size=>21 }, { type => 'tablebreak-tr-title', - value => 'Line-item revenue recogition', #better name? + value => 'Line-item revenue recognition', #better name? }, { field=>'pay_weight', type=>'text', size=>6 }, { field=>'credit_weight', type=>'text', size=>6 }, @@ -327,7 +351,7 @@ { 'field' => 'bill_dst_pkgpart', 'type' => 'select-part_pkg', 'extra_sql' => sub { $pkgpart - ? "AND pkgpart != $pkgpart" + ? "AND part_pkg.pkgpart != $pkgpart" : '' }, 'label_callback' => sub { shift->pkg_comment_only }, @@ -354,7 +378,7 @@ 'label' => 'Also include services from package: ', 'type' => 'select-part_pkg', 'extra_sql' => sub { $pkgpart - ? "AND pkgpart != $pkgpart" + ? "AND part_pkg.pkgpart != $pkgpart" : '' }, 'label_callback' => sub { shift->pkg_comment_only }, @@ -965,9 +989,13 @@ my $html_bottom = sub { #$html .= ''; my $href = $plans{$layer}->{'fields'}; - my @fields = exists($plans{$layer}->{'fieldorder'}) - ? @{$plans{$layer}->{'fieldorder'}} - : keys %{ $href }; + my @fields; + if ( $plans{$layer}->{'fieldorder'} ) { + @fields = @{ $plans{$layer}->{'fieldorder'} }; + } else { + warn "FS::part_pkg::$layer has no fieldorder.\n"; + @fields = keys %$href; + } # hash of dependencies for each of the Pricing Plan fields. # make sure NOT to use double-quotes inside the 'msg' value. @@ -991,7 +1019,7 @@ my $html_bottom = sub { } } }; - + foreach my $field ( grep $_ !~ /^(setup|recur)_fee$/, @fields ) { if(!exists($href->{$field})) { @@ -1005,7 +1033,8 @@ my $html_bottom = sub { next if !$display; } - $html .= ''. $href->{$field}{'name'}. ''; + $html .= ''. $href->{$field}{'name'}. ' + '; my $format = sub { shift }; $format = $href->{$field}{'format'} if exists($href->{$field}{'format'}); @@ -1104,9 +1133,11 @@ my $html_bottom = sub { $html .= ''; } $html .= ''; - - $html .= qq('; + + $html .= include('/elements/hidden.html', + field => $layer.'__OPTIONS', + value => join(',', @fields) + ); $html; @@ -1219,6 +1250,11 @@ my $field_callback = sub { }; $fieldref->{layer_fields} = \%taxproduct_fields; $fieldref->{layer_values_callback} = $taxproduct_values; + } elsif ($field eq 'taxproductnum') { # part_pkg-taxproduct, new style + if ( !$taxproducts ) { + # then make the widget go away + $fieldref->{type} = 'hidden'; + } } };