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