Making WordPress.org


Ignore:
Timestamp:
05/10/2016 08:43:48 PM (11 years ago)
Author:
iandunn
Message:

WordCamp QBO: Replace invoice title with sponsorship level in line description.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-qbo-client/wordcamp-qbo-client.php

    r2645 r3111  
    308308                $invoice_meta = get_post_custom( $invoice_id );
    309309                $sponsor_meta = get_post_custom( $invoice_meta['_wcbsi_sponsor_id'][0] );
     310                $sponsorship_level = self::get_sponsorship_level( $invoice_meta['_wcbsi_sponsor_id'][0] );
     311                // todo realign
    310312
    311313                $payload = array(
    312314                        'wordcamp_name'   => sanitize_text_field( get_wordcamp_name()                        ),
    313                         'invoice_title'   => sanitize_text_field( $invoice->post_title                       ),
     315                        'sponsorship_level' => sanitize_text_field( $sponsorship_level                       ),
    314316                        'currency_code'   => sanitize_text_field( $invoice_meta['_wcbsi_currency'       ][0] ),
    315317                        'qbo_class_id'    => sanitize_text_field( $invoice_meta['_wcbsi_qbo_class_id'   ][0] ),
    316318                        'amount'          => floatval(            $invoice_meta['_wcbsi_amount'         ][0] ),
    317319                        'description'     => sanitize_text_field( $invoice_meta['_wcbsi_description'    ][0] ),
     320                        // todo realign
    318321
    319322                        'statement_memo' => sprintf(
    … …  
    360363
    361364        /**
     365         * Get the sponsorship level name assigned to a sponsor
     366         *
     367         * @param int $sponsor_id
     368         *
     369         * @return false|string
     370         */
     371        public static function get_sponsorship_level( $sponsor_id ) {
     372                $sponsorship_level  = false;
     373                $sponsorship_levels = wp_get_object_terms( $sponsor_id, 'wcb_sponsor_level' );
     374
     375                if ( isset( $sponsorship_levels[0]->name ) ) {
     376                        $sponsorship_level = $sponsorship_levels[0]->name;
     377                }
     378
     379                return $sponsorship_level;
     380        }
     381
     382        /**
    362383         * Get the paid invoices from the given set of sent invoices
    363384         *
Note: See TracChangeset for help on using the changeset viewer.