X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg.pm;h=61bfc4dc051330409089d7281ef321ea50ba5456;hb=1cc9a75a47a548fc8a200371c88647f34c71db14;hp=70dcd4934e753609626608c2c6f3d925e97758e6;hpb=09d3b99715ac707d64b1a06d8a2432b76ddb173d;p=freeside.git diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm index 70dcd4934..61bfc4dc0 100644 --- a/FS/FS/part_pkg.pm +++ b/FS/FS/part_pkg.pm @@ -205,7 +205,11 @@ sub insert { 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', @@ -763,6 +767,7 @@ sub is_free { } } +sub can_discount { 0; } sub freqs_href { #method, class method or sub? #my $self = shift; @@ -1374,15 +1379,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) + ) + ) ) ";