PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.1
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.1
2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.2 All 57 releases
← All changes | templates/invoices/builder.php +17 -3 2.3.4 → 2.4.1 View file →
@@ -14,8 +14,20 @@
14 14
15 15
16 16 // Get invoice ID if present in URL
17 17 $invoice_id = isset($_GET['invoice_id']) ? intval($_GET['invoice_id']) : 0;
18 +// A stale link (an invoice deleted since, or a quote id pasted here) must not fall
19 +// through to the editor and preview as if it were a new invoice.
20 +if ( $invoice_id > 0 ) {
21 + $ei_builder_post = get_post( $invoice_id );
22 + if ( ! $ei_builder_post || \EasyInvoice\Constants\PostTypes::EASY_INVOICE_POST_TYPE !== $ei_builder_post->post_type ) {
23 + wp_die(
24 + esc_html__( 'That invoice does not exist or has been deleted.', 'easy-invoice' ),
25 + esc_html__( 'Invoice not found', 'easy-invoice' ),
26 + array( 'back_link' => true, 'response' => 404 )
27 + );
28 + }
29 +}
18 30 $invoice = null;
19 31
20 32 // Check if this is a new invoice (no ID)
21 33 $is_new_invoice = ($invoice_id === 0);
@@ -23,10 +35,10 @@
23 35 // Default values for new invoice
24 36 $invoice_number_service = easy_invoice_get_invoice_number_service();
25 37 $invoice_data = array(
26 38 'number' => $invoice_number_service->getNextNumber(),
27 - 'date' => date('Y-m-d'),
28 - 'due_date' => date('Y-m-d', strtotime('+30 days')),
39 + 'date' => current_time('Y-m-d'),
40 + 'due_date' => wp_date('Y-m-d', strtotime('+30 days')),
29 41 'client_id' => '',
30 42 'client_name' => '',
31 43 'client_email' => '',
32 44 'client_phone' => '',
@@ -51,9 +63,11 @@
51 63 );
52 64
53 65 // Load clients for the dropdown
54 66 $client_repository = ClientServiceProvider::getClientRepository();
55 -$clients = $client_repository->all();
67 +// The hidden #select-client mirror only needs the document's own client; the picker
68 +// searches over AJAX. Loading every client here built a model per user on each open.
69 +$clients = [];
56 70
57 71 // If editing an existing invoice, load its data
58 72 if ($invoice_id > 0) {
59 73 // Get the invoice from repository