=item agentnum - Optional agentnum (see L<FS::agent>)
+=item fcc_ds0s - Optional DS0 equivalency number for FCC form 477
+
=back
=head1 METHODS
warn " inserting part_pkg_taxoverride records" if $DEBUG;
my %overrides = %{ $options{'tax_overrides'} || {} };
foreach my $usage_class ( keys %overrides ) {
- my @overrides = (grep "$_", split (',', $overrides{$usage_class}) );
+ my $override =
+ ( exists($overrides{$usage_class}) && defined($overrides{$usage_class}) )
+ ? $overrides{$usage_class}
+ : '';
+ my @overrides = (grep "$_", split(',', $override) );
my $error = $self->process_m2m (
'link_table' => 'part_pkg_taxoverride',
'target_table' => 'tax_class',
|| $self->ut_textn('taxclass')
|| $self->ut_enum('disabled', [ '', 'Y' ] )
|| $self->ut_enum('custom', [ '', 'Y' ] )
+ || $self->ut_enum('no_auto', [ '', 'Y' ])
#|| $self->ut_moneyn('setup_cost')
#|| $self->ut_moneyn('recur_cost')
|| $self->ut_floatn('setup_cost')
? $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum' )
: $self->ut_agentnum_acl('agentnum', \@null_agentnum_right)
)
+ || $self->ut_numbern('fcc_ds0s')
|| $self->SUPER::check
;
return $error if $error;
}
}
+sub can_discount { 0; }
sub freqs_href {
#method, class method or sub? #my $self = shift;
map { $_->optionname => $_->optionvalue } $self->part_pkg_option;
}
-=item option OPTIONNAME
+=item option OPTIONNAME [ QUIET ]
-Returns the option value for the given name, or the empty string.
+Returns the option value for the given name, or the empty string. If a true
+value is passed as the second argument, warnings about missing the option
+will be suppressed.
=cut
#fallback for everything except bulk.pm
sub hide_svc_detail { 0; }
+=item recur_cost_permonth CUST_PKG
+
+recur_cost divided by freq (only supported for monthly and longer frequencies)
+
+=cut
+
+sub recur_cost_permonth {
+ my($self, $cust_pkg) = @_;
+ return 0 unless $self->freq =~ /^\d+$/ && $self->freq > 0;
+ sprintf('%.2f', $self->recur_cost / $self->freq );
+}
+
=item format OPTION DATA
Returns data formatted according to the function 'format' described
"
(
- agentnum IS NOT NULL
- OR
- 0 < ( SELECT COUNT(*)
- FROM type_pkgs
- LEFT JOIN agent_type USING ( typenum )
- LEFT JOIN agent AS typeagent USING ( typenum )
- WHERE type_pkgs.pkgpart = part_pkg.pkgpart
- AND typeagent.agentnum IN ($agentnums)
- )
+ ( agentnum IS NOT NULL AND agentnum IN ($agentnums) )
+ OR ( agentnum IS NULL
+ AND EXISTS ( SELECT 1
+ FROM type_pkgs
+ LEFT JOIN agent_type USING ( typenum )
+ LEFT JOIN agent AS typeagent USING ( typenum )
+ WHERE type_pkgs.pkgpart = part_pkg.pkgpart
+ AND typeagent.agentnum IN ($agentnums)
+ )
+ )
)
";