| @@ -206,9 +206,9 @@ | ||
| 206 | 206 | 'name' => 'issue_date', |
| 207 | 207 | 'required' => true, |
| 208 | 208 | 'grid_cols' => 'sm:col-span-3', |
| 209 | 209 | 'order' => 4, |
| 210 | - 'default_value' => date('Y-m-d'), | |
| 210 | + 'default_value' => current_time('Y-m-d'), | |
| 211 | 211 | 'sanitize_callback' => 'sanitize_text_field', |
| 212 | 212 | 'validate_callback' => function($value) { |
| 213 | 213 | return !empty($value) && strtotime($value) ? true : __('Please enter a valid quote date.', 'easy-invoice'); |
| 214 | 214 | } |
| @@ -221,8 +221,17 @@ | ||
| 221 | 221 | 'name' => 'expiry_date', |
| 222 | 222 | 'required' => true, |
| 223 | 223 | 'grid_cols' => 'sm:col-span-3', |
| 224 | 224 | 'order' => 5, |
| 225 | + // Required but shipped with no default, so saving a brand-new quote | |
| 226 | + // always failed first time with "Expiry Date is required" — the same | |
| 227 | + // defect the invoice form had with its issue/due dates. The quote date | |
| 228 | + // field just above already defaults; this one was missed. | |
| 229 | + // | |
| 230 | + // 30 days matches the validity period used elsewhere in the plugin | |
| 231 | + // (see QuoteController's quote defaults). There is no site setting for | |
| 232 | + // quote validity yet; when one is added, read it here. | |
| 233 | + 'default_value' => gmdate('Y-m-d', strtotime('+30 days', strtotime(current_time('Y-m-d')))), | |
| 225 | 234 | 'sanitize_callback' => 'sanitize_text_field', |
| 226 | 235 | 'validate_callback' => function($value) { |
| 227 | 236 | return !empty($value) && strtotime($value) ? true : __('Please enter a valid expiry date.', 'easy-invoice'); |
| 228 | 237 | } |