X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=c8b7ecb58a937582cd472ef4eb009c22de210ef9;hb=7b125e587a4d1ee0aca692e23ea7897f671855ae;hp=fcde22bf654f051e06672a69952039d935dfb77e;hpb=09d3b99715ac707d64b1a06d8a2432b76ddb173d;p=freeside.git diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index fcde22bf6..c8b7ecb58 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -48,6 +48,7 @@ 'bill_dst_pkgpart' => 'Include line item(s) from package', 'svc_dst_pkgpart' => 'Include services of package', 'report_option' => 'Report classes', + 'fcc_ds0s' => 'Voice-grade eqivalents', }, 'fields' => [ @@ -167,18 +168,30 @@ { field=>'pay_weight', type=>'text', size=>6 }, { field=>'credit_weight', type=>'text', size=>6 }, + ( $conf->exists('cust_pkg-show_fcc_voice_grade_equivalent') + ? ( + { type => 'tablebreak-tr-title', + value => 'FCC Form 477 information', + }, + { field=>'fcc_ds0s', type=>'text', size=>6 }, + ) + : () + ), + { type => 'columnend' }, - { 'type' => $census ? 'tablebreak-tr-title' - : 'hidden', + { 'type' => $report_option ? 'tablebreak-tr-title' + : 'hidden', 'value' => 'Optional report classes', 'field' => 'census_title', }, { 'field' => 'report_option', - 'type' => $census ? 'select-table' : 'hidden', + 'type' => $report_option ? 'select-table' + : 'hidden', 'table' => 'part_pkg_report_option', 'name_col' => 'name', + 'hashref' => { 'disabled' => '' }, 'multiple' => 1, }, @@ -247,6 +260,11 @@ my $begin_callback = sub { my $disabled_type = $acl_edit_either ? 'checkbox' : 'hidden'; +#arg. access rights for cloning are Hard. +# on the one hand we don't really want cloning (customizing a package) to fail +# for want of finding the source package in normal usage +# on the other hand, we don't want people using the clone link to be able to +# see my $agent_clone_extra_sql = ' ( '. FS::part_pkg->curuser_pkgs_sql. " OR ( part_pkg.custom = 'Y' ) ". @@ -254,7 +272,12 @@ my $agent_clone_extra_sql = my $conf = new FS::Conf; my $taxproducts = $conf->exists('enable_taxproducts'); -my $census = scalar( qsearch( 'part_pkg_report_option', {} ) ); + +my $sth = dbh->prepare("SELECT COUNT(*) FROM part_pkg_report_option". + " WHERE disabled IS NULL OR disabled = '' ") + or die dbh->errstr; +$sth->execute or die $sth->errstr; +my $report_option = $sth->fetchrow_arrayref->[0]; #XXX # - tr-part_pkg_freq: month_increments_only (from price plans) @@ -330,7 +353,8 @@ my $edit_callback = sub { $recur_disabled = $object->freq ? 0 : 1; - (@agent_type) = map {$_->typenum} qsearch('type_pkgs',{'pkgpart'=>$1}); + (@agent_type) = + map {$_->typenum} qsearch('type_pkgs', { 'pkgpart' => $object->pkgpart } ); my @report_option = (); foreach ($object->options) { @@ -387,6 +411,11 @@ my $clone_callback = sub { $object->disabled('Y'); + } else { #not when cloning... + + (@agent_type) = + map {$_->typenum} qsearch('type_pkgs',{ 'pkgpart' => $object->pkgpart } ); + } %options = $object->options; @@ -401,7 +430,6 @@ my $m2_error_callback_maker = sub { my $link_type = shift; #yay closures return sub { my( $cgi, $object ) = @_; - my $num; map { if ( /^${link_type}_dst_pkgpart(\d+)$/ && @@ -489,7 +517,8 @@ my $html_bottom = sub { # $html .= ' SELECTED' if $freq eq $part_pkg->freq; # $html .= ">$freq{$freq}"; #} - #$html .= ''; + + #$html .= ''; my $href = $plans{$layer}->{'fields'}; my @fields = exists($plans{$layer}->{'fieldorder'}) @@ -498,6 +527,12 @@ my $html_bottom = sub { foreach my $field ( grep $_ !~ /^(setup|recur)_fee$/, @fields ) { + if(!exists($href->{$field})) { + # shouldn't happen + warn "nonexistent part_pkg option: '$field'\n"; + next; + } + $html .= ''. $href->{$field}{'name'}. ''; my $format = sub { shift };