|
@@ 106-116 (lines=11) @@
|
| 103 |
|
$where = ' WHERE 1=1 '; |
| 104 |
|
|
| 105 |
|
// specific customers |
| 106 |
|
if( ! empty( $args['id'] ) ) { |
| 107 |
|
|
| 108 |
|
if( is_array( $args['id'] ) ) { |
| 109 |
|
$ids = implode( ',', array_map('intval', $args['id'] ) ); |
| 110 |
|
} else { |
| 111 |
|
$ids = intval( $args['id'] ); |
| 112 |
|
} |
| 113 |
|
|
| 114 |
|
$where .= " AND `id` IN( {$ids} ) "; |
| 115 |
|
|
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
// Specific products |
| 119 |
|
if( ! empty( $args['product_id'] ) ) { |
|
@@ 119-129 (lines=11) @@
|
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
// Specific products |
| 119 |
|
if( ! empty( $args['product_id'] ) ) { |
| 120 |
|
|
| 121 |
|
if( is_array( $args['product_id'] ) ) { |
| 122 |
|
$product_ids = implode( ',', array_map('intval', $args['product_id'] ) ); |
| 123 |
|
} else { |
| 124 |
|
$product_ids = intval( $args['product_id'] ); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
$where .= " AND `product_id` IN( {$product_ids} ) "; |
| 128 |
|
|
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
// Specific parent payments |
| 132 |
|
if( ! empty( $args['parent_payment_id'] ) ) { |
|
@@ 132-142 (lines=11) @@
|
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
// Specific parent payments |
| 132 |
|
if( ! empty( $args['parent_payment_id'] ) ) { |
| 133 |
|
|
| 134 |
|
if( is_array( $args['parent_payment_id'] ) ) { |
| 135 |
|
$parent_payment_ids = implode( ',', array_map('intval', $args['parent_payment_id'] ) ); |
| 136 |
|
} else { |
| 137 |
|
$parent_payment_ids = intval( $args['parent_payment_id'] ); |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
$where .= " AND `parent_payment_id` IN( {$parent_payment_ids} ) "; |
| 141 |
|
|
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
// Specific transaction IDs |
| 145 |
|
if( ! empty( $args['transaction_id'] ) ) { |
|
@@ 145-155 (lines=11) @@
|
| 142 |
|
} |
| 143 |
|
|
| 144 |
|
// Specific transaction IDs |
| 145 |
|
if( ! empty( $args['transaction_id'] ) ) { |
| 146 |
|
|
| 147 |
|
if( is_array( $args['transaction_id'] ) ) { |
| 148 |
|
$transaction_ids = implode( "','", array_map('sanitize_text_field', $args['transaction_id'] ) ); |
| 149 |
|
} else { |
| 150 |
|
$transaction_ids = sanitize_text_field( $args['transaction_id'] ); |
| 151 |
|
} |
| 152 |
|
|
| 153 |
|
$where .= " AND `transaction_id` IN ( '{$transaction_ids}' ) "; |
| 154 |
|
|
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
// Subscriptoins for specific customers |
| 158 |
|
if( ! empty( $args['customer_id'] ) ) { |
|
@@ 158-168 (lines=11) @@
|
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
// Subscriptoins for specific customers |
| 158 |
|
if( ! empty( $args['customer_id'] ) ) { |
| 159 |
|
|
| 160 |
|
if( is_array( $args['customer_id'] ) ) { |
| 161 |
|
$customer_ids = implode( ',', array_map('intval', $args['customer_id'] ) ); |
| 162 |
|
} else { |
| 163 |
|
$customer_ids = intval( $args['customer_id'] ); |
| 164 |
|
} |
| 165 |
|
|
| 166 |
|
$where .= " AND `customer_id` IN( {$customer_ids} ) "; |
| 167 |
|
|
| 168 |
|
} |
| 169 |
|
|
| 170 |
|
// Subscriptions for specific profile IDs |
| 171 |
|
if( ! empty( $args['profile_id'] ) ) { |
|
@@ 171-181 (lines=11) @@
|
| 168 |
|
} |
| 169 |
|
|
| 170 |
|
// Subscriptions for specific profile IDs |
| 171 |
|
if( ! empty( $args['profile_id'] ) ) { |
| 172 |
|
|
| 173 |
|
if( is_array( $args['profile_id'] ) ) { |
| 174 |
|
$profile_ids = implode( "','", array_map('sanitize_text_field', $args['profile_id'] ) ); |
| 175 |
|
} else { |
| 176 |
|
$profile_ids = sanitize_text_field( $args['profile_id'] ); |
| 177 |
|
} |
| 178 |
|
|
| 179 |
|
$where .= " AND `profile_id` IN( '{$profile_ids}' ) "; |
| 180 |
|
|
| 181 |
|
} |
| 182 |
|
|
| 183 |
|
// Subscriptions for specific statuses |
| 184 |
|
if( ! empty( $args['status'] ) ) { |
|
@@ 184-194 (lines=11) @@
|
| 181 |
|
} |
| 182 |
|
|
| 183 |
|
// Subscriptions for specific statuses |
| 184 |
|
if( ! empty( $args['status'] ) ) { |
| 185 |
|
|
| 186 |
|
if( is_array( $args['status'] ) ) { |
| 187 |
|
$statuses = implode( "','", array_map( 'sanitize_text_field', $args['status'] ) ); |
| 188 |
|
} else { |
| 189 |
|
$statuses = sanitize_text_field( $args['status'] ); |
| 190 |
|
} |
| 191 |
|
|
| 192 |
|
$where .= " AND `status` IN( '{$statuses}' ) "; |
| 193 |
|
|
| 194 |
|
} |
| 195 |
|
|
| 196 |
|
// Subscriptions created for a specific date or in a date range |
| 197 |
|
if( ! empty( $args['date'] ) ) { |
|
@@ 339-349 (lines=11) @@
|
| 336 |
|
$where = ' WHERE 1=1 '; |
| 337 |
|
|
| 338 |
|
// specific customers |
| 339 |
|
if( ! empty( $args['id'] ) ) { |
| 340 |
|
|
| 341 |
|
if( is_array( $args['id'] ) ) { |
| 342 |
|
$ids = implode( ',', array_map('intval', $args['id'] ) ); |
| 343 |
|
} else { |
| 344 |
|
$ids = intval( $args['id'] ); |
| 345 |
|
} |
| 346 |
|
|
| 347 |
|
$where .= " AND `id` IN( {$ids} ) "; |
| 348 |
|
|
| 349 |
|
} |
| 350 |
|
|
| 351 |
|
// Specific products |
| 352 |
|
if( ! empty( $args['product_id'] ) ) { |
|
@@ 352-362 (lines=11) @@
|
| 349 |
|
} |
| 350 |
|
|
| 351 |
|
// Specific products |
| 352 |
|
if( ! empty( $args['product_id'] ) ) { |
| 353 |
|
|
| 354 |
|
if( is_array( $args['product_id'] ) ) { |
| 355 |
|
$product_ids = implode( ',', array_map('intval', $args['product_id'] ) ); |
| 356 |
|
} else { |
| 357 |
|
$product_ids = intval( $args['product_id'] ); |
| 358 |
|
} |
| 359 |
|
|
| 360 |
|
$where .= " AND `product_id` IN( {$product_ids} ) "; |
| 361 |
|
|
| 362 |
|
} |
| 363 |
|
|
| 364 |
|
// Specific parent payments |
| 365 |
|
if( ! empty( $args['parent_payment_id'] ) ) { |
|
@@ 365-375 (lines=11) @@
|
| 362 |
|
} |
| 363 |
|
|
| 364 |
|
// Specific parent payments |
| 365 |
|
if( ! empty( $args['parent_payment_id'] ) ) { |
| 366 |
|
|
| 367 |
|
if( is_array( $args['parent_payment_id'] ) ) { |
| 368 |
|
$parent_payment_ids = implode( ',', array_map('intval', $args['parent_payment_id'] ) ); |
| 369 |
|
} else { |
| 370 |
|
$parent_payment_ids = intval( $args['parent_payment_id'] ); |
| 371 |
|
} |
| 372 |
|
|
| 373 |
|
$where .= " AND `parent_payment_id` IN( {$parent_payment_ids} ) "; |
| 374 |
|
|
| 375 |
|
} |
| 376 |
|
|
| 377 |
|
// Subscriptoins for specific customers |
| 378 |
|
if( ! empty( $args['customer_id'] ) ) { |
|
@@ 378-388 (lines=11) @@
|
| 375 |
|
} |
| 376 |
|
|
| 377 |
|
// Subscriptoins for specific customers |
| 378 |
|
if( ! empty( $args['customer_id'] ) ) { |
| 379 |
|
|
| 380 |
|
if( is_array( $args['customer_id'] ) ) { |
| 381 |
|
$customer_ids = implode( ',', array_map('intval', $args['customer_id'] ) ); |
| 382 |
|
} else { |
| 383 |
|
$customer_ids = intval( $args['customer_id'] ); |
| 384 |
|
} |
| 385 |
|
|
| 386 |
|
$where .= " AND `customer_id` IN( {$customer_ids} ) "; |
| 387 |
|
|
| 388 |
|
} |
| 389 |
|
|
| 390 |
|
// Subscriptions for specific profile IDs |
| 391 |
|
if( ! empty( $args['profile_id'] ) ) { |
|
@@ 391-401 (lines=11) @@
|
| 388 |
|
} |
| 389 |
|
|
| 390 |
|
// Subscriptions for specific profile IDs |
| 391 |
|
if( ! empty( $args['profile_id'] ) ) { |
| 392 |
|
|
| 393 |
|
if( is_array( $args['profile_id'] ) ) { |
| 394 |
|
$profile_ids = implode( ',', array_map('intval', $args['profile_id'] ) ); |
| 395 |
|
} else { |
| 396 |
|
$profile_ids = intval( $args['profile_id'] ); |
| 397 |
|
} |
| 398 |
|
|
| 399 |
|
$where .= " AND `profile_id` IN( {$profile_ids} ) "; |
| 400 |
|
|
| 401 |
|
} |
| 402 |
|
|
| 403 |
|
// Specific transaction IDs |
| 404 |
|
if( ! empty( $args['transaction_id'] ) ) { |
|
@@ 404-414 (lines=11) @@
|
| 401 |
|
} |
| 402 |
|
|
| 403 |
|
// Specific transaction IDs |
| 404 |
|
if( ! empty( $args['transaction_id'] ) ) { |
| 405 |
|
|
| 406 |
|
if( is_array( $args['transaction_id'] ) ) { |
| 407 |
|
$transaction_ids = implode( ',', array_map('sanitize_text_field', $args['transaction_id'] ) ); |
| 408 |
|
} else { |
| 409 |
|
$transaction_ids = sanitize_text_field( $args['transaction_id'] ); |
| 410 |
|
} |
| 411 |
|
|
| 412 |
|
$where .= " AND `transaction_id` IN( {$transaction_ids} ) "; |
| 413 |
|
|
| 414 |
|
} |
| 415 |
|
|
| 416 |
|
// Subscriptions for specific statuses |
| 417 |
|
if( ! empty( $args['status'] ) ) { |