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