@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if (!defined('ABSPATH')) { |
|
11 | 11 | exit; // Exit if accessed directly |
12 | 12 | } |
13 | 13 | |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param WP_Post $post |
23 | 23 | */ |
24 | - public static function output( $post ) { |
|
24 | + public static function output($post) { |
|
25 | 25 | |
26 | 26 | // Prepare the invoice. |
27 | - $invoice = new WPInv_Invoice( $post ); |
|
27 | + $invoice = new WPInv_Invoice($post); |
|
28 | 28 | |
29 | 29 | // Nonce field. |
30 | - wp_nonce_field( 'wpinv_details', 'wpinv_details_nonce' ); |
|
30 | + wp_nonce_field('wpinv_details', 'wpinv_details_nonce'); |
|
31 | 31 | |
32 | 32 | ?> |
33 | 33 | |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | |
46 | 46 | <div class="bsui" style="margin-top: 1.5rem"> |
47 | 47 | |
48 | - <?php do_action( 'getpaid_invoice_edit_before_viewed_by_customer', $invoice ); ?> |
|
49 | - <?php if ( ! $invoice->is_draft() ) : ?> |
|
48 | + <?php do_action('getpaid_invoice_edit_before_viewed_by_customer', $invoice); ?> |
|
49 | + <?php if (!$invoice->is_draft()) : ?> |
|
50 | 50 | <div class="form-group mb-3"> |
51 | - <strong><?php esc_html_e( 'Viewed by Customer:', 'invoicing' ); ?></strong> |
|
52 | - <?php ( $invoice->get_is_viewed() ) ? esc_html_e( 'Yes', 'invoicing' ) : esc_html_e( 'No', 'invoicing' ); ?> |
|
51 | + <strong><?php esc_html_e('Viewed by Customer:', 'invoicing'); ?></strong> |
|
52 | + <?php ($invoice->get_is_viewed()) ? esc_html_e('Yes', 'invoicing') : esc_html_e('No', 'invoicing'); ?> |
|
53 | 53 | </div> |
54 | 54 | <?php endif; ?> |
55 | 55 | |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | // Date created. |
59 | 59 | $label = sprintf( |
60 | 60 | // translators: %s is the invoice type. |
61 | - __( '%s Date:', 'invoicing' ), |
|
62 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
61 | + __('%s Date:', 'invoicing'), |
|
62 | + ucfirst($invoice->get_invoice_quote_type()) |
|
63 | 63 | ); |
64 | 64 | |
65 | - $info = sprintf( |
|
65 | + $info = sprintf( |
|
66 | 66 | // translators: %s is the invoice type. |
67 | - __( 'The date this %s was created.', 'invoicing' ), |
|
68 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
67 | + __('The date this %s was created.', 'invoicing'), |
|
68 | + strtolower($invoice->get_invoice_quote_type()) |
|
69 | 69 | ); |
70 | 70 | |
71 | 71 | aui()->input( |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | 'type' => 'datepicker', |
74 | 74 | 'id' => 'wpinv_date_created', |
75 | 75 | 'name' => 'date_created', |
76 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
76 | + 'label' => $label . getpaid_get_help_tip($info), |
|
77 | 77 | 'label_type' => 'vertical', |
78 | 78 | 'placeholder' => 'YYYY-MM-DD 00:00', |
79 | 79 | 'class' => 'form-control-sm', |
80 | - 'value' => $invoice->get_date_created( 'edit' ), |
|
80 | + 'value' => $invoice->get_date_created('edit'), |
|
81 | 81 | 'extra_attributes' => array( |
82 | 82 | 'data-enable-time' => 'true', |
83 | 83 | 'data-time_24hr' => 'true', |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | 'type' => 'datepicker', |
95 | 95 | 'id' => 'wpinv_date_completed', |
96 | 96 | 'name' => 'wpinv_date_completed', |
97 | - 'label' => __( 'Date Completed:', 'invoicing' ), |
|
97 | + 'label' => __('Date Completed:', 'invoicing'), |
|
98 | 98 | 'label_type' => 'vertical', |
99 | 99 | 'placeholder' => 'YYYY-MM-DD 00:00', |
100 | 100 | 'class' => 'form-control-sm', |
101 | - 'value' => $invoice->get_date_completed( 'edit' ), |
|
101 | + 'value' => $invoice->get_date_completed('edit'), |
|
102 | 102 | 'extra_attributes' => array( |
103 | 103 | 'data-enable-time' => 'true', |
104 | 104 | 'data-time_24hr' => 'true', |
@@ -110,18 +110,18 @@ discard block |
||
110 | 110 | ); |
111 | 111 | |
112 | 112 | // Due date. |
113 | - if ( $invoice->is_type( 'invoice' ) && wpinv_get_option( 'overdue_active' ) && ( ! $invoice->is_paid() || $invoice->is_draft() ) ) { |
|
113 | + if ($invoice->is_type('invoice') && wpinv_get_option('overdue_active') && (!$invoice->is_paid() || $invoice->is_draft())) { |
|
114 | 114 | |
115 | 115 | aui()->input( |
116 | 116 | array( |
117 | 117 | 'type' => 'datepicker', |
118 | 118 | 'id' => 'wpinv_due_date', |
119 | 119 | 'name' => 'wpinv_due_date', |
120 | - 'label' => __( 'Due Date:', 'invoicing' ) . getpaid_get_help_tip( __( 'Leave blank to disable automated reminder emails for this invoice.', 'invoicing' ) ), |
|
120 | + 'label' => __('Due Date:', 'invoicing') . getpaid_get_help_tip(__('Leave blank to disable automated reminder emails for this invoice.', 'invoicing')), |
|
121 | 121 | 'label_type' => 'vertical', |
122 | - 'placeholder' => __( 'No due date', 'invoicing' ), |
|
122 | + 'placeholder' => __('No due date', 'invoicing'), |
|
123 | 123 | 'class' => 'form-control-sm', |
124 | - 'value' => $invoice->get_due_date( 'edit' ), |
|
124 | + 'value' => $invoice->get_due_date('edit'), |
|
125 | 125 | 'extra_attributes' => array( |
126 | 126 | 'data-enable-time' => 'true', |
127 | 127 | 'data-time_24hr' => 'true', |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | |
135 | 135 | } |
136 | 136 | |
137 | - do_action( 'wpinv_meta_box_details_after_due_date', $invoice->get_id() ); |
|
138 | - do_action( 'getpaid_metabox_after_due_date', $invoice ); |
|
137 | + do_action('wpinv_meta_box_details_after_due_date', $invoice->get_id()); |
|
138 | + do_action('getpaid_metabox_after_due_date', $invoice); |
|
139 | 139 | |
140 | 140 | // Status. |
141 | 141 | $label = sprintf( |
142 | 142 | // translators: %s: Invoice type. |
143 | - __( '%s Status:', 'invoicing' ), |
|
144 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
143 | + __('%s Status:', 'invoicing'), |
|
144 | + ucfirst($invoice->get_invoice_quote_type()) |
|
145 | 145 | ); |
146 | 146 | |
147 | - $status = $invoice->get_status( 'edit' ); |
|
147 | + $status = $invoice->get_status('edit'); |
|
148 | 148 | aui()->select( |
149 | 149 | array( |
150 | 150 | 'id' => 'wpinv_status', |
151 | 151 | 'name' => 'wpinv_status', |
152 | 152 | 'label' => $label, |
153 | 153 | 'label_type' => 'vertical', |
154 | - 'placeholder' => __( 'Select Status', 'invoicing' ), |
|
155 | - 'value' => array_key_exists( $status, $invoice->get_all_statuses() ) ? $status : $invoice->get_default_status(), |
|
154 | + 'placeholder' => __('Select Status', 'invoicing'), |
|
155 | + 'value' => array_key_exists($status, $invoice->get_all_statuses()) ? $status : $invoice->get_default_status(), |
|
156 | 156 | 'select2' => true, |
157 | 157 | 'data-allow-clear' => 'false', |
158 | - 'options' => wpinv_get_invoice_statuses( true, false, $invoice ), |
|
158 | + 'options' => wpinv_get_invoice_statuses(true, false, $invoice), |
|
159 | 159 | ), |
160 | 160 | true |
161 | 161 | ); |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | // Invoice number. |
164 | 164 | $label = sprintf( |
165 | 165 | // translators: %s: Invoice type. |
166 | - __( '%s Number:', 'invoicing' ), |
|
167 | - ucfirst( $invoice->get_invoice_quote_type() ) |
|
166 | + __('%s Number:', 'invoicing'), |
|
167 | + ucfirst($invoice->get_invoice_quote_type()) |
|
168 | 168 | ); |
169 | 169 | |
170 | - $info = sprintf( |
|
170 | + $info = sprintf( |
|
171 | 171 | // translators: %s: Invoice type. |
172 | - __( 'Each %s number must be unique.', 'invoicing' ), |
|
173 | - strtolower( $invoice->get_invoice_quote_type() ) |
|
172 | + __('Each %s number must be unique.', 'invoicing'), |
|
173 | + strtolower($invoice->get_invoice_quote_type()) |
|
174 | 174 | ); |
175 | 175 | |
176 | 176 | aui()->input( |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | 'type' => 'text', |
179 | 179 | 'id' => 'wpinv_number', |
180 | 180 | 'name' => 'wpinv_number', |
181 | - 'label' => $label . getpaid_get_help_tip( $info ), |
|
181 | + 'label' => $label . getpaid_get_help_tip($info), |
|
182 | 182 | 'label_type' => 'vertical', |
183 | - 'placeholder' => __( 'Autogenerate', 'invoicing' ), |
|
183 | + 'placeholder' => __('Autogenerate', 'invoicing'), |
|
184 | 184 | 'class' => 'form-control-sm', |
185 | - 'value' => $invoice->get_number( 'edit' ), |
|
185 | + 'value' => $invoice->get_number('edit'), |
|
186 | 186 | ), |
187 | 187 | true |
188 | 188 | ); |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | 'type' => 'text', |
194 | 194 | 'id' => 'wpinv_cc', |
195 | 195 | 'name' => 'wpinv_cc', |
196 | - 'label' => __( 'Email CC:', 'invoicing' ) . getpaid_get_help_tip( __( 'Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing' ) ), |
|
196 | + 'label' => __('Email CC:', 'invoicing') . getpaid_get_help_tip(__('Enter a comma separated list of other emails that should be notified about the invoice.', 'invoicing')), |
|
197 | 197 | 'label_type' => 'vertical', |
198 | - 'placeholder' => __( '[email protected], [email protected]', 'invoicing' ), |
|
198 | + 'placeholder' => __('[email protected], [email protected]', 'invoicing'), |
|
199 | 199 | 'class' => 'form-control-sm', |
200 | - 'value' => $invoice->get_email_cc( 'edit' ), |
|
200 | + 'value' => $invoice->get_email_cc('edit'), |
|
201 | 201 | ), |
202 | 202 | true |
203 | 203 | ); |
204 | 204 | |
205 | - if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) { |
|
205 | + if (!$invoice->is_paid() && !$invoice->is_refunded()) { |
|
206 | 206 | |
207 | 207 | // Apply a discount. |
208 | 208 | aui()->input( |
@@ -210,26 +210,26 @@ discard block |
||
210 | 210 | 'type' => 'text', |
211 | 211 | 'id' => 'wpinv_discount_code', |
212 | 212 | 'name' => 'wpinv_discount_code', |
213 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
214 | - 'placeholder' => __( 'Apply Discount', 'invoicing' ), |
|
213 | + 'label' => __('Discount Code:', 'invoicing'), |
|
214 | + 'placeholder' => __('Apply Discount', 'invoicing'), |
|
215 | 215 | 'label_type' => 'vertical', |
216 | 216 | 'class' => 'form-control-sm getpaid-recalculate-prices-on-change', |
217 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
217 | + 'value' => $invoice->get_discount_code('edit'), |
|
218 | 218 | ), |
219 | 219 | true |
220 | 220 | ); |
221 | 221 | |
222 | - } elseif ( $invoice->get_discount_code( 'edit' ) ) { |
|
222 | + } elseif ($invoice->get_discount_code('edit')) { |
|
223 | 223 | |
224 | 224 | aui()->input( |
225 | 225 | array( |
226 | 226 | 'type' => 'text', |
227 | 227 | 'id' => 'wpinv_discount_code', |
228 | 228 | 'name' => 'wpinv_discount_code', |
229 | - 'label' => __( 'Discount Code:', 'invoicing' ), |
|
229 | + 'label' => __('Discount Code:', 'invoicing'), |
|
230 | 230 | 'label_type' => 'vertical', |
231 | 231 | 'class' => 'form-control-sm', |
232 | - 'value' => $invoice->get_discount_code( 'edit' ), |
|
232 | + 'value' => $invoice->get_discount_code('edit'), |
|
233 | 233 | 'extra_attributes' => array( |
234 | 234 | 'onclick' => 'this.select();', |
235 | 235 | 'readonly' => 'true', |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | |
241 | 241 | } |
242 | 242 | |
243 | - do_action( 'wpinv_meta_box_details_inner', $invoice->get_id() ); |
|
243 | + do_action('wpinv_meta_box_details_inner', $invoice->get_id()); |
|
244 | 244 | |
245 | 245 | // Disable taxes. |
246 | - if ( wpinv_use_taxes() && ! ( $invoice->is_paid() || $invoice->is_refunded() ) ) { |
|
246 | + if (wpinv_use_taxes() && !($invoice->is_paid() || $invoice->is_refunded())) { |
|
247 | 247 | |
248 | 248 | aui()->input( |
249 | 249 | array( |
250 | 250 | 'id' => 'wpinv_taxable', |
251 | 251 | 'name' => 'disable_taxes', |
252 | 252 | 'type' => 'checkbox', |
253 | - 'label' => __( 'Disable taxes', 'invoicing' ), |
|
253 | + 'label' => __('Disable taxes', 'invoicing'), |
|
254 | 254 | 'value' => '1', |
255 | 255 | 'checked' => (bool) $invoice->get_disable_taxes(), |
256 | 256 | 'class' => 'getpaid-recalculate-prices-on-change', |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | } |
262 | 262 | |
263 | - if ( $invoice->is_type( 'invoice' ) ) { |
|
263 | + if ($invoice->is_type('invoice')) { |
|
264 | 264 | |
265 | 265 | // Send to customer. |
266 | 266 | aui()->input( |
@@ -268,16 +268,16 @@ discard block |
||
268 | 268 | 'id' => 'wpinv_send_to_customer', |
269 | 269 | 'name' => 'send_to_customer', |
270 | 270 | 'type' => 'checkbox', |
271 | - 'label' => __( 'Send invoice to customer after saving', 'invoicing' ), |
|
271 | + 'label' => __('Send invoice to customer after saving', 'invoicing'), |
|
272 | 272 | 'value' => '1', |
273 | - 'checked' => $invoice->is_draft() && (bool) wpinv_get_option( 'email_user_invoice_active', true ), |
|
273 | + 'checked' => $invoice->is_draft() && (bool) wpinv_get_option('email_user_invoice_active', true), |
|
274 | 274 | ), |
275 | 275 | true |
276 | 276 | ); |
277 | 277 | |
278 | 278 | } |
279 | 279 | |
280 | - do_action( 'getpaid_metabox_after_invoice_details', $invoice ); |
|
280 | + do_action('getpaid_metabox_after_invoice_details', $invoice); |
|
281 | 281 | |
282 | 282 | ?> |
283 | 283 |