|
@@ 1291-1309 (lines=19) @@
|
| 1288 |
|
wpinv_get_template( 'emails/wpinv-email-billing-details.php', array( 'invoice' => $invoice, 'email_type' => $email_type, 'sent_to_admin' => $sent_to_admin ) ); |
| 1289 |
|
} |
| 1290 |
|
|
| 1291 |
|
function wpinv_send_customer_invoice( $data = array() ) { |
| 1292 |
|
$invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
| 1293 |
|
|
| 1294 |
|
if ( empty( $invoice_id ) ) { |
| 1295 |
|
return; |
| 1296 |
|
} |
| 1297 |
|
|
| 1298 |
|
if ( !current_user_can( 'manage_options' ) ) { |
| 1299 |
|
wp_die( __( 'You do not have permission to send invoice notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
| 1300 |
|
} |
| 1301 |
|
|
| 1302 |
|
$sent = wpinv_user_invoice_notification( $invoice_id ); |
| 1303 |
|
|
| 1304 |
|
$status = $sent ? 'email_sent' : 'email_fail'; |
| 1305 |
|
|
| 1306 |
|
$redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) ); |
| 1307 |
|
wp_redirect( $redirect ); |
| 1308 |
|
exit; |
| 1309 |
|
} |
| 1310 |
|
add_action( 'wpinv_send_invoice', 'wpinv_send_customer_invoice' ); |
| 1311 |
|
|
| 1312 |
|
function wpinv_send_overdue_reminder( $data = array() ) { |
|
@@ 1312-1330 (lines=19) @@
|
| 1309 |
|
} |
| 1310 |
|
add_action( 'wpinv_send_invoice', 'wpinv_send_customer_invoice' ); |
| 1311 |
|
|
| 1312 |
|
function wpinv_send_overdue_reminder( $data = array() ) { |
| 1313 |
|
$invoice_id = !empty( $data['invoice_id'] ) ? absint( $data['invoice_id'] ) : NULL; |
| 1314 |
|
|
| 1315 |
|
if ( empty( $invoice_id ) ) { |
| 1316 |
|
return; |
| 1317 |
|
} |
| 1318 |
|
|
| 1319 |
|
if ( !current_user_can( 'manage_options' ) ) { |
| 1320 |
|
wp_die( __( 'You do not have permission to send reminder notification', 'invoicing' ), __( 'Error', 'invoicing' ), array( 'response' => 403 ) ); |
| 1321 |
|
} |
| 1322 |
|
|
| 1323 |
|
$sent = wpinv_send_payment_reminder_notification( $invoice_id ); |
| 1324 |
|
|
| 1325 |
|
$status = $sent ? 'email_sent' : 'email_fail'; |
| 1326 |
|
|
| 1327 |
|
$redirect = add_query_arg( array( 'wpinv-message' => $status, 'wpi_action' => false, 'invoice_id' => false ) ); |
| 1328 |
|
wp_redirect( $redirect ); |
| 1329 |
|
exit; |
| 1330 |
|
} |
| 1331 |
|
add_action( 'wpinv_send_reminder', 'wpinv_send_overdue_reminder' ); |
| 1332 |
|
|
| 1333 |
|
function wpinv_send_customer_note_email( $data ) { |