| @@ -72,10 +72,10 @@ | ||
| 72 | 72 | * Gets payments statistic data. |
| 73 | 73 | * |
| 74 | 74 | * @since 6.7 |
| 75 | 75 | * |
| 76 | - * @param string $from_date From date. | |
| 77 | - * @param string $to_date To date. | |
| 76 | + * @param string|null $from_date From date. | |
| 77 | + * @param string|null $to_date To date. | |
| 78 | 78 | * |
| 79 | 79 | * @return array Contains `count` and `total`. |
| 80 | 80 | */ |
| 81 | 81 | public function get_payments_stats( $from_date = null, $to_date = null ) { |
| @@ -97,15 +97,17 @@ | ||
| 97 | 97 | if ( null !== $to_date ) { |
| 98 | 98 | $where['created_at <'] = $to_date . ' 23:59:59'; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | + $db_version = get_option( $this->db_opt_name ); | |
| 102 | + | |
| 101 | 103 | // Do not collect test payment, this is a new feature of Stripe lite. |
| 102 | - if ( 6 <= get_option( $this->db_opt_name ) ) { | |
| 104 | + if ( 6 <= $db_version ) { | |
| 103 | 105 | $where['test'] = array( null, 0 ); |
| 104 | 106 | } |
| 105 | 107 | |
| 106 | 108 | // If only Paypal is used, and the DB isn't migrated (to version 4), use `completed` column instead of `status`. |
| 107 | - if ( 4 > get_option( $this->db_opt_name ) && FrmDb::db_column_exists( $this->table_name, 'completed' ) ) { | |
| 109 | + if ( 4 > $db_version && FrmDb::db_column_exists( $this->table_name, 'completed' ) ) { | |
| 108 | 110 | $where['completed'] = 1; |
| 109 | 111 | } else { |
| 110 | 112 | $where['status'] = 'complete'; |
| 111 | 113 | } |