X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=7baf84d11ba76baaeef20ec465210e6b834a4e3a;hp=e5edcdedcc683c57a24a1c23de7a974994d40b04;hb=b70b0d8c6f571a68ffb60c5ca728a230926abee4;hpb=077bb34b3467c3320440c49b76064f664c0eee98 diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index e5edcdedc..7baf84d11 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -24,6 +24,8 @@ 'error_callback' => $error_callback, 'field_callback' => $field_callback, + 'onsubmit' => 'confirm_submit', + 'labels' => { 'pkgpart' => 'Package Definition', 'pkg' => 'Package (customer-visible)', @@ -51,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' => [ @@ -66,6 +70,8 @@ }, { field=>'custom', type=>'hidden' }, + { field=>'family_pkgpart', type=>'hidden' }, + { field=>'successor', type=>'hidden' }, { type => 'columnstart' }, @@ -192,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 }, ) : () @@ -231,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, }, @@ -401,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) { @@ -437,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)) @@ -476,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{$_}) @@ -593,7 +624,7 @@ my $javascript = <<'END'; } - function aux_planchanged(what) { + function aux_planchanged(what) { //? alert('called!'); var plan = what.options[what.selectedIndex].value; @@ -609,9 +640,29 @@ my $javascript = <<'END'; } - 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 .= " + + 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 .= " + return true; +} +"; + tie my %plans, 'Tie::IxHash', %{ FS::part_pkg::plan_info() }; tie my %plan_labels, 'Tie::IxHash',