actions.php
8 years ago
class-payments-table.php
8 years ago
payments-history.php
8 years ago
view-payment-details.php
8 years ago
view-payment-details.php
889 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> |
| 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 | <p> |
| 178 | <label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label> |
| 179 | <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
| 180 | </p> |
| 181 | </div> |
| 182 | |
| 183 | <div class="give-admin-box-inside"> |
| 184 | <p> |
| 185 | <label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label> |
| 186 | <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"/> : |
| 187 | <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"/> |
| 188 | </p> |
| 189 | </div> |
| 190 | |
| 191 | <?php |
| 192 | /** |
| 193 | * Fires in donation details page, in the sidebar update-payment metabox. |
| 194 | * |
| 195 | * Allows you to add new inner items. |
| 196 | * |
| 197 | * @since 1.0 |
| 198 | * |
| 199 | * @param int $payment_id Payment id. |
| 200 | */ |
| 201 | do_action( 'give_view_donation_details_update_inner', $payment_id ); |
| 202 | ?> |
| 203 | |
| 204 | <div class="give-order-payment give-admin-box-inside"> |
| 205 | <p> |
| 206 | <label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label> |
| 207 | <?php echo give_currency_symbol( $payment->currency ); ?> |
| 208 | <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 ) ); ?>"/> |
| 209 | </p> |
| 210 | </div> |
| 211 | |
| 212 | <?php |
| 213 | /** |
| 214 | * Fires in donation details page, after the sidebar update-donation metabox. |
| 215 | * |
| 216 | * @since 1.0 |
| 217 | * |
| 218 | * @param int $payment_id Payment id. |
| 219 | */ |
| 220 | do_action( 'give_view_donation_details_totals_after', $payment_id ); |
| 221 | ?> |
| 222 | |
| 223 | </div> |
| 224 | <!-- /.give-admin-box --> |
| 225 | |
| 226 | </div> |
| 227 | <!-- /.inside --> |
| 228 | |
| 229 | <div class="give-order-update-box give-admin-box"> |
| 230 | <?php |
| 231 | /** |
| 232 | * Fires in donation details page, before the sidebar update-payment metabox actions buttons. |
| 233 | * |
| 234 | * @since 1.0 |
| 235 | * |
| 236 | * @param int $payment_id Payment id. |
| 237 | */ |
| 238 | do_action( 'give_view_donation_details_update_before', $payment_id ); |
| 239 | ?> |
| 240 | |
| 241 | <div id="major-publishing-actions"> |
| 242 | <div id="publishing-action"> |
| 243 | |
| 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> |
| 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> |
| 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> |
| 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> |
| 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 »', '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 | <p> |
| 472 | <?php |
| 473 | /** |
| 474 | * Fires in donation details page, in the donation-information metabox, before the head elements. |
| 475 | * |
| 476 | * Allows you to add new TH elements at the beginning. |
| 477 | * |
| 478 | * @since 1.0 |
| 479 | * |
| 480 | * @param int $payment_id Payment id. |
| 481 | */ |
| 482 | do_action( 'give_donation_details_thead_before', $payment_id ); |
| 483 | |
| 484 | |
| 485 | /** |
| 486 | * Fires in donation details page, in the donation-information metabox, after the head elements. |
| 487 | * |
| 488 | * Allows you to add new TH elements at the end. |
| 489 | * |
| 490 | * @since 1.0 |
| 491 | * |
| 492 | * @param int $payment_id Payment id. |
| 493 | */ |
| 494 | do_action( 'give_donation_details_thead_after', $payment_id ); |
| 495 | |
| 496 | /** |
| 497 | * Fires in donation details page, in the donation-information metabox, before the body elements. |
| 498 | * |
| 499 | * Allows you to add new TD elements at the beginning. |
| 500 | * |
| 501 | * @since 1.0 |
| 502 | * |
| 503 | * @param int $payment_id Payment id. |
| 504 | */ |
| 505 | do_action( 'give_donation_details_tbody_before', $payment_id ); |
| 506 | |
| 507 | /** |
| 508 | * Fires in donation details page, in the donation-information metabox, after the body elements. |
| 509 | * |
| 510 | * Allows you to add new TD elements at the end. |
| 511 | * |
| 512 | * @since 1.0 |
| 513 | * |
| 514 | * @param int $payment_id Payment id. |
| 515 | */ |
| 516 | do_action( 'give_donation_details_tbody_after', $payment_id ); |
| 517 | ?> |
| 518 | </p> |
| 519 | </div> |
| 520 | </div> |
| 521 | |
| 522 | </div> |
| 523 | <!-- /.inside --> |
| 524 | |
| 525 | </div> |
| 526 | <!-- /#give-donation-overview --> |
| 527 | |
| 528 | <?php |
| 529 | /** |
| 530 | * Fires on the donation details page. |
| 531 | * |
| 532 | * @since 1.0 |
| 533 | * |
| 534 | * @param int $payment_id Payment id. |
| 535 | */ |
| 536 | do_action( 'give_view_donation_details_donor_detail_before', $payment_id ); |
| 537 | ?> |
| 538 | |
| 539 | <div id="give-donor-details" class="postbox"> |
| 540 | <h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3> |
| 541 | |
| 542 | <div class="inside"> |
| 543 | |
| 544 | <?php $donor = new Give_Donor( $donor_id ); ?> |
| 545 | |
| 546 | <div class="column-container donor-info"> |
| 547 | <div class="column"> |
| 548 | <p> |
| 549 | <strong><?php _e( 'Donor ID:', 'give' ); ?></strong><br> |
| 550 | <?php |
| 551 | if ( ! empty( $donor->id ) ) { |
| 552 | printf( |
| 553 | '<a href="%1$s">%2$s</a>', |
| 554 | admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
| 555 | $donor->id |
| 556 | ); |
| 557 | } |
| 558 | ?> |
| 559 | <span>(<a href="#new" class="give-payment-new-donor"><?php _e( 'Create New Donor', 'give' ); ?></a>)</span> |
| 560 | </p> |
| 561 | <p> |
| 562 | <strong><?php _e( 'Donor Since:', 'give' ); ?></strong><br> |
| 563 | <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
| 564 | </p> |
| 565 | </div> |
| 566 | <div class="column"> |
| 567 | <p> |
| 568 | <strong><?php _e( 'Donor Name:', 'give' ); ?></strong><br> |
| 569 | <?php |
| 570 | $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
| 571 | $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
| 572 | |
| 573 | // Check whether the donor name and WP_User name is same or not. |
| 574 | if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
| 575 | echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
| 576 | } else { |
| 577 | echo $donor_name; |
| 578 | } |
| 579 | ?> |
| 580 | </p> |
| 581 | <p> |
| 582 | <strong><?php _e( 'Donor Email:', 'give' ); ?></strong><br> |
| 583 | <?php echo $donor->email; ?> |
| 584 | </p> |
| 585 | </div> |
| 586 | <div class="column"> |
| 587 | <p> |
| 588 | <strong><?php _e( 'Change Donor:', 'give' ); ?></strong><br> |
| 589 | <?php |
| 590 | echo Give()->html->donor_dropdown( |
| 591 | array( |
| 592 | 'selected' => $donor->id, |
| 593 | 'name' => 'donor-id', |
| 594 | ) |
| 595 | ); |
| 596 | ?> |
| 597 | </p> |
| 598 | <p> |
| 599 | <?php if ( ! empty( $company_name ) ) { |
| 600 | ?> |
| 601 | <strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br> |
| 602 | <?php |
| 603 | echo $company_name; |
| 604 | } ?> |
| 605 | </p> |
| 606 | </div> |
| 607 | </div> |
| 608 | |
| 609 | <div class="column-container new-donor" style="display: none"> |
| 610 | <div class="column"> |
| 611 | <p> |
| 612 | <label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label> |
| 613 | <input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/> |
| 614 | </p> |
| 615 | </div> |
| 616 | <div class="column"> |
| 617 | <p> |
| 618 | <label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label> |
| 619 | <input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/> |
| 620 | </p> |
| 621 | </div> |
| 622 | <div class="column"> |
| 623 | <p> |
| 624 | <label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label> |
| 625 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
| 626 | </p> |
| 627 | </div> |
| 628 | <div class="column"> |
| 629 | <p> |
| 630 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
| 631 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
| 632 | <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
| 633 | <br> |
| 634 | <em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
| 635 | </p> |
| 636 | </div> |
| 637 | </div> |
| 638 | <?php |
| 639 | /** |
| 640 | * Fires on the donation details page, in the donor-details metabox. |
| 641 | * |
| 642 | * The hook is left here for backwards compatibility. |
| 643 | * |
| 644 | * @since 1.7 |
| 645 | * |
| 646 | * @param array $payment_meta Payment meta. |
| 647 | * @param array $user_info User information. |
| 648 | */ |
| 649 | do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
| 650 | |
| 651 | /** |
| 652 | * Fires on the donation details page, in the donor-details metabox. |
| 653 | * |
| 654 | * @since 1.7 |
| 655 | * |
| 656 | * @param int $payment_id Payment id. |
| 657 | */ |
| 658 | do_action( 'give_payment_view_details', $payment_id ); |
| 659 | ?> |
| 660 | |
| 661 | </div> |
| 662 | <!-- /.inside --> |
| 663 | </div> |
| 664 | <!-- /#give-donor-details --> |
| 665 | |
| 666 | <?php |
| 667 | /** |
| 668 | * Fires on the donation details page, before the billing metabox. |
| 669 | * |
| 670 | * @since 1.0 |
| 671 | * |
| 672 | * @param int $payment_id Payment id. |
| 673 | */ |
| 674 | do_action( 'give_view_donation_details_billing_before', $payment_id ); |
| 675 | ?> |
| 676 | |
| 677 | <div id="give-billing-details" class="postbox"> |
| 678 | <h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3> |
| 679 | |
| 680 | <div class="inside"> |
| 681 | |
| 682 | <div id="give-order-address"> |
| 683 | |
| 684 | <div class="order-data-address"> |
| 685 | <div class="data column-container"> |
| 686 | |
| 687 | <?php |
| 688 | $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
| 689 | |
| 690 | $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
| 691 | |
| 692 | // Get the country list that does not have any states init. |
| 693 | $no_states_country = give_no_states_country_list(); |
| 694 | ?> |
| 695 | |
| 696 | <div class="row"> |
| 697 | <div id="give-order-address-country-wrap"> |
| 698 | <label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label> |
| 699 | <?php |
| 700 | echo Give()->html->select( |
| 701 | array( |
| 702 | 'options' => give_get_country_list(), |
| 703 | 'name' => 'give-payment-address[0][country]', |
| 704 | 'selected' => $address['country'], |
| 705 | 'show_option_all' => false, |
| 706 | 'show_option_none' => false, |
| 707 | 'chosen' => true, |
| 708 | 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
| 709 | 'data' => array( 'search-type' => 'no_ajax' ), |
| 710 | ) |
| 711 | ); |
| 712 | ?> |
| 713 | </div> |
| 714 | </div> |
| 715 | |
| 716 | <div class="row"> |
| 717 | <div class="give-wrap-address-line1"> |
| 718 | <label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label> |
| 719 | <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
| 720 | </div> |
| 721 | </div> |
| 722 | |
| 723 | <div class="row"> |
| 724 | <div class="give-wrap-address-line2"> |
| 725 | <label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label> |
| 726 | <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
| 727 | </div> |
| 728 | </div> |
| 729 | |
| 730 | <div class="row"> |
| 731 | <div class="give-wrap-address-city"> |
| 732 | <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
| 733 | <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
| 734 | </div> |
| 735 | </div> |
| 736 | |
| 737 | <?php |
| 738 | $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false ); |
| 739 | ?> |
| 740 | <div class="row"> |
| 741 | <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state"> |
| 742 | <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>"> |
| 743 | <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
| 744 | <?php |
| 745 | $states = give_get_states( $address['country'] ); |
| 746 | if ( ! empty( $states ) ) { |
| 747 | echo Give()->html->select( |
| 748 | array( |
| 749 | 'options' => $states, |
| 750 | 'name' => 'give-payment-address[0][state]', |
| 751 | 'selected' => $address['state'], |
| 752 | 'show_option_all' => false, |
| 753 | 'show_option_none' => false, |
| 754 | 'chosen' => true, |
| 755 | 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
| 756 | 'data' => array( 'search-type' => 'no_ajax' ), |
| 757 | ) |
| 758 | ); |
| 759 | } else { |
| 760 | ?> |
| 761 | <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
| 762 | <?php |
| 763 | } |
| 764 | ?> |
| 765 | </div> |
| 766 | </div> |
| 767 | |
| 768 | <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip"> |
| 769 | <div class="give-wrap-address-zip"> |
| 770 | <label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label> |
| 771 | <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
| 772 | </div> |
| 773 | </div> |
| 774 | </div> |
| 775 | </div> |
| 776 | </div> |
| 777 | </div> |
| 778 | <!-- /#give-order-address --> |
| 779 | |
| 780 | <?php |
| 781 | /** |
| 782 | * Fires in donation details page, in the billing metabox, after all the fields. |
| 783 | * |
| 784 | * Allows you to insert new billing address fields. |
| 785 | * |
| 786 | * @since 1.7 |
| 787 | * |
| 788 | * @param int $payment_id Payment id. |
| 789 | */ |
| 790 | do_action( 'give_payment_billing_details', $payment_id ); |
| 791 | ?> |
| 792 | |
| 793 | </div> |
| 794 | <!-- /.inside --> |
| 795 | </div> |
| 796 | <!-- /#give-billing-details --> |
| 797 | |
| 798 | <?php |
| 799 | /** |
| 800 | * Fires on the donation details page, after the billing metabox. |
| 801 | * |
| 802 | * @since 1.0 |
| 803 | * |
| 804 | * @param int $payment_id Payment id. |
| 805 | */ |
| 806 | do_action( 'give_view_donation_details_billing_after', $payment_id ); |
| 807 | ?> |
| 808 | |
| 809 | <div id="give-payment-notes" class="postbox"> |
| 810 | <h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3> |
| 811 | |
| 812 | <div class="inside"> |
| 813 | <div id="give-payment-notes-inner"> |
| 814 | <?php |
| 815 | $notes = give_get_payment_notes( $payment_id ); |
| 816 | if ( ! empty( $notes ) ) { |
| 817 | $no_notes_display = ' style="display:none;"'; |
| 818 | foreach ( $notes as $note ) : |
| 819 | |
| 820 | echo give_get_payment_note_html( $note, $payment_id ); |
| 821 | |
| 822 | endforeach; |
| 823 | } else { |
| 824 | $no_notes_display = ''; |
| 825 | } |
| 826 | |
| 827 | echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; |
| 828 | ?> |
| 829 | </div> |
| 830 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
| 831 | |
| 832 | <div class="give-clearfix"> |
| 833 | <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> |
| 834 | </div> |
| 835 | |
| 836 | </div> |
| 837 | <!-- /.inside --> |
| 838 | </div> |
| 839 | <!-- /#give-payment-notes --> |
| 840 | |
| 841 | <?php |
| 842 | /** |
| 843 | * Fires on the donation details page, after the main area. |
| 844 | * |
| 845 | * @since 1.0 |
| 846 | * |
| 847 | * @param int $payment_id Payment id. |
| 848 | */ |
| 849 | do_action( 'give_view_donation_details_main_after', $payment_id ); |
| 850 | ?> |
| 851 | |
| 852 | </div> |
| 853 | <!-- /#normal-sortables --> |
| 854 | </div> |
| 855 | <!-- #postbox-container-2 --> |
| 856 | </div> |
| 857 | <!-- /#post-body --> |
| 858 | </div> |
| 859 | <!-- #give-dashboard-widgets-wrap --> |
| 860 | </div> |
| 861 | <!-- /#post-stuff --> |
| 862 | |
| 863 | <?php |
| 864 | /** |
| 865 | * Fires in donation details page, in the form after the order details. |
| 866 | * |
| 867 | * @since 1.0 |
| 868 | * |
| 869 | * @param int $payment_id Payment id. |
| 870 | */ |
| 871 | do_action( 'give_view_donation_details_form_bottom', $payment_id ); |
| 872 | |
| 873 | wp_nonce_field( 'give_update_payment_details_nonce' ); |
| 874 | ?> |
| 875 | <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
| 876 | <input type="hidden" name="give_action" value="update_payment_details"/> |
| 877 | </form> |
| 878 | <?php |
| 879 | /** |
| 880 | * Fires in donation details page, after the order form. |
| 881 | * |
| 882 | * @since 1.0 |
| 883 | * |
| 884 | * @param int $payment_id Payment id. |
| 885 | */ |
| 886 | do_action( 'give_view_donation_details_after', $payment_id ); |
| 887 | ?> |
| 888 | </div><!-- /.wrap --> |
| 889 |