X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition%2Ftimes.pm;h=14ff23b9d352d4307ee42e7a5c1068c3abbee29f;hb=459e2cda8a891cc062d39780991d631b6f2c6b6d;hp=91212e778f1b2694916bfc4d82e4399e364e47f4;hpb=b286341305ba302c4a555aeef288f84c7141ccdd;p=freeside.git diff --git a/FS/FS/part_event/Condition/times.pm b/FS/FS/part_event/Condition/times.pm index 91212e778..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_integer('run_times'); + "$existing < $run_times"; }