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