1 <% include( 'elements/edit.html',
2 'post_url' => popurl(1).'process/part_pkg.cgi',
3 'name' => "Package definition",
7 'agent_null_right' => $edit_global,
8 'agent_clone_extra_sql' => $agent_clone_extra_sql,
9 #'viewall_dir' => 'browse',
10 'viewall_url' => $p.'browse/part_pkg.cgi',
11 'html_init' => include('/elements/init_overlib.html').
13 'html_bottom' => $html_bottom,
15 'onLoad="agent_changed(document.edit_topform.agentnum)"',
17 'begin_callback' => $begin_callback,
18 'end_callback' => $end_callback,
19 'new_hashref_callback' => $new_hashref_callback,
20 'new_object_callback' => $new_object_callback,
21 'new_callback' => $new_callback,
22 'clone_callback' => $clone_callback,
23 'edit_callback' => $edit_callback,
24 'error_callback' => $error_callback,
25 'field_callback' => $field_callback,
27 'onsubmit' => 'confirm_submit',
30 'pkgpart' => 'Package Definition',
31 'pkg' => 'Package (customer-visible)',
32 'comment' => 'Comment (customer-hidden)',
33 'classnum' => 'Package class',
34 'addon_classnum' => 'Restrict additional orders to package class',
35 'promo_code' => 'Promotional code',
36 'freq' => 'Recurring fee frequency',
37 'setuptax' => 'Setup fee tax exempt',
38 'recurtax' => 'Recurring fee tax exempt',
39 'taxclass' => 'Tax class',
40 'taxproduct_select'=> 'Tax products',
41 'plan' => 'Price plan',
42 'disabled' => 'Disable new orders',
43 'disable_line_item_date_ranges' => 'Disable line item date ranges',
44 'setup_cost' => 'Setup cost',
45 'recur_cost' => 'Recur cost',
46 'pay_weight' => 'Payment weight',
47 'credit_weight' => 'Credit weight',
48 'agentnum' => 'Agent',
49 'setup_fee' => 'Setup fee',
50 'setup_show_zero' => 'Show zero setup',
51 'recur_fee' => 'Recurring fee',
52 'recur_show_zero' => 'Show zero recurring',
53 'discountnum' => 'Offer discounts for longer terms',
54 'bill_dst_pkgpart' => 'Include line item(s) from package',
55 'svc_dst_pkgpart' => 'Include services of package',
56 'report_option' => 'Report classes',
57 'fcc_ds0s' => 'Voice-grade equivalents',
58 'fcc_voip_class' => 'Category',
62 { field=>'clone', type=>'hidden',
63 curr_value_callback =>
64 sub { shift->param('clone') },
66 { field=>'pkgnum', type=>'hidden',
67 curr_value_callback =>
68 sub { shift->param('pkgnum') },
71 { field=>'custom', type=>'hidden' },
72 { field=>'family_pkgpart', type=>'hidden' },
73 { field=>'successor', type=>'hidden' },
75 { type => 'columnstart' },
82 {field=>'comment', type=>'text', size=>40 }, #32
83 { field => 'agentnum',
84 type => 'select-agent',
85 disable_empty => ! $acl_edit_global,
86 empty_label => '(global)',
87 onchange => 'agent_changed',
89 {field=>'classnum', type=>'select-pkg_class' },
90 ( $conf->exists('pkg-addon_classnum')
91 ? ( { field=>'addon_classnum',
92 type =>'select-pkg_class',
97 {field=>'disabled', type=>$disabled_type, value=>'Y'},
98 {field=>'disable_line_item_date_ranges', type=>$disabled_type, value=>'Y'},
100 { type => 'tablebreak-tr-title',
101 value => 'Pricing', #better name?
104 type => 'selectlayers-select',
105 options => [ keys %plan_labels ],
106 labels => \%plan_labels,
107 onchange => 'aux_planchanged(what);',
109 { field => 'setup_fee',
111 onchange => 'setup_changed',
113 { field => 'setup_show_zero',
116 disabled => sub { $setup_show_zero_disabled },
119 type => 'part_pkg_freq',
120 onchange => 'freq_changed',
122 { field => 'recur_fee',
124 disabled => sub { $recur_disabled },
125 onchange => 'recur_changed',
128 { field => 'recur_show_zero',
131 disabled => sub { $recur_show_zero_disabled },
137 #recurring fee (auto-disable)
139 { type => 'columnnext' },
141 {type=>'justtitle', value=>'Taxation' },
142 {field=>'setuptax', type=>'checkbox', value=>'Y'},
143 {field=>'recurtax', type=>'checkbox', value=>'Y'},
144 {field=>'taxclass', type=>'select-taxclass' },
145 { field => 'taxproductnums',
147 value => join(',', @taxproductnums),
149 { field => 'taxproduct_select',
150 type => 'selectlayers',
151 options => [ '(default)', @taxproductnums ],
152 curr_value => '(default)',
153 labels => { ( '(default)' => '(default)' ),
154 map {($_=>$usage_class{$_})}
157 layer_fields => \%taxproduct_fields,
158 layer_values_callback => $taxproduct_values,
159 layers_only => !$taxproducts,
160 cell_style => ( !$taxproducts
166 { type => 'tablebreak-tr-title',
167 value => 'Promotions', #better name?
169 { field=>'promo_code', type=>'text', size=>15 },
171 { type => 'tablebreak-tr-title',
172 value => 'Cost tracking', #better name?
174 { field=>'setup_cost', type=>'money', },
175 { field=>'recur_cost', type=>'money', },
177 { type => 'columnnext' },
179 { field => 'agent_type',
180 type => 'select-agent_types',
181 disabled => ! $acl_edit_global,
182 curr_value_callback => sub {
183 my($cgi, $object, $field) = @_;
184 #in the other callbacks..? hmm.
189 { type => 'tablebreak-tr-title',
190 value => 'Line-item revenue recogition', #better name?
192 { field=>'pay_weight', type=>'text', size=>6 },
193 { field=>'credit_weight', type=>'text', size=>6 },
195 ( $conf->exists('cust_pkg-show_fcc_voice_grade_equivalent')
197 { type => 'tablebreak-tr-title',
198 value => 'FCC Form 477 information',
200 { field=>'fcc_voip_class',
201 type=>'select-voip_class',
203 { field=>'fcc_ds0s', type=>'text', size=>6 },
209 { type => 'columnend' },
211 { 'type' => $report_option ? 'tablebreak-tr-title'
213 'value' => 'Optional report classes',
214 'field' => 'census_title',
216 { 'field' => 'report_option',
217 'type' => $report_option ? 'select-table'
219 'table' => 'part_pkg_report_option',
220 'name_col' => 'name',
221 'hashref' => { 'disabled' => '' },
225 { 'type' => 'tablebreak-tr-title',
226 'value' => 'Term discounts',
228 { 'field' => 'discountnum',
229 'type' => 'select-table',
230 'table' => 'discount',
231 'name_col' => 'name',
232 'hashref' => { %$discountnum_hashref },
233 #'extra_sql' => 'AND (months IS NOT NULL OR months != 0)',
234 'empty_label'=> 'Select discount',
235 'm2_label' => 'Offer discounts for longer terms',
236 'm2m_method' => 'part_pkg_discount',
237 'm2m_dstcol' => 'discountnum',
238 'm2_error_callback' => $discount_error_callback,
241 { 'type' => 'tablebreak-tr-title',
242 'value' => 'Pricing add-ons',
245 { 'field' => 'bill_dst_pkgpart',
246 'type' => 'select-part_pkg',
247 'extra_sql' => sub { $pkgpart
248 ? "AND pkgpart != $pkgpart"
251 'm2_label' => 'Include line item(s) from package',
252 'm2m_method' => 'bill_part_pkg_link',
253 'm2m_dstcol' => 'dst_pkgpart',
254 'm2_error_callback' =>
255 &{$m2_error_callback_maker}('bill'),
256 'm2_fields' => [ { 'field' => 'hidden',
257 'type' => 'checkbox',
265 { type => 'tablebreak-tr-title',
268 { type => 'pkg_svc', },
270 { 'field' => 'svc_dst_pkgpart',
271 'label' => 'Also include services from package: ',
272 'type' => 'select-part_pkg',
273 'extra_sql' => sub { $pkgpart
274 ? "AND pkgpart != $pkgpart"
277 'm2_label' => 'Include services of package: ',
278 'm2m_method' => 'svc_part_pkg_link',
279 'm2m_dstcol' => 'dst_pkgpart',
280 'm2_error_callback' =>
281 &{$m2_error_callback_maker}('svc'),
284 { type => 'tablebreak-tr-title',
285 value => 'Price plan options',
294 my $curuser = $FS::CurrentUser::CurrentUser;
296 my $edit_global = 'Edit global package definitions';
297 my $acl_edit = $curuser->access_right('Edit package definitions');
298 my $acl_edit_global = $curuser->access_right($edit_global);
300 my $acl_edit_either = $acl_edit || $acl_edit_global;
302 my $begin_callback = sub {
303 my( $cgi, $fields, $opt ) = @_;
305 unless $acl_edit_either
306 || ( $cgi->param('pkgnum')
307 && $curuser->access_right('Customize customer package')
311 my $disabled_type = $acl_edit_either ? 'checkbox' : 'hidden';
313 #arg. access rights for cloning are Hard.
314 # on the one hand we don't really want cloning (customizing a package) to fail
315 # for want of finding the source package in normal usage
316 # on the other hand, we don't want people using the clone link to be able to
318 my $agent_clone_extra_sql =
319 ' ( '. FS::part_pkg->curuser_pkgs_sql.
320 " OR ( part_pkg.custom = 'Y' ) ".
323 my $conf = new FS::Conf;
324 my $taxproducts = $conf->exists('enable_taxproducts');
326 my $sth = dbh->prepare("SELECT COUNT(*) FROM part_pkg_report_option".
327 " WHERE disabled IS NULL OR disabled = '' ")
329 $sth->execute or die $sth->errstr;
330 my $report_option = $sth->fetchrow_arrayref->[0];
333 # - tr-part_pkg_freq: month_increments_only (from price plans)
335 # - test errors cloning
336 # - test custom pricing
337 # - move the selectlayer divs away from lame layer_callback
339 #my ($query) = $cgi->keywords;
344 my %tax_override = ();
346 my %taxproductnums = map { ($_->classnum => 1) }
347 qsearch('usage_class', { 'disabled' => '' });
348 my @taxproductnums = ( qw( setup recur ), sort (keys %taxproductnums) );
351 my $recur_disabled = 1;
352 my $setup_show_zero_disabled = 0;
353 my $recur_show_zero_disabled = 1;
357 my $error_callback = sub {
358 my($cgi, $object, $fields, $opt ) = @_;
360 (@agent_type) = $cgi->param('agent_type');
362 $opt->{action} = 'Custom' if $cgi->param('pkgnum');
364 $setup_show_zero_disabled = ($cgi->param('setup_fee') > 0) ? 1 : 0;
366 $recur_disabled = $cgi->param('freq') ? 0 : 1;
367 $recur_show_zero_disabled =
369 ? $cgi->param('recur_fee') > 0 ? 1 : 0
372 foreach ($cgi->param) {
373 /^usage_taxproductnum_(\d+)$/ && ($taxproductnums{$1} = 1);
375 $tax_override{''} = $cgi->param('tax_override');
376 $tax_override{$_} = $cgi->param('tax_override_$_')
377 foreach(grep { /^tax_override_(\w+)$/ } $cgi->param);
379 #some false laziness w/process
380 $cgi->param('plan') =~ /^(\w+)$/ or die 'unparsable plan';
382 my $options = $cgi->param($plan."__OPTIONS");
383 my @options = split(',', $options);
385 map { my $optionname = $_;
386 my $param = $plan."__$optionname";
387 my $value = join(', ', $cgi->param($param));
388 ( $optionname => $value );
392 $object->set($_ => scalar($cgi->param($_)) )
393 foreach (qw( setup_fee recur_fee disable_line_item_date_ranges ));
395 $pkgpart = $object->pkgpart;
399 my $new_hashref_callback = sub { { 'plan' => 'flat' }; };
401 my $new_object_callback = sub {
402 my( $cgi, $hashref, $fields, $opt ) = @_;
404 my $part_pkg = FS::part_pkg->new( $hashref );
405 $part_pkg->set($_ => '0')
406 foreach (qw( setup_fee recur_fee disable_line_item_date_ranges ));
412 sub set_report_option {
413 my($cgi, $object, $fields ) = @_; #, $opt
415 my @report_option = ();
416 foreach ($object->options) {
417 /^usage_taxproductnum_(\d+)$/ && ($taxproductnums{$1} = 1);
418 /^report_option_(\d+)$/ && (push @report_option, $1);
420 foreach ($object->part_pkg_taxoverride) {
421 $taxproductnums{$_->usage_class} = 1
425 $cgi->param('report_option', join(',', @report_option));
426 foreach my $field ( @$fields ) {
428 ref($field) eq 'HASH' &&
430 $field->{field} eq 'report_option'
432 #$field->{curr_value} = join(',', @report_option);
433 $field->{value} = join(',', @report_option);
438 my $edit_callback = sub {
439 my( $cgi, $object, $fields, $opt ) = @_;
441 $setup_show_zero_disabled = ($object->option('setup_fee') > 0) ? 1 : 0;
443 $recur_disabled = $object->freq ? 0 : 1;
445 $recur_show_zero_disabled =
447 ? $object->option('recur_fee') > 0 ? 1 : 0
451 map {$_->typenum} qsearch('type_pkgs', { 'pkgpart' => $object->pkgpart } );
453 set_report_option( $cgi, $object, $fields);
455 %options = $object->options;
457 $object->set($_ => $object->option($_, 1))
458 foreach (qw( setup_fee recur_fee disable_line_item_date_ranges ));
460 $pkgpart = $object->pkgpart;
464 my $new_callback = sub {
465 my( $cgi, $object, $fields ) = @_;
467 my $conf = new FS::Conf;
469 if ( $conf->exists('agent_defaultpkg') ) {
470 #my @all_agent_types = map {$_->typenum} qsearch('agent_type',{});
471 @agent_type = map {$_->typenum} qsearch('agent_type',{});
474 $options{'suspend_bill'}=1 if $conf->exists('part_pkg-default_suspend_bill');
478 my $clone_callback = sub {
479 my( $cgi, $object, $fields, $opt ) = @_;
481 if ( $cgi->param('pkgnum') ) {
483 my $cust_pkg = qsearchs('cust_pkg', { 'pkgnum' => $cgi->param('pkgnum') } );
484 $object->agentnum( $cust_pkg->cust_main->agentnum );
486 $opt->{action} = 'Custom';
488 #my $part_pkg = $clone_part_pkg->clone;
489 #this is all clone does anyway
490 $object->custom('Y');
492 $object->disabled('Y');
494 } else { #when explicitly cloning, not customizing
497 map {$_->typenum} qsearch('type_pkgs',{ 'pkgpart' => $object->pkgpart } );
501 set_report_option( $cgi, $object, $fields);
503 %options = $object->options;
505 $object->set($_ => $options{$_})
506 foreach (qw( setup_fee recur_fee disable_line_item_date_ranges ));
508 $recur_disabled = $object->freq ? 0 : 1;
511 my $discount_error_callback = sub {
512 my( $cgi, $object ) = @_;
514 if ( /^discountnum(\d+)$/ &&
515 ( my $discountnum = $cgi->param("discountnum$1") ) )
517 new FS::part_pkg_discount {
518 'pkgpart' => $object->pkgpart,
519 'discountnum' => $discountnum,
528 my $m2_error_callback_maker = sub {
529 my $link_type = shift; #yay closures
531 my( $cgi, $object ) = @_;
534 if ( /^${link_type}_dst_pkgpart(\d+)$/ &&
535 ( my $dst = $cgi->param("${link_type}_dst_pkgpart$1") ) )
538 my $hidden = $cgi->param("${link_type}_dst_pkgpart__hidden$1")
540 new FS::part_pkg_link {
541 'link_type' => $link_type,
542 'src_pkgpart' => $object->pkgpart,
543 'dst_pkgpart' => $dst,
554 my $javascript = <<'END';
555 <SCRIPT TYPE="text/javascript">
557 function freq_changed(what) {
558 var freq = what.options[what.selectedIndex].value;
561 what.form.recur_fee.disabled = true;
562 what.form.recur_fee.style.backgroundColor = '#dddddd';
563 what.form.recur_show_zero.disabled = true;
564 //what.form.recur_show_zero.style.backgroundColor= '#dddddd';
566 what.form.recur_fee.disabled = false;
567 what.form.recur_fee.style.backgroundColor = '#ffffff';
568 recur_changed( what.form.recur_fee );
569 //what.form.recur_show_zero.style.backgroundColor= '#ffffff';
574 function setup_changed(what) {
575 var setup = what.value;
576 if ( parseFloat(setup) == 0 ) {
577 what.form.setup_show_zero.disabled = false;
579 what.form.setup_show_zero.disabled = true;
583 function recur_changed(what) {
584 var recur = what.value;
585 if ( parseFloat(recur) == 0 ) {
586 what.form.recur_show_zero.disabled = false;
588 what.form.recur_show_zero.disabled = true;
592 function agent_changed(what) {
595 if ( what.type == 'select-one' ) {
596 agentnum = what.options[what.selectedIndex].value;
598 agentnum = what.value;
601 if ( agentnum == 0 ) {
602 what.form.agent_type.disabled = false;
603 //what.form.agent_type.style.backgroundColor = '#ffffff';
604 what.form.agent_type.style.visibility = '';
606 what.form.agent_type.disabled = true;
607 //what.form.agent_type.style.backgroundColor = '#dddddd';
608 what.form.agent_type.style.visibility = 'hidden';
613 function aux_planchanged(what) { //?
616 var plan = what.options[what.selectedIndex].value;
617 var table = document.getElementById('TableNumber7') // XXX NOT ROBUST
619 if ( plan == 'flat' || plan == 'prorate' || plan == 'subscription' ) {
620 //table.disabled = false;
621 table.style.visibility = '';
623 //table.disabled = true;
624 table.style.visibility = 'hidden';
632 'Changing the setup or recurring fee will create a new package definition. '.
635 $javascript .= "function confirm_submit(f) {";
636 if ( $conf->exists('part_pkg-lineage') ) {
639 var fields = Array('setup_fee','recur_fee');
640 for(var i=0; i < fields.length; i++) {
641 if ( f[fields[i]].value != f[fields[i]].defaultValue ) {
642 return confirm('$warning');
652 tie my %plans, 'Tie::IxHash', %{ FS::part_pkg::plan_info() };
654 tie my %plan_labels, 'Tie::IxHash',
655 map { $_ => ( $plans{$_}->{'shortname'} || $plans{$_}->{'name'} ) }
658 my $html_bottom = sub {
661 #warn join("\n", map { "$_: $options{$_}" } keys %options ). "\n";
663 my $layer_callback = sub {
666 my $html = ntable("#cccccc",2);
670 # <TD ALIGN="right">Recurring fee frequency </TD>
671 # <TD><SELECT NAME="freq">
674 #my @freq = keys %freq;
675 #@freq = grep { /^\d+$/ } @freq
676 #XXX this bit# # if exists($plans{$layer}->{'freq'}) && $plans{$layer}->{'freq'} eq 'm';
677 #foreach my $freq ( @freq ) {
678 # $html .= qq(<OPTION VALUE="$freq");
679 # $html .= ' SELECTED' if $freq eq $part_pkg->freq;
680 # $html .= ">$freq{$freq}";
683 #$html .= '</SELECT></TD></TR>';
685 my $href = $plans{$layer}->{'fields'};
686 my @fields = exists($plans{$layer}->{'fieldorder'})
687 ? @{$plans{$layer}->{'fieldorder'}}
690 foreach my $field ( grep $_ !~ /^(setup|recur)_fee$/, @fields ) {
692 if(!exists($href->{$field})) {
694 warn "nonexistent part_pkg option: '$field'\n";
698 $html .= '<TR><TD ALIGN="right">'. $href->{$field}{'name'}. '</TD><TD>';
700 my $format = sub { shift };
701 $format = $href->{$field}{'format'} if exists($href->{$field}{'format'});
703 #XXX these should use elements/ fields... (or this whole thing should
704 #just use layer_fields instead of layer_callback)
706 if ( ! exists($href->{$field}{'type'}) ) {
708 $html .= qq!<INPUT TYPE="text" NAME="${layer}__$field" VALUE="!.
709 ( exists($options{$field})
710 ? &$format($options{$field})
711 : $href->{$field}{'default'} ).
714 } elsif ( $href->{$field}{'type'} eq 'checkbox' ) {
716 $html .= qq!<INPUT TYPE="checkbox" NAME="${layer}__$field" VALUE=1 !.
717 ( exists($options{$field}) && $options{$field}
722 } elsif ( $href->{$field}{'type'} =~ /^select/ ) {
726 if $href->{$field}{'type'} eq 'select_multiple';
727 $html .= qq! NAME="${layer}__$field">!;
729 $html .= '<OPTION VALUE="">'. $href->{$field}{'empty_label'}
730 if exists($href->{$field}{'disable_empty'})
731 && ! $href->{$field}{'disable_empty'};
733 if ( $href->{$field}{'select_table'} ) {
735 qsearch( $href->{$field}{'select_table'},
736 $href->{$field}{'select_hash'} )
738 my $value = $record->getfield($href->{$field}{'select_key'});
739 $html .= qq!<OPTION VALUE="$value"!.
740 ( $options{$field} =~ /(^|, *)$value *(,|$)/ #?
744 '>'. $record->getfield($href->{$field}{'select_label'});
746 } elsif ( $href->{$field}{'select_options'} ) {
747 foreach my $key ( keys %{ $href->{$field}{'select_options'} } ) {
748 my $label = $href->{$field}{'select_options'}{$key};
749 $html .= qq!<OPTION VALUE="$key"!.
750 ( $options{$field} =~ /(^|, *)$key *(,|$)/ #?
758 $html .= '<font color="#ff0000">warning: '.
759 "don't know how to retreive options for $field select field".
762 $html .= '</SELECT>';
764 } elsif ( $href->{$field}{'type'} eq 'radio' ) {
767 qq!<INPUT TYPE="radio" NAME="${layer}__$field"!;
769 foreach my $key ( keys %{ $href->{$field}{'options'} } ) {
770 my $label = $href->{$field}{'options'}{$key};
771 $html .= qq!$radio VALUE="$key"!.
772 ( $options{$field} =~ /(^|, *)$key *(,|$)/ #?
781 $html .= '</TD></TR>';
785 $html .= qq(<INPUT TYPE="hidden" NAME="${layer}__OPTIONS" VALUE=").
786 join(',', keys %{ $href } ). '">';
794 options => [ keys %plan_labels ],
795 labels => \%plan_labels,
796 curr_value => $object->plan,
797 layer_callback => $layer_callback,
801 include('/elements/selectlayers.html', %selectlayers, 'layers_only'=>1 ).
802 '<SCRIPT TYPE="text/javascript">'.
803 include('/elements/selectlayers.html', %selectlayers, 'js_only'=>1 );
806 "taxproduct_selectchanged(document.getElementById('taxproduct_select'));\n"
809 $return .= '</SCRIPT>';
815 my %usage_class = map { ($_->classnum => $_->classname) }
816 qsearch('usage_class', {});
817 $usage_class{setup} = 'Setup';
818 $usage_class{recur} = 'Recurring';
820 my %taxproduct_fields = ();
821 my $end_callback = sub {
822 my( $cgi, $object, $fields, $opt ) = @_;
824 @taxproductnums = ( qw( setup recur ), sort (keys %taxproductnums) );
826 if ( $object->pkgpart ) {
827 foreach my $usage_class ( '', @taxproductnums ) {
828 $tax_override{$usage_class} =
829 join (",", map $_->taxclassnum,
830 qsearch( 'part_pkg_taxoverride', {
831 'pkgpart' => $object->pkgpart,
832 'usage_class' => $usage_class,
839 map { $_ => [ "taxproductnum_$_",
840 { type => 'select-taxproduct',
841 #label => "$usage_class{$_} tax product",
844 { type => 'select-taxoverride' }
849 $taxproduct_fields{'(default)'} =
850 [ 'taxproductnum', { type => 'select-taxproduct',
851 #label => 'Default tax product',
853 'tax_override', { type => 'select-taxoverride' },
857 my $taxproduct_values = sub {
858 my ($cgi, $object, $flags) = @_;
860 sub { my $layer = shift;
861 my @fields = @{$taxproduct_fields{$layer}};
864 my $field = shift @fields;
866 $field =~ /^taxproductnum_\w+$/ &&
867 push @values, ( $field => $options{"usage_$field"} );
868 $field =~ /^tax_override_(\w+)$/ &&
869 push @values, ( $field => $tax_override{$1} );
870 $field =~ /^taxproductnum$/ &&
871 push @values, ( $field => $object->taxproductnum );
872 $field =~ /^tax_override$/ &&
873 push @values, ( $field => $tax_override{''} );
879 map { ( $_ => { &{$routine}($_) } ) } ( '(default)', @taxproductnums );
884 my $field_callback = sub {
885 my ($cgi, $object, $fieldref) = @_;
887 my $field = $fieldref->{field};
888 if ($field eq 'taxproductnums') {
889 $fieldref->{value} = join(',', @taxproductnums);
890 } elsif ($field eq 'taxproduct_select') {
891 $fieldref->{options} = [ '(default)', @taxproductnums ];
892 $fieldref->{labels} = { ( '(default)' => '(default)' ),
893 map {( $_ => ($usage_class{$_} || $_) )}
896 $fieldref->{layer_fields} = \%taxproduct_fields;
897 $fieldref->{layer_values_callback} = $taxproduct_values;
901 my $discountnum_hashref = {
903 'months' => { 'op' => '>', 'value' => 1 },