X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition%2Fhas_referral_custnum.pm;h=70c9c7f8b20ba3334decd2e2fca0c614618a2855;hp=61a8155790d620e74bb10e6a30aea41af306e2b8;hb=f839709351aee1f9488e9a26496adc564aa5b8e5;hpb=708b7bd0a10a5bf6be81ce21d946e05e046a00ed diff --git a/FS/FS/part_event/Condition/has_referral_custnum.pm b/FS/FS/part_event/Condition/has_referral_custnum.pm index 61a815579..70c9c7f8b 100644 --- a/FS/FS/part_event/Condition/has_referral_custnum.pm +++ b/FS/FS/part_event/Condition/has_referral_custnum.pm @@ -38,11 +38,13 @@ sub condition { } sub condition_sql { - #my( $class, $table ) = @_; + my( $class, $table ) = @_; - "cust_main.referral_custnum IS NOT NULL"; - - #XXX a bit harder to check active status here + my $sql = FS::cust_main->active_sql; + $sql =~ s/cust_main.custnum/cust_main.referral_custnum/; + $sql = 'cust_main.referral_custnum IS NOT NULL AND ('. + $class->condition_sql_option('active') . ' IS NULL OR '.$sql.')'; + return $sql; } 1;