summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2018-09-13 15:48:56 -0700
committerIvan Kohler <ivan@freeside.biz>2018-09-13 15:48:56 -0700
commit64cb9f480fae2da57bcf760f74212d1f270c9290 (patch)
tree9e5915574097ec223c8bed0c7cfeb34a68863bfe
parent9d55843fddd22f64ad0f6b890181c6918aebbf6d (diff)
optimize declined payment event condition, RT#81305
-rw-r--r--FS/FS/Schema.pm2
-rw-r--r--FS/FS/part_event/Condition/cust_pay_batch_declined.pm30
2 files changed, 6 insertions, 26 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index d313db3..447a6bc 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -1913,7 +1913,7 @@ sub tables_hashref {
],
'primary_key' => 'paybatchnum',
'unique' => [],
- 'index' => [ ['batchnum'], ['invnum'], ['custnum'] ],
+ 'index' => [ ['batchnum'], ['invnum'], ['custnum'], ['status'] ],
},
'fcc477map' => {
diff --git a/FS/FS/part_event/Condition/cust_pay_batch_declined.pm b/FS/FS/part_event/Condition/cust_pay_batch_declined.pm
index b3a8d70..8efb278 100644
--- a/FS/FS/part_event/Condition/cust_pay_batch_declined.pm
+++ b/FS/FS/part_event/Condition/cust_pay_batch_declined.pm
@@ -16,36 +16,16 @@ sub eventtable_hashref {
};
}
-#sub option_fields {
-# (
-# 'field' => 'description',
-#
-# 'another_field' => { 'label'=>'Amount', 'type'=>'money', },
-#
-# 'third_field' => { 'label' => 'Types',
-# 'type' => 'checkbox-multiple',
-# 'options' => [ 'h', 's' ],
-# 'option_labels' => { 'h' => 'Happy',
-# 's' => 'Sad',
-# },
-# );
-#}
-
sub condition {
my($self, $cust_pay_batch, %opt) = @_;
- #my $cust_main = $self->cust_main($object);
- #my $value_of_field = $self->option('field');
- #my $time = $opt{'time'}; #use this instead of time or $^T
-
$cust_pay_batch->status =~ /Declined/i;
-
}
-#sub condition_sql {
-# my( $class, $table ) = @_;
-# #...
-# 'true';
-#}
+sub condition_sql {
+ my( $class, $table ) = @_;
+
+ "(cust_pay_batch.status IS NOT NULL AND cust_pay_batch.status = 'Declined')";
+}
1;