projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add condition_sql optimization to "Package definitions" condition, RT#74456
[freeside.git]
/
FS
/
FS
/
part_event
/
Condition
/
cust_paydate_within.pm
diff --git
a/FS/FS/part_event/Condition/cust_paydate_within.pm
b/FS/FS/part_event/Condition/cust_paydate_within.pm
index
4808e90
..
bfe3e84
100644
(file)
--- a/
FS/FS/part_event/Condition/cust_paydate_within.pm
+++ b/
FS/FS/part_event/Condition/cust_paydate_within.pm
@@
-23,7
+23,7
@@
sub eventtable_hashref {
sub option_fields {
(
sub option_fields {
(
- 'within' => { 'label' => '
Expiration dat
e within',
+ 'within' => { 'label' => '
Credit card will expir
e within',
'type' => 'freq',
},
);
'type' => 'freq',
},
);
@@
-32,14
+32,17
@@
sub option_fields {
sub condition {
my( $self, $cust_main, %opt ) = @_;
my $expire_time = $cust_main->paydate_epoch or return 0;
sub condition {
my( $self, $cust_main, %opt ) = @_;
my $expire_time = $cust_main->paydate_epoch or return 0;
- $opt{'time'} >= $self->option_age_from('within', $expire_time);
+ $opt{'time'} >= $self->option_age_from('within', $expire_time) and
+ $opt{'time'} < $expire_time;
}
sub condition_sql {
my ($self, $table, %opt) = @_;
my $expire_time = FS::cust_main->paydate_epoch_sql or return 'true';
}
sub condition_sql {
my ($self, $table, %opt) = @_;
my $expire_time = FS::cust_main->paydate_epoch_sql or return 'true';
- $opt{'time'} . ' >= ' .
- $self->condition_sql_option_age_from('within', $expire_time);
+ ' ( '. $opt{'time'} . ' >= ' .
+ $self->condition_sql_option_age_from('within', $expire_time) .
+ ' AND ' . $opt{'time'} . ' < ' . $expire_time . ' ) ';
+
}
1;
}
1;