|
@@ 220-268 (lines=49) @@
|
| 217 |
|
return $sent; |
| 218 |
|
} |
| 219 |
|
|
| 220 |
|
function wpinv_onhold_invoice_notification( $invoice_id, $new_status = '' ) { |
| 221 |
|
$email_type = 'onhold_invoice'; |
| 222 |
|
if ( !wpinv_email_is_enabled( $email_type ) ) { |
| 223 |
|
return false; |
| 224 |
|
} |
| 225 |
|
|
| 226 |
|
$invoice = wpinv_get_invoice( $invoice_id ); |
| 227 |
|
if ( empty( $invoice ) ) { |
| 228 |
|
return false; |
| 229 |
|
} |
| 230 |
|
|
| 231 |
|
if ( !("wpi_invoice" === $invoice->post_type) ) { |
| 232 |
|
return false; |
| 233 |
|
} |
| 234 |
|
|
| 235 |
|
$recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
| 236 |
|
if ( !is_email( $recipient ) ) { |
| 237 |
|
return false; |
| 238 |
|
} |
| 239 |
|
|
| 240 |
|
do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type ); |
| 241 |
|
|
| 242 |
|
$subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
| 243 |
|
$email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
| 244 |
|
$headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
| 245 |
|
$message_body = wpinv_email_get_content( $email_type, $invoice_id, $invoice ); |
| 246 |
|
$attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
| 247 |
|
|
| 248 |
|
$content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
| 249 |
|
'invoice' => $invoice, |
| 250 |
|
'email_type' => $email_type, |
| 251 |
|
'email_heading' => $email_heading, |
| 252 |
|
'sent_to_admin' => false, |
| 253 |
|
'plain_text' => false, |
| 254 |
|
'message_body' => $message_body, |
| 255 |
|
) ); |
| 256 |
|
|
| 257 |
|
$sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
| 258 |
|
|
| 259 |
|
if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
| 260 |
|
$recipient = wpinv_get_admin_email(); |
| 261 |
|
$subject .= ' - ADMIN BCC COPY'; |
| 262 |
|
wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type ); |
| 266 |
|
|
| 267 |
|
return $sent; |
| 268 |
|
} |
| 269 |
|
|
| 270 |
|
function wpinv_processing_invoice_notification( $invoice_id, $new_status = '' ) { |
| 271 |
|
$email_type = 'processing_invoice'; |
|
@@ 325-373 (lines=49) @@
|
| 322 |
|
return $sent; |
| 323 |
|
} |
| 324 |
|
|
| 325 |
|
function wpinv_completed_invoice_notification( $invoice_id, $new_status = '' ) { |
| 326 |
|
$email_type = 'completed_invoice'; |
| 327 |
|
if ( !wpinv_email_is_enabled( $email_type ) ) { |
| 328 |
|
return false; |
| 329 |
|
} |
| 330 |
|
|
| 331 |
|
$invoice = wpinv_get_invoice( $invoice_id ); |
| 332 |
|
if ( empty( $invoice ) ) { |
| 333 |
|
return false; |
| 334 |
|
} |
| 335 |
|
|
| 336 |
|
if ( !("wpi_invoice" === $invoice->post_type) ) { |
| 337 |
|
return false; |
| 338 |
|
} |
| 339 |
|
|
| 340 |
|
$recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
| 341 |
|
if ( !is_email( $recipient ) ) { |
| 342 |
|
return false; |
| 343 |
|
} |
| 344 |
|
|
| 345 |
|
do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type ); |
| 346 |
|
|
| 347 |
|
$subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
| 348 |
|
$email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
| 349 |
|
$headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
| 350 |
|
$message_body = wpinv_email_get_content( $email_type, $invoice_id, $invoice ); |
| 351 |
|
$attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
| 352 |
|
|
| 353 |
|
$content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
| 354 |
|
'invoice' => $invoice, |
| 355 |
|
'email_type' => $email_type, |
| 356 |
|
'email_heading' => $email_heading, |
| 357 |
|
'sent_to_admin' => false, |
| 358 |
|
'plain_text' => false, |
| 359 |
|
'message_body' => $message_body, |
| 360 |
|
) ); |
| 361 |
|
|
| 362 |
|
$sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
| 363 |
|
|
| 364 |
|
if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
| 365 |
|
$recipient = wpinv_get_admin_email(); |
| 366 |
|
$subject .= ' - ADMIN BCC COPY'; |
| 367 |
|
wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
| 368 |
|
} |
| 369 |
|
|
| 370 |
|
do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type ); |
| 371 |
|
|
| 372 |
|
return $sent; |
| 373 |
|
} |
| 374 |
|
|
| 375 |
|
function wpinv_fully_refunded_notification( $invoice_id, $new_status = '' ) { |
| 376 |
|
$email_type = 'refunded_invoice'; |
|
@@ 375-424 (lines=50) @@
|
| 372 |
|
return $sent; |
| 373 |
|
} |
| 374 |
|
|
| 375 |
|
function wpinv_fully_refunded_notification( $invoice_id, $new_status = '' ) { |
| 376 |
|
$email_type = 'refunded_invoice'; |
| 377 |
|
if ( !wpinv_email_is_enabled( $email_type ) ) { |
| 378 |
|
return false; |
| 379 |
|
} |
| 380 |
|
|
| 381 |
|
$invoice = wpinv_get_invoice( $invoice_id ); |
| 382 |
|
if ( empty( $invoice ) ) { |
| 383 |
|
return false; |
| 384 |
|
} |
| 385 |
|
|
| 386 |
|
if ( !("wpi_invoice" === $invoice->post_type) ) { |
| 387 |
|
return false; |
| 388 |
|
} |
| 389 |
|
|
| 390 |
|
$recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
| 391 |
|
if ( !is_email( $recipient ) ) { |
| 392 |
|
return false; |
| 393 |
|
} |
| 394 |
|
|
| 395 |
|
do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type ); |
| 396 |
|
|
| 397 |
|
$subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
| 398 |
|
$email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
| 399 |
|
$headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
| 400 |
|
$message_body = wpinv_email_get_content( $email_type, $invoice_id, $invoice ); |
| 401 |
|
$attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
| 402 |
|
|
| 403 |
|
$content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
| 404 |
|
'invoice' => $invoice, |
| 405 |
|
'email_type' => $email_type, |
| 406 |
|
'email_heading' => $email_heading, |
| 407 |
|
'sent_to_admin' => false, |
| 408 |
|
'plain_text' => false, |
| 409 |
|
'partial_refund' => false, |
| 410 |
|
'message_body' => $message_body, |
| 411 |
|
) ); |
| 412 |
|
|
| 413 |
|
$sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
| 414 |
|
|
| 415 |
|
if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
| 416 |
|
$recipient = wpinv_get_admin_email(); |
| 417 |
|
$subject .= ' - ADMIN BCC COPY'; |
| 418 |
|
wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
| 419 |
|
} |
| 420 |
|
|
| 421 |
|
do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type ); |
| 422 |
|
|
| 423 |
|
return $sent; |
| 424 |
|
} |
| 425 |
|
|
| 426 |
|
function wpinv_partially_refunded_notification( $invoice_id, $new_status = '' ) { |
| 427 |
|
$email_type = 'refunded_invoice'; |
|
@@ 426-475 (lines=50) @@
|
| 423 |
|
return $sent; |
| 424 |
|
} |
| 425 |
|
|
| 426 |
|
function wpinv_partially_refunded_notification( $invoice_id, $new_status = '' ) { |
| 427 |
|
$email_type = 'refunded_invoice'; |
| 428 |
|
if ( !wpinv_email_is_enabled( $email_type ) ) { |
| 429 |
|
return false; |
| 430 |
|
} |
| 431 |
|
|
| 432 |
|
$invoice = wpinv_get_invoice( $invoice_id ); |
| 433 |
|
if ( empty( $invoice ) ) { |
| 434 |
|
return false; |
| 435 |
|
} |
| 436 |
|
|
| 437 |
|
if ( !("wpi_invoice" === $invoice->post_type) ) { |
| 438 |
|
return false; |
| 439 |
|
} |
| 440 |
|
|
| 441 |
|
$recipient = wpinv_email_get_recipient( $email_type, $invoice_id, $invoice ); |
| 442 |
|
if ( !is_email( $recipient ) ) { |
| 443 |
|
return false; |
| 444 |
|
} |
| 445 |
|
|
| 446 |
|
do_action( 'wpinv_pre_send_invoice_notification', $invoice, $email_type ); |
| 447 |
|
|
| 448 |
|
$subject = wpinv_email_get_subject( $email_type, $invoice_id, $invoice ); |
| 449 |
|
$email_heading = wpinv_email_get_heading( $email_type, $invoice_id, $invoice ); |
| 450 |
|
$headers = wpinv_email_get_headers( $email_type, $invoice_id, $invoice ); |
| 451 |
|
$message_body = wpinv_email_get_content( $email_type, $invoice_id, $invoice ); |
| 452 |
|
$attachments = wpinv_email_get_attachments( $email_type, $invoice_id, $invoice ); |
| 453 |
|
|
| 454 |
|
$content = wpinv_get_template_html( 'emails/wpinv-email-' . $email_type . '.php', array( |
| 455 |
|
'invoice' => $invoice, |
| 456 |
|
'email_type' => $email_type, |
| 457 |
|
'email_heading' => $email_heading, |
| 458 |
|
'sent_to_admin' => false, |
| 459 |
|
'plain_text' => false, |
| 460 |
|
'partial_refund' => true, |
| 461 |
|
'message_body' => $message_body, |
| 462 |
|
) ); |
| 463 |
|
|
| 464 |
|
$sent = wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
| 465 |
|
|
| 466 |
|
if ( wpinv_mail_admin_bcc_active( $email_type ) ) { |
| 467 |
|
$recipient = wpinv_get_admin_email(); |
| 468 |
|
$subject .= ' - ADMIN BCC COPY'; |
| 469 |
|
wpinv_mail_send( $recipient, $subject, $content, $headers, $attachments ); |
| 470 |
|
} |
| 471 |
|
|
| 472 |
|
do_action( 'wpinv_post_send_invoice_notification', $invoice, $email_type ); |
| 473 |
|
|
| 474 |
|
return $sent; |
| 475 |
|
} |
| 476 |
|
|
| 477 |
|
function wpinv_new_invoice_note_notification( $invoice_id, $new_status = '' ) { |
| 478 |
|
} |