PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.2
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.2
2.4.3 2.4.4 2.4.2 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 All 60 releases
← All changes | templates/invoices/builder.php +17 -6 2.2.0 → 2.4.2 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
@@ -131,9 +145,8 @@
131 145 }
132 146 ?>
133 147
134 148 <div id="easy-invoice-content" class="h-screen flex flex-col bg-gray-50">
135 - <!-- Header -->
136 149 <header class="ei-invoice-builder-header ei-app-header-sync bg-white border-b border-gray-200 shadow-sm w-full z-10 box-border">
137 150 <div class="max-w-full mx-auto h-full px-4 sm:px-5">
138 151 <div class="ei-app-header-inner flex flex-col gap-3 py-3 sm:gap-4 lg:flex-row lg:items-center lg:justify-between lg:gap-6 lg:py-0 lg:h-full">
139 152 <div class="ei-app-header-leading flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center sm:gap-4">
@@ -174,9 +187,8 @@
174 187 </div>
175 188 </div>
176 189 </header>
177 190
178 - <!-- Main Content -->
179 191 <div class="flex-grow overflow-y-auto min-h-0">
180 192 <div class="max-w-full mx-auto px-4 sm:px-5 py-4 sm:py-5">
181 193 <div class="ei-builder-tabs lg:hidden flex rounded-lg bg-gray-100 p-1 gap-1 mb-4" role="tablist" aria-label="<?php echo esc_attr__( 'Editor panels', 'easy-invoice' ); ?>">
182 194 <button type="button" role="tab" class="ei-builder-tab flex-1 rounded-md py-2 text-sm font-medium transition bg-white shadow-sm text-indigo-700" data-tab="editor" aria-selected="true"><?php esc_html_e( 'Editor', 'easy-invoice' ); ?></button>
@@ -201,9 +213,8 @@
201 213 <?php include_once EASY_INVOICE_PLUGIN_DIR . 'templates/invoices/live-preview.php'; ?>
202 214 </div>
203 215 </div>
204 216
205 - <!-- Add Client Modal -->
206 217 <div id="add_client_modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-75 overflow-y-auto h-full w-full z-50" role="dialog" aria-modal="true" aria-labelledby="ei-add-client-title">
207 218 <div class="relative top-20 mx-auto p-5 border w-11/12 md:w-2/3 lg:w-1/2 shadow-lg rounded-md bg-white">
208 219 <div class="flex justify-between items-center mb-4">
209 220 <h3 id="ei-add-client-title" class="text-lg font-medium text-gray-900"><?php esc_html_e( 'Add new client', 'easy-invoice' ); ?></h3>