PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 3.17.0
GiveWP – Donation Plugin and Fundraising Platform v3.17.0
4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / includes / admin / payments / view-payment-details.php
give / includes / admin / payments Last commit date
actions.php 3 years ago class-payments-table.php 2 years ago payments-history.php 4 years ago view-payment-details.php 2 years ago
view-payment-details.php
1018 lines
1 <?php
2 /**
3 * View Donation Details
4 *
5 * @package Give
6 * @subpackage Admin/Payments
7 * @copyright Copyright (c) 2016, GiveWP
8 * @license https://opensource.org/licenses/gpl-license GNU Public License
9 * @since 1.0
10 */
11
12 use Give\Donations\Models\Donation;
13 use Give\Donations\ValueObjects\DonationMetaKeys;
14 use Give\Donors\Models\Donor;
15
16 // Exit if accessed directly.
17 if (!defined('ABSPATH')) {
18 exit;
19 }
20
21 if (!current_user_can('view_give_payments')) {
22 wp_die(
23 __('Sorry, you are not allowed to access this page.', 'give'),
24 __('Error', 'give'),
25 array(
26 'response' => 403,
27 )
28 );
29 }
30
31 /**
32 * View donation details page
33 *
34 * @since 3.9.0 Add donor phone number to the view
35 * @since 1.0
36 * @return void
37 */
38 if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) {
39 wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
40 }
41
42 // Setup the variables
43 $payment_id = absint( $_GET['id'] );
44 $payment = new Give_Payment( $payment_id );
45
46 // Sanity check... fail if donation ID is invalid
47 $payment_exists = $payment->ID;
48 if ( empty( $payment_exists ) ) {
49 wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) );
50 }
51
52 $number = $payment->number;
53 $payment_meta = $payment->get_meta();
54
55 $company_name = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : '';
56 $transaction_id = esc_attr( $payment->transaction_id );
57 $user_id = $payment->user_id;
58 $donor_id = $payment->customer_id;
59 $payment_date = strtotime( $payment->date );
60 $user_info = give_get_payment_meta_user_info( $payment_id );
61 $address = $payment->address;
62 $currency_code = $payment->currency;
63 $gateway = $payment->gateway;
64 $currency_code = $payment->currency;
65 $payment_mode = $payment->mode;
66 $base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' );
67 $donation_phone_number = Donation::find($payment_id)->phone;
68 $donor_phone_number = Donor::find($donor_id)->phone;
69
70 ?>
71 <div class="wrap give-wrap">
72
73 <h1 id="transaction-details-heading" class="wp-heading-inline">
74 <?php
75 printf(
76 /* translators: %s: donation number */
77 esc_html__( 'Donation %s', 'give' ),
78 $number
79 );
80 if ( $payment_mode == 'test' ) {
81 echo Give()->tooltips->render_span(
82 array(
83 'label' => __( 'This donation was made in test mode.', 'give' ),
84 'tag_content' => __( 'Test Donation', 'give' ),
85 'position' => 'right',
86 'attributes' => array(
87 'id' => 'test-payment-label',
88 'class' => 'give-item-label give-item-label-orange',
89 ),
90 )
91 );
92 }
93 ?>
94 </h1>
95
96 <?php
97 /**
98 * Fires in donation details page, before the page content and after the H1 title output.
99 *
100 * @since 1.0
101 *
102 * @param int $payment_id Payment id.
103 */
104 do_action( 'give_view_donation_details_before', $payment_id );
105 ?>
106
107 <hr class="wp-header-end">
108
109 <form id="give-edit-order-form" method="post">
110 <?php
111 /**
112 * Fires in donation details page, in the form before the order details.
113 *
114 * @since 1.0
115 *
116 * @param int $payment_id Payment id.
117 */
118 do_action( 'give_view_donation_details_form_top', $payment_id );
119 ?>
120 <div id="poststuff" class="give-clearfix">
121 <div id="give-dashboard-widgets-wrap">
122 <div id="post-body" class="metabox-holder columns-2">
123 <div id="postbox-container-1" class="postbox-container">
124 <div id="side-sortables" class="meta-box-sortables ui-sortable">
125
126 <?php
127 /**
128 * Fires in donation details page, before the sidebar.
129 *
130 * @since 1.0
131 *
132 * @param int $payment_id Payment id.
133 */
134 do_action( 'give_view_donation_details_sidebar_before', $payment_id );
135 ?>
136
137 <div id="give-order-update" class="postbox give-order-data">
138
139 <div class="give-order-top">
140 <h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3>
141
142 <?php
143 if ( current_user_can( 'view_give_payments' ) ) {
144 echo sprintf(
145 '<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>',
146 $payment_id,
147 esc_url(
148 wp_nonce_url(
149 add_query_arg(
150 array(
151 'give-action' => 'delete_payment',
152 'purchase_id' => $payment_id,
153 ),
154 $base_url
155 ),
156 'give_donation_nonce'
157 )
158 ),
159 sprintf( __( 'Delete Donation %s', 'give' ), $payment_id )
160 );
161 }
162 ?>
163 </div>
164
165 <div class="inside">
166 <div class="give-admin-box">
167
168 <?php
169 /**
170 * Fires in donation details page, before the sidebar update-payment metabox.
171 *
172 * @since 1.0
173 *
174 * @param int $payment_id Payment id.
175 */
176 do_action( 'give_view_donation_details_totals_before', $payment_id );
177 ?>
178
179 <div class="give-admin-box-inside">
180 <p>
181 <label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label>&nbsp;
182 <select id="give-payment-status" name="give-payment-status" class="medium-text">
183 <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?>
184 <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option>
185 <?php endforeach; ?>
186 </select>
187 <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span>
188 </p>
189 </div>
190
191 <div class="give-admin-box-inside">
192 <?php $date_format = give_date_format(); ?>
193 <p>
194 <label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label>&nbsp;
195 <input type="text" id="give-payment-date" name="give-payment-date" data-standard-date="<?php echo esc_attr( date( 'Y-m-d', $payment_date ) ); ?>" value="<?php echo esc_attr( date_i18n( $date_format, $payment_date ) ); ?>" autocomplete="off" class="medium-text give_datepicker" placeholder="<?php _e( 'Date', 'give' ); ?>"/>
196 </p>
197 </div>
198
199 <div class="give-admin-box-inside">
200 <p>
201 <label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label>&nbsp;
202 <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/>&nbsp;:&nbsp;
203 <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/>
204 </p>
205 </div>
206
207 <?php
208 /**
209 * Fires in donation details page, in the sidebar update-payment metabox.
210 *
211 * Allows you to add new inner items.
212 *
213 * @since 1.0
214 *
215 * @param int $payment_id Payment id.
216 */
217 do_action( 'give_view_donation_details_update_inner', $payment_id );
218 ?>
219
220 <div class="give-order-payment give-admin-box-inside">
221 <p>
222 <label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label>&nbsp;
223 <?php echo give_currency_symbol( $payment->currency ); ?>
224 &nbsp;<input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( array( 'donation_id' => $payment_id ) ) ); ?>"/>
225 </p>
226 </div>
227
228 <?php
229 /**
230 * Fires in donation details page, after the sidebar update-donation metabox.
231 *
232 * @since 1.0
233 *
234 * @param int $payment_id Payment id.
235 */
236 do_action( 'give_view_donation_details_totals_after', $payment_id );
237 ?>
238
239 </div>
240 <!-- /.give-admin-box -->
241
242 </div>
243 <!-- /.inside -->
244
245 <div class="give-order-update-box give-admin-box">
246 <?php
247 /**
248 * Fires in donation details page, before the sidebar update-payment metabox actions buttons.
249 *
250 * @since 1.0
251 *
252 * @param int $payment_id Payment id.
253 */
254 do_action( 'give_view_donation_details_update_before', $payment_id );
255 ?>
256
257 <div id="major-publishing-actions">
258 <div id="publishing-action">
259 <input type="submit" class="button button-primary right" value="<?php esc_attr_e( 'Save Donation', 'give' ); ?>"/>
260 <?php
261 if ( give_is_payment_complete( $payment_id ) ) {
262 $url = add_query_arg(
263 array(
264 'give-action' => 'email_links',
265 'purchase_id' => $payment_id,
266 ),
267 admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id )
268 );
269
270 echo sprintf(
271 '<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>',
272 esc_url( $url ),
273 esc_html__( 'Resend Receipt', 'give' )
274 );
275 }
276 ?>
277 </div>
278 <div class="clear"></div>
279 </div>
280 <?php
281 /**
282 * Fires in donation details page, after the sidebar update-payment metabox actions buttons.
283 *
284 * @since 1.0
285 *
286 * @param int $payment_id Payment id.
287 */
288 do_action( 'give_view_donation_details_update_after', $payment_id );
289 ?>
290
291 </div>
292 <!-- /.give-order-update-box -->
293
294 </div>
295 <!-- /#give-order-data -->
296
297 <div id="give-order-details" class="postbox give-order-data">
298
299 <h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3>
300
301 <div class="inside">
302 <div class="give-admin-box">
303
304 <?php
305 /**
306 * Fires in donation details page, before the donation-meta metabox.
307 *
308 * @since 1.0
309 *
310 * @param int $payment_id Payment id.
311 */
312 do_action( 'give_view_donation_details_payment_meta_before', $payment_id );
313
314 $gateway = give_get_payment_gateway( $payment_id );
315 if ( $gateway ) :
316 ?>
317 <div class="give-order-gateway give-admin-box-inside">
318 <p>
319 <strong><?php _e( 'Gateway:', 'give' ); ?></strong>&nbsp;
320 <?php echo give_get_gateway_admin_label( $gateway ); ?>
321 </p>
322 </div>
323 <?php endif; ?>
324
325 <div class="give-order-payment-key give-admin-box-inside">
326 <p>
327 <strong><?php _e( 'Key:', 'give' ); ?></strong>&nbsp;
328 <?php echo give_get_payment_key( $payment_id ); ?>
329 </p>
330 </div>
331
332 <div class="give-order-ip give-admin-box-inside">
333 <p>
334 <strong><?php _e( 'IP:', 'give' ); ?></strong>&nbsp;
335 <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?>
336 </p>
337 </div>
338
339 <?php
340 // Display the transaction ID present.
341 // The transaction ID is the charge ID from the gateway.
342 // For instance, stripe "ch_BzvwYCchqOy5Nt".
343 if ( $transaction_id != $payment_id ) :
344 ?>
345 <div class="give-order-tx-id give-admin-box-inside">
346 <p>
347 <strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway ); ?>"></span></strong>&nbsp;
348 <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?>
349 </p>
350 </div>
351 <?php endif; ?>
352
353 <?php
354 /**
355 * Fires in donation details page, after the donation-meta metabox.
356 *
357 * @since 1.0
358 *
359 * @param int $payment_id Payment id.
360 */
361 do_action( 'give_view_donation_details_payment_meta_after', $payment_id );
362 ?>
363
364 <div class="give-admin-box-inside">
365 <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?>
366 <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor &raquo;', 'give' ); ?></a>
367 </p>
368 </div>
369
370 </div>
371 <!-- /.column-container -->
372
373 </div>
374 <!-- /.inside -->
375
376 </div>
377 <!-- /#give-order-data -->
378
379 <?php
380 /**
381 * Fires in donation details page, after the sidebar.
382 *
383 * @since 1.0
384 *
385 * @param int $payment_id Payment id.
386 */
387 do_action( 'give_view_donation_details_sidebar_after', $payment_id );
388 ?>
389
390 </div>
391 <!-- /#side-sortables -->
392 </div>
393 <!-- /#postbox-container-1 -->
394
395 <div id="postbox-container-2" class="postbox-container">
396
397 <div id="normal-sortables" class="meta-box-sortables ui-sortable">
398
399 <?php
400 /**
401 * Fires in donation details page, before the main area.
402 *
403 * @since 1.0
404 *
405 * @param int $payment_id Payment id.
406 */
407 do_action( 'give_view_donation_details_main_before', $payment_id );
408 ?>
409
410 <?php $column_count = 'columns-3'; ?>
411 <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>">
412 <h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3>
413
414 <div class="inside">
415
416 <div class="column-container">
417 <div class="column">
418 <p>
419 <strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br>
420 <?php
421 if ( $payment->form_id ) :
422 printf(
423 '<a href="%1$s">%2$s</a>',
424 admin_url( 'post.php?action=edit&post=' . $payment->form_id ),
425 $payment->form_id
426 );
427 endif;
428 ?>
429 </p>
430 <p>
431 <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br>
432 <?php
433 echo Give()->html->forms_dropdown(
434 array(
435 'selected' => $payment->form_id,
436 'name' => 'give-payment-form-select',
437 'id' => 'give-payment-form-select',
438 'chosen' => true,
439 'placeholder' => '',
440 )
441 );
442 ?>
443 </p>
444 </div>
445 <div class="column">
446 <p>
447 <strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br>
448 <?php echo date_i18n( give_date_format(), $payment_date ); ?>
449 </p>
450 <p>
451 <strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br>
452 <span class="give-donation-level">
453 <?php
454 $var_prices = give_has_variable_prices( $payment->form_id );
455 if ( empty( $var_prices ) ) {
456 _e( 'n/a', 'give' );
457 } else {
458 $prices_atts = array();
459 if ( $variable_prices = give_get_variable_prices( $payment->form_id ) ) {
460 foreach ( $variable_prices as $variable_price ) {
461 $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) );
462 }
463 }
464 // Variable price dropdown options.
465 $variable_price_dropdown_option = array(
466 'id' => $payment->form_id,
467 'name' => 'give-variable-price',
468 'chosen' => true,
469 'show_option_all' => '',
470 'show_option_none' => ( '' === $payment->price_id ? __( 'None', 'give' ) : '' ),
471 'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ),
472 'selected' => $payment->price_id,
473 );
474 // Render variable prices select tag html.
475 give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true );
476 }
477 ?>
478 </span>
479 </p>
480 </div>
481 <div class="column">
482 <p>
483 <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br>
484 <?php echo give_donation_amount( $payment, true ); ?>
485 </p>
486
487 <?php if ( give_is_anonymous_donation_field_enabled( $payment->form_id ) ) : ?>
488 <div>
489 <strong><?php esc_html_e( 'Anonymous Donation:', 'give' ); ?></strong>
490 <ul class="give-radio-inline">
491 <li>
492 <label>
493 <input
494 name="give_anonymous_donation"
495 value="1"
496 type="radio"
497 <?php checked( 1, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ); ?>
498 ><?php _e( 'Yes', 'give' ); ?>
499 </label>
500 </li>
501 <li>
502 <label>
503 <input
504 name="give_anonymous_donation"
505 value="0"
506 type="radio"
507 <?php checked( 0, absint( give_get_meta( $payment_id, '_give_anonymous_donation', true ) ) ); ?>
508 ><?php _e( 'No', 'give' ); ?>
509 </label>
510 </li>
511 </ul>
512 </div>
513 <?php endif; ?>
514 <p>
515 <?php
516 /**
517 * Fires in donation details page, in the donation-information metabox, before the head elements.
518 *
519 * Allows you to add new TH elements at the beginning.
520 *
521 * @since 1.0
522 *
523 * @param int $payment_id Payment id.
524 */
525 do_action( 'give_donation_details_thead_before', $payment_id );
526
527
528 /**
529 * Fires in donation details page, in the donation-information metabox, after the head elements.
530 *
531 * Allows you to add new TH elements at the end.
532 *
533 * @since 1.0
534 *
535 * @param int $payment_id Payment id.
536 */
537 do_action( 'give_donation_details_thead_after', $payment_id );
538
539 /**
540 * Fires in donation details page, in the donation-information metabox, before the body elements.
541 *
542 * Allows you to add new TD elements at the beginning.
543 *
544 * @since 1.0
545 *
546 * @param int $payment_id Payment id.
547 */
548 do_action( 'give_donation_details_tbody_before', $payment_id );
549
550 /**
551 * Fires in donation details page, in the donation-information metabox, after the body elements.
552 *
553 * Allows you to add new TD elements at the end.
554 *
555 * @since 1.0
556 *
557 * @param int $payment_id Payment id.
558 */
559 do_action( 'give_donation_details_tbody_after', $payment_id );
560 ?>
561 </p>
562 </div>
563 </div>
564
565 </div>
566 <!-- /.inside -->
567
568 </div>
569 <!-- /#give-donation-overview -->
570
571 <?php
572 /**
573 * Fires on the donation details page.
574 *
575 * @since 1.0
576 *
577 * @param int $payment_id Payment id.
578 */
579 do_action( 'give_view_donation_details_donor_detail_before', $payment_id );
580 ?>
581
582 <div id="give-donor-details" class="postbox">
583 <h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3>
584
585 <div class="inside">
586
587 <?php $donor = new Give_Donor( $donor_id ); ?>
588
589 <div class="column-container donor-info">
590 <div class="column">
591 <p>
592 <strong><?php esc_html_e( 'Donor ID:', 'give' ); ?></strong><br>
593 <?php
594 if ( ! empty( $donor->id ) ) {
595 printf(
596 '<a href="%1$s">%2$s</a>',
597 esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ),
598 intval( $donor->id )
599 );
600 }
601 ?>
602 <span>(<a href="#new" class="give-payment-new-donor"><?php esc_html_e( 'Create New Donor', 'give' ); ?></a>)</span>
603 </p>
604 <p>
605 <strong><?php esc_html_e( 'Donor Since:', 'give' ); ?></strong><br>
606 <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ); ?>
607 </p>
608 </div>
609 <div class="column">
610 <p>
611 <strong><?php esc_html_e( 'Donor Name:', 'give' ); ?></strong><br>
612 <?php
613 $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' );
614 $donor_name = give_get_donor_name_by( $donor_id, 'donor' );
615
616 // Check whether the donor name and WP_User name is same or not.
617 if ( $donor_billing_name !== $donor_name ) {
618 // Donors can be deleted by the user, but we can show the donor billing name from donation details.
619 if ( empty( $donor_name ) ) {
620 echo esc_html( $donor_billing_name );
621 } else {
622 echo sprintf(
623 '%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
624 esc_html( $donor_billing_name ),
625 esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ),
626 esc_html( $donor_name )
627 );
628 }
629 } else {
630 echo esc_html( $donor_name );
631 }
632 ?>
633 </p>
634 <p>
635 <strong><?php esc_html_e( 'Donor Email:', 'give' ); ?></strong><br>
636 <?php
637 // Show Donor donation email first and Primary email on parenthesis if not match both email.
638 echo ( empty( $donor->email ) || hash_equals( $donor->email, $payment->email ) )
639 ? $payment->email
640 : sprintf(
641 '%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
642 $payment->email,
643 esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}" ) ),
644 $donor->email
645 );
646 ?>
647 </p>
648 <p>
649 <?php
650 if ( ! empty($donation_phone_number)) {
651 ?>
652 <strong><?php
653 esc_html_e('Donor Phone:', 'give'); ?></strong><br>
654 <?php
655 // Show Donor donation phone first and Primary phone on parenthesis if not match both phone.
656 echo (empty($donor_phone_number) ||
657 hash_equals($donor_phone_number, $donation_phone_number))
658 ? $donation_phone_number :
659 sprintf(
660 '%1$s (<a href="%2$s" target="_blank">%3$s</a>)',
661 $donation_phone_number,
662 esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id={$donor_id}")),
663 $donor_phone_number
664 );
665 }
666 ?>
667 </p>
668 </div>
669 <div class="column">
670 <p>
671 <strong><?php esc_html_e( 'Change Donor:', 'give' ); ?></strong><br>
672 <?php
673 echo Give()->html->donor_dropdown(
674 array(
675 'selected' => $donor->id,
676 'name' => 'donor-id',
677 )
678 );
679 ?>
680 </p>
681 <p>
682 <?php
683 if ( ! empty( $company_name ) ) {
684 ?>
685 <strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br>
686 <?php
687 echo $company_name;
688 }
689 ?>
690 </p>
691 </div>
692 </div>
693
694 <div class="column-container new-donor" style="display: none">
695 <div class="column">
696 <p>
697 <label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label>
698 <input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/>
699 </p>
700 </div>
701 <div class="column">
702 <p>
703 <label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label>
704 <input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/>
705 </p>
706 </div>
707 <div class="column">
708 <p>
709 <label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label>
710 <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/>
711 </p>
712 </div>
713 <div class="column">
714 <p>
715 <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/>
716 <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/>
717 <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a>
718 <br>
719 <em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em>
720 </p>
721 </div>
722 </div>
723 <?php
724 /**
725 * Fires on the donation details page, in the donor-details metabox.
726 *
727 * The hook is left here for backwards compatibility.
728 *
729 * @since 1.7
730 *
731 * @param array $payment_meta Payment meta.
732 * @param array $user_info User information.
733 */
734 do_action( 'give_payment_personal_details_list', $payment_meta, $user_info );
735
736 /**
737 * Fires on the donation details page, in the donor-details metabox.
738 *
739 * @since 1.7
740 *
741 * @param int $payment_id Payment id.
742 */
743 do_action( 'give_payment_view_details', $payment_id );
744 ?>
745
746 </div>
747 <!-- /.inside -->
748 </div>
749 <!-- /#give-donor-details -->
750
751 <?php
752 /**
753 * Fires on the donation details page, before the billing metabox.
754 *
755 * @since 1.0
756 *
757 * @param int $payment_id Payment id.
758 */
759 do_action( 'give_view_donation_details_billing_before', $payment_id );
760 ?>
761
762 <div id="give-billing-details" class="postbox">
763 <h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3>
764
765 <div class="inside">
766
767 <div id="give-order-address">
768
769 <div class="order-data-address">
770 <div class="data column-container">
771
772 <?php
773 $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() );
774
775 $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' );
776
777 // Get the country list that does not have any states init.
778 $no_states_country = give_no_states_country_list();
779 ?>
780
781 <div class="row">
782 <div id="give-order-address-country-wrap">
783 <label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label>
784 <?php
785 echo Give()->html->select(
786 array(
787 'options' => give_get_country_list(),
788 'name' => 'give-payment-address[0][country]',
789 'selected' => $address['country'],
790 'show_option_all' => false,
791 'show_option_none' => false,
792 'chosen' => true,
793 'placeholder' => esc_attr__( 'Select a country', 'give' ),
794 'data' => array( 'search-type' => 'no_ajax' ),
795 'autocomplete' => 'country',
796 )
797 );
798 ?>
799 </div>
800 </div>
801
802 <div class="row">
803 <div class="give-wrap-address-line1">
804 <label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label>
805 <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/>
806 </div>
807 </div>
808
809 <div class="row">
810 <div class="give-wrap-address-line2">
811 <label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label>
812 <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/>
813 </div>
814 </div>
815
816 <div class="row">
817 <div class="give-wrap-address-city">
818 <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label>
819 <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/>
820 </div>
821 </div>
822
823 <?php
824 $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false );
825 ?>
826 <div class="row">
827 <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state">
828 <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>">
829 <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label>
830 <?php
831 $states = give_get_states( $address['country'] );
832 if ( ! empty( $states ) ) {
833 echo Give()->html->select(
834 array(
835 'options' => $states,
836 'name' => 'give-payment-address[0][state]',
837 'selected' => $address['state'],
838 'show_option_all' => false,
839 'show_option_none' => false,
840 'chosen' => true,
841 'placeholder' => esc_attr__( 'Select a state', 'give' ),
842 'data' => array( 'search-type' => 'no_ajax' ),
843 'autocomplete' => 'address-level1',
844 )
845 );
846 } else {
847 ?>
848 <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" autocomplete="address-line1" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/>
849 <?php
850 }
851 ?>
852 </div>
853 </div>
854
855 <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip">
856 <div class="give-wrap-address-zip">
857 <label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label>
858 <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/>
859 </div>
860 </div>
861 </div>
862 </div>
863 </div>
864 </div>
865 <!-- /#give-order-address -->
866
867 <?php
868 /**
869 * Fires in donation details page, in the billing metabox, after all the fields.
870 *
871 * Allows you to insert new billing address fields.
872 *
873 * @since 1.7
874 *
875 * @param int $payment_id Payment id.
876 */
877 do_action( 'give_payment_billing_details', $payment_id );
878 ?>
879
880 </div>
881 <!-- /.inside -->
882 </div>
883 <!-- /#give-billing-details -->
884
885 <?php
886 /**
887 * Fires on the donation details page, after the billing metabox.
888 *
889 * @since 1.0
890 *
891 * @param int $payment_id Payment id.
892 */
893 do_action( 'give_view_donation_details_billing_after', $payment_id );
894 ?>
895
896 <div id="give-payment-notes" class="postbox">
897 <h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3>
898
899 <div class="inside">
900 <div id="give-payment-notes-inner">
901 <?php
902 $notes = give_get_payment_notes( $payment_id );
903 if ( ! empty( $notes ) ) {
904 $no_notes_display = ' style="display:none;"';
905 foreach ( $notes as $note ) :
906
907 echo give_get_payment_note_html( $note, $payment_id );
908
909 endforeach;
910 } else {
911 $no_notes_display = '';
912 }
913
914 echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>';
915 ?>
916 </div>
917 <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea>
918
919 <div class="give-clearfix">
920 <p>
921 <label for="donation_note_type" class="screen-reader-text"><?php _e( 'Note type', 'give' ); ?></label>
922 <select name="donation_note_type" id="donation_note_type">
923 <option value=""><?php _e( 'Private note', 'give' ); ?></option>
924 <option value="donor"><?php _e( 'Note to donor', 'give' ); ?></option>
925 </select>
926 <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button>
927 </p>
928 </div>
929
930 </div>
931 <!-- /.inside -->
932 </div>
933 <!-- /#give-payment-notes -->
934
935 <?php
936 /**
937 * Fires on the donation details page, after the main area.
938 *
939 * @since 2.27.0 Change to read comment from donations meta table
940 * @since 1.0
941 *
942 * @param int $payment_id Payment id.
943 */
944 do_action( 'give_view_donation_details_main_after', $payment_id );
945 ?>
946
947 <?php if ( give_is_donor_comment_field_enabled( $payment->form_id ) ) : ?>
948 <div id="give-payment-donor-comment" class="postbox">
949 <h3 class="hndle"><?php _e( 'Donor Comment', 'give' ); ?></h3>
950
951 <div class="inside">
952 <div id="give-payment-donor-comment-inner">
953 <p>
954 <?php
955 echo sprintf(
956 '<textarea name="give_comment" id="give_comment" placeholder="%s" class="large-text">%s</textarea>',
957 __( 'Add a comment', 'give' ),
958 $payment->get_meta(DonationMetaKeys::COMMENT) ?? ''
959 );
960 ?>
961 </p>
962 </div>
963
964 </div>
965 <!-- /.inside -->
966 </div>
967 <?php endif; ?>
968 <!-- /#give-payment-notes -->
969
970 <?php
971 /**
972 * Fires on the donation details page, after the main area.
973 *
974 * @since 1.0
975 *
976 * @param int $payment_id Payment id.
977 */
978 do_action( 'give_view_donation_details_main_after', $payment_id );
979 ?>
980
981 </div>
982 <!-- /#normal-sortables -->
983 </div>
984 <!-- #postbox-container-2 -->
985 </div>
986 <!-- /#post-body -->
987 </div>
988 <!-- #give-dashboard-widgets-wrap -->
989 </div>
990 <!-- /#post-stuff -->
991
992 <?php
993 /**
994 * Fires in donation details page, in the form after the order details.
995 *
996 * @since 1.0
997 *
998 * @param int $payment_id Payment id.
999 */
1000 do_action( 'give_view_donation_details_form_bottom', $payment_id );
1001
1002 wp_nonce_field( 'give_update_payment_details_nonce' );
1003 ?>
1004 <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/>
1005 <input type="hidden" name="give_action" value="update_payment_details"/>
1006 </form>
1007 <?php
1008 /**
1009 * Fires in donation details page, after the order form.
1010 *
1011 * @since 1.0
1012 *
1013 * @param int $payment_id Payment id.
1014 */
1015 do_action( 'give_view_donation_details_after', $payment_id );
1016 ?>
1017 </div><!-- /.wrap -->
1018