X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg.pm;h=ef7f557807abe5f6e31c8617cdeaee2664dbd84c;hb=7b125e587a4d1ee0aca692e23ea7897f671855ae;hp=82d6ed5f7cd3fba730c63e9b458a279fdd413d8b;hpb=56d8a66d0ad959056e04578e237c14d1f5242a44;p=freeside.git diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 82d6ed5f7..ef7f55780 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -98,6 +98,8 @@ inherits from FS::Record. The following fields are currently supported: =item agentnum - Optional agentnum (see L) +=item fcc_ds0s - Optional DS0 equivalency number for FCC form 477 + =back =head1 METHODS @@ -462,6 +464,7 @@ sub check { || $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') @@ -479,6 +482,7 @@ sub check { ? $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; @@ -767,6 +771,7 @@ sub is_free { } } +sub can_discount { 0; } sub freqs_href { #method, class method or sub? #my $self = shift; @@ -907,9 +912,11 @@ sub options { 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 @@ -1205,6 +1212,18 @@ sub calc_units { 0; } #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 @@ -1378,15 +1397,16 @@ sub _pkgs_sql { " ( - 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) + ) + ) ) ";