| @@ 246-254 (lines=9) @@ | ||
| 243 | return $invoice; |
|
| 244 | } |
|
| 245 | ||
| 246 | if ( $wp_error ) { |
|
| 247 | if ( is_wp_error( $invoice ) ) { |
|
| 248 | return $invoice; |
|
| 249 | } else { |
|
| 250 | return new WP_Error( 'wpinv_insert_invoice_error', __( 'Error in insert invoice.', 'invoicing' ) ); |
|
| 251 | } |
|
| 252 | } else { |
|
| 253 | return 0; |
|
| 254 | } |
|
| 255 | } |
|
| 256 | ||
| 257 | function wpinv_update_invoice( $invoice_data = array(), $wp_error = false ) { |
|
| @@ 431-439 (lines=9) @@ | ||
| 428 | $invoice->save(); |
|
| 429 | ||
| 430 | if ( empty( $invoice->ID ) || is_wp_error( $invoice ) ) { |
|
| 431 | if ( $wp_error ) { |
|
| 432 | if ( is_wp_error( $invoice ) ) { |
|
| 433 | return $invoice; |
|
| 434 | } else { |
|
| 435 | return new WP_Error( 'wpinv_update_invoice_error', __( 'Error in update invoice.', 'invoicing' ) ); |
|
| 436 | } |
|
| 437 | } else { |
|
| 438 | return 0; |
|
| 439 | } |
|
| 440 | } |
|
| 441 | ||
| 442 | // Add private note |
|