X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=ba615bbbe2d816387830aca6d3f4e7d191e05c7e;hb=f19956cf9995fee8897542fafa6c7ec13afde381;hp=6629407f033ea33b0c1314f4f0356f6b57e9a822;hpb=5adac2bcd86a2bb0ddf7b016b5ed1dcd04635aa0;p=freeside.git diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 6629407f0..ba615bbbe 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 pkgpart != $pkgpart" + : '' + }, + empty_label => 'no package', + }, + #price plan #setup fee #recurring frequency @@ -179,21 +214,26 @@ type => 'hidden', value => join(',', @taxproductnums), }, - { field => 'taxproduct_select', - type => 'selectlayers', - options => [ '(default)', @taxproductnums ], - curr_value => '(default)', - labels => { ( '(default)' => '(default)' ), - map {($_=>$usage_class{$_})} - @taxproductnums - }, - layer_fields => \%taxproduct_fields, - layer_values_callback => $taxproduct_values, - layers_only => !$taxproducts, - cell_style => ( !$taxproducts - ? 'display:none' - : '' - ), + #{ field => 'taxproduct_select', + # type => 'selectlayers', + # options => [ '(default)', @taxproductnums ], + # curr_value => '(default)', + # labels => { ( '(default)' => '(default)' ), + # map {($_=>$usage_class{$_})} + # @taxproductnums + # }, + # layer_fields => \%taxproduct_fields, + # layer_values_callback => $taxproduct_values, + # layers_only => !$taxproducts, + # cell_style => ( !$taxproducts + # ? 'display:none' + # : '' + # ), + #}, + { field => 'taxproductnum', + type => 'part_pkg-taxproducts', + include_opt_callback => + sub { pkgpart => $_[0]->pkgpart }, }, { type => 'tablebreak-tr-title', @@ -214,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' }, @@ -267,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 }, @@ -414,7 +444,7 @@ my $agent_clone_extra_sql = ' ) '; my $conf = new FS::Conf; -my $taxproducts = $conf->exists('enable_taxproducts'); +my $taxproducts = $conf->config('tax_data_vendor') ne ''; my $fcc_opts = $conf->exists('part_pkg-show_fcc_options'); @@ -559,6 +589,11 @@ my $error_callback = sub { 'cgiparam' ); + if ( $cgi->param('error') =~ / is suggested with / ) { + #yeah, detection is a shitty kludge, but we don't have exception objects + $opt->{form_init} = ' Override suggestion

'; + } + }; my $new_hashref_callback = sub { { 'plan' => 'flat' }; }; @@ -954,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. @@ -980,7 +1019,7 @@ my $html_bottom = sub { } } }; - + foreach my $field ( grep $_ !~ /^(setup|recur)_fee$/, @fields ) { if(!exists($href->{$field})) { @@ -994,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'}); @@ -1093,9 +1133,11 @@ my $html_bottom = sub { $html .= ''; } $html .= ''; - - $html .= qq('; + + $html .= include('/elements/hidden.html', + field => $layer.'__OPTIONS', + value => join(',', @fields) + ); $html; @@ -1115,9 +1157,9 @@ my $html_bottom = sub { ''; @@ -1208,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'; + } } };