PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.0
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.0
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 | includes/Forms/Invoice/InvoiceFieldRegistration.php +44 -0 2.3.62.4.0 View file →
@@ -198,8 +198,18 @@
198 198 'label' => __('Issue Date', 'easy-invoice'),
199 199 'required' => true,
200 200 'grid_cols' => 'sm:col-span-3',
201 201 'order' => 4,
202 + // Both date fields are `required` but shipped with no default, so a
203 + // brand-new invoice always failed its first save with "Issue Date is
204 + // required / Due Date is required" — while the live preview beside the
205 + // form was already showing dates, which made the error look wrong.
206 + // The quote form has always defaulted its date this way.
207 + //
208 + // current_time() rather than gmdate(): gmdate() uses the server timezone,
209 + // so a site ahead of or behind UTC could get yesterday's or tomorrow's
210 + // date on a new invoice.
211 + 'default_value' => current_time('Y-m-d'),
202 212 'sanitize_callback' => 'sanitize_text_field',
203 213 'validate_callback' => function($value) {
204 214 return !empty($value) && strtotime($value) ? true : __('Please enter a valid issue date.', 'easy-invoice');
205 215 }
@@ -211,8 +221,16 @@
211 221 'label' => __('Due Date', 'easy-invoice'),
212 222 'required' => true,
213 223 'grid_cols' => 'sm:col-span-3',
214 224 'order' => 5,
225 + // Defaults to issue date + the configured payment term
226 + // (Settings → Invoice → "Due days", default 30) rather than a
227 + // hardcoded value, so the prefilled date matches the terms the site
228 + // actually bills on. See the note on issue_date above.
229 + 'default_value' => gmdate('Y-m-d', strtotime(
230 + '+' . max(0, (int) get_option('easy_invoice_invoice_due_days', 30)) . ' days',
231 + strtotime(current_time('Y-m-d'))
232 + )),
215 233 'sanitize_callback' => 'sanitize_text_field',
216 234 'validate_callback' => function($value) {
217 235 return !empty($value) && strtotime($value) ? true : __('Please enter a valid due date.', 'easy-invoice');
218 236 }
@@ -232,8 +250,34 @@
232 250 'unpaid' => __('Unpaid', 'easy-invoice'),
233 251 'cancelled' => __('Cancelled', 'easy-invoice')
234 252 ],
235 253 'order' => 6
254 + ],
255 + // Customer tax identity. FormProcessor stores a field as
256 + // '_easy_invoice_' . $name, so these land on the meta keys
257 + // Services\TaxTreatment reads when deciding whether an invoice is a
258 + // cross-border reverse charge or an export.
259 + [
260 + 'tab_id' => 'invoice-tab',
261 + 'name' => 'customer_vat_number',
262 + 'type' => 'text',
263 + 'label' => __('Customer VAT number', 'easy-invoice'),
264 + 'placeholder' => __('e.g. FR12345678901', 'easy-invoice'),
265 + 'grid_cols' => 'sm:col-span-3',
266 + 'section' => 'notes',
267 + 'order' => 4,
268 + 'description' => __('Needed to invoice a VAT-registered business in another country without charging VAT.', 'easy-invoice'),
269 + ],
270 + [
271 + 'tab_id' => 'invoice-tab',
272 + 'name' => 'customer_country',
273 + 'type' => 'text',
274 + 'label' => __('Customer country', 'easy-invoice'),
275 + 'placeholder' => __('e.g. FR', 'easy-invoice'),
276 + 'grid_cols' => 'sm:col-span-3',
277 + 'section' => 'notes',
278 + 'order' => 5,
279 + 'description' => __('Two-letter country code.', 'easy-invoice'),
236 280 ],
237 281 [
238 282 'tab_id' => 'invoice-tab',
239 283 'name' => 'notes',