X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition%2Ftimes.pm;h=14ff23b9d352d4307ee42e7a5c1068c3abbee29f;hb=acd5ab13c00e473b63891f4db8443af99f5404c5;hp=428a2cb09c8e9f61a6ae51c5d2076e67ecd2876e;hpb=e32e1a2357e42a596d12d814f06b8902d05240a1;p=freeside.git diff --git a/FS/FS/part_event/Condition/times.pm b/FS/FS/part_event/Condition/times.pm index 428a2cb09..14ff23b9d 100644 --- a/FS/FS/part_event/Condition/times.pm +++ b/FS/FS/part_event/Condition/times.pm @@ -34,22 +34,25 @@ sub condition { ), } ); - scalar(@existing) <= $self->option('run_times'); + scalar(@existing) < $self->option('run_times'); } sub condition_sql { - my( $class, $table ) = @_; + my( $class, $table, %opt ) = @_; my %tablenum = %{ FS::part_event->eventtable_pkey_sql }; + my $run_times = + $class->condition_sql_option_integer('run_times', $opt{'driver_name'}); + my $existing = "( SELECT COUNT(*) FROM cust_event WHERE cust_event.eventpart = part_event.eventpart AND cust_event.tablenum = $tablenum{$table} AND status != 'failed' )"; - "$existing <= ". $class->condition_sql_option('run_times'); + "$existing < $run_times"; }