[freeside-commits] branch master updated. eaa81907845ce3f316401bce723075b5fe3f735c

Ivan Kohler ivan at freeside.biz
Thu Sep 13 15:46:52 PDT 2018


The branch, master has been updated
       via  eaa81907845ce3f316401bce723075b5fe3f735c (commit)
      from  dfeca08f8d935d127d99de4690e2d5edf4f78b95 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit eaa81907845ce3f316401bce723075b5fe3f735c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Sep 13 15:46:49 2018 -0700

    optimize declined payment event condition, RT#81305

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 59a18c506..2a7a9d177 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -2750,7 +2750,7 @@ sub tables_hashref {
       ],
       'primary_key'  => 'paybatchnum',
       'unique'       => [],
-      'index'        => [ ['batchnum'], ['invnum'], ['custnum'] ],
+      'index'        => [ ['batchnum'], ['invnum'], ['custnum'],['status'] ],
       'foreign_keys' => [
                           { columns    => [ 'batchnum' ],
                             table      => 'pay_batch',
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 b3a8d705f..8efb27854 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;

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Schema.pm                                    |  2 +-
 .../Condition/cust_pay_batch_declined.pm           | 30 ++++------------------
 2 files changed, 6 insertions(+), 26 deletions(-)




More information about the freeside-commits mailing list