X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg.pm;h=a073cf2c923264cfa75df0480b68a2b132377608;hb=387c96b0d8f224f3ade27bed9348f37b432bbb8a;hp=c08188bcd4807a85c018649b031888c2a2eeea06;hpb=5a52da30588e8811338845ce2edaf0631acad479;p=freeside.git diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index c08188bcd..a073cf2c9 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -20,6 +20,7 @@ use FS::part_pkg_taxrate; use FS::part_pkg_taxoverride; use FS::part_pkg_taxproduct; use FS::part_pkg_link; +use FS::part_pkg_discount; @ISA = qw( FS::m2m_Common FS::option_Common ); $DEBUG = 0; @@ -822,7 +823,7 @@ argument. sub add_freq { my( $self, $date, $freq ) = @_; - $freq = $self->freq if !defined($freq); + $freq = $self->freq unless $freq; #change this bit to use Date::Manip? CAREFUL with timezones (see # mailing list archive) @@ -940,6 +941,8 @@ sub _part_pkg_link { qsearch({ table => 'part_pkg_link', hashref => { 'src_pkgpart' => $self->pkgpart, 'link_type' => $type, + #protection against infinite recursive links + 'dst_pkgpart' => { op=>'!=', value=> $self->pkgpart }, }, order_by => "ORDER BY hidden", }); @@ -1126,6 +1129,18 @@ sub part_pkg_taxrate { } ); } +=item part_pkg_discount + +Returns the package to discount m2m records (see L) +for this package. + +=cut + +sub part_pkg_discount { + my $self = shift; + qsearch('part_pkg_discount', { 'pkgpart' => $self->pkgpart }); +} + =item _rebless Reblesses the object into the FS::part_pkg::PLAN class (if available), where