X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=7baf84d11ba76baaeef20ec465210e6b834a4e3a;hb=bf5576362a192f74efe6cedc4ff258842c34bbcd;hp=cd0731370def26952ac27c0b4adc0f6d01a289e6;hpb=98aa4355cb0a31f97cdbeabb6c190c908ba355a0;p=freeside.git diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index cd0731370..7baf84d11 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -53,8 +53,10 @@ 'discountnum' => 'Offer discounts for longer terms', 'bill_dst_pkgpart' => 'Include line item(s) from package', 'svc_dst_pkgpart' => 'Include services of package', + 'supp_dst_pkgpart' => 'Include complete package', 'report_option' => 'Report classes', 'fcc_ds0s' => 'Voice-grade equivalents', + 'fcc_voip_class' => 'Category', }, 'fields' => [ @@ -196,6 +198,9 @@ { type => 'tablebreak-tr-title', value => 'FCC Form 477 information', }, + { field=>'fcc_voip_class', + type=>'select-voip_class', + }, { field=>'fcc_ds0s', type=>'text', size=>6 }, ) : () @@ -235,6 +240,19 @@ }, { 'type' => 'tablebreak-tr-title', + 'value' => 'Supplemental packages', + 'colspan' => '4', + }, + { 'field' => 'supp_dst_pkgpart', + 'type' => 'select-part_pkg', + 'm2_label' => 'Include complete package', + 'm2m_method' => 'supp_part_pkg_link', + 'm2m_dstcol' => 'dst_pkgpart', + 'm2_error_callback' => + &{$m2_error_callback_maker}('supp'), + }, + + { 'type' => 'tablebreak-tr-title', 'value' => 'Pricing add-ons', 'colspan' => 4, }, @@ -405,20 +423,8 @@ my $new_object_callback = sub { }; -my $edit_callback = sub { - my( $cgi, $object, $fields, $opt ) = @_; - - $setup_show_zero_disabled = ($object->option('setup_fee') > 0) ? 1 : 0; - - $recur_disabled = $object->freq ? 0 : 1; - - $recur_show_zero_disabled = - $object->freq - ? $object->option('recur_fee') > 0 ? 1 : 0 - : 1; - - (@agent_type) = - map {$_->typenum} qsearch('type_pkgs', { 'pkgpart' => $object->pkgpart } ); +sub set_report_option { + my($cgi, $object, $fields ) = @_; #, $opt my @report_option = (); foreach ($object->options) { @@ -441,6 +447,25 @@ my $edit_callback = sub { $field->{value} = join(',', @report_option); } +} + +my $edit_callback = sub { + my( $cgi, $object, $fields, $opt ) = @_; + + $setup_show_zero_disabled = ($object->option('setup_fee') > 0) ? 1 : 0; + + $recur_disabled = $object->freq ? 0 : 1; + + $recur_show_zero_disabled = + $object->freq + ? $object->option('recur_fee') > 0 ? 1 : 0 + : 1; + + (@agent_type) = + map {$_->typenum} qsearch('type_pkgs', { 'pkgpart' => $object->pkgpart } ); + + set_report_option( $cgi, $object, $fields); + %options = $object->options; $object->set($_ => $object->option($_, 1)) @@ -480,13 +505,15 @@ my $clone_callback = sub { $object->disabled('Y'); - } else { #not when cloning... + } else { #when explicitly cloning, not customizing (@agent_type) = map {$_->typenum} qsearch('type_pkgs',{ 'pkgpart' => $object->pkgpart } ); } + set_report_option( $cgi, $object, $fields); + %options = $object->options; $object->set($_ => $options{$_}) @@ -618,23 +645,23 @@ END my $warning = 'Changing the setup or recurring fee will create a new package definition. '. 'Continue?'; - + +$javascript .= "function confirm_submit(f) {"; if ( $conf->exists('part_pkg-lineage') ) { $javascript .= " - function confirm_submit(f) { - - var fields = Array('setup_fee','recur_fee'); - for(var i=0; i < fields.length; i++) { - if ( f[fields[i]].value != f[fields[i]].defaultValue ) { - return confirm('$warning'); - } - } - return true; + + var fields = Array('setup_fee','recur_fee'); + for(var i=0; i < fields.length; i++) { + if ( f[fields[i]].value != f[fields[i]].defaultValue ) { + return confirm('$warning'); + } } "; } - -$javascript .= ''; +$javascript .= " + return true; +} +"; tie my %plans, 'Tie::IxHash', %{ FS::part_pkg::plan_info() };