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