Making WordPress.org

Changeset 2416


Ignore:
Timestamp:
01/28/2016 11:43:02 PM (10 years ago)
Author:
iandunn
Message:

WordCamp Budgets: Merge vendor payment files into the general metabox.

  • The list of attached files was merged into the General metabox
  • The file notes field was combined with the general notes field in a backwards-compatible way
  • The supporting documentation metabox was removed
Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php

    r2415 r2416  
    163163        );
    164164
    165         add_meta_box(
    166             'wcp_files',
    167             __( 'Attach Supporting Documentation', 'wordcamporg' ),
    168             array( $this, 'render_files_metabox' ),
    169             self::POST_TYPE,
    170             'normal',
    171             'high'
    172         );
    173 
    174165        add_meta_box( 'wcp_log', __( 'Log', 'wordcamporg' ), array( $this, 'render_log_metabox' ),
    175166            self::POST_TYPE, 'normal', 'high' );
     
    289280
    290281    /**
    291      * Render the Vendor Details metabox
    292      *
    293      * @param WP_Post $post
    294      */
    295     public function render_files_metabox( $post ) {
    296         wp_nonce_field( 'wcp_files', 'wcp_files_nonce' );
    297 
    298         require_once( dirname( __DIR__ ) . '/views/payment-request/metabox-files.php' );
    299     }
    300 
    301     /**
    302282     * Render the Log metabox
    303283     *
     
    331311     */
    332312    protected function render_textarea_input( $post, $label, $name, $description = '' ) {
    333         $date = get_post_meta( $post->ID, '_camppayments_' . $name, true );
     313        $text = $this->get_field_value( $name, $post );
    334314
    335315        require( dirname( __DIR__ ) . '/views/payment-request/input-textarea.php' );
     
    442422                break;
    443423
     424            case 'general_notes':
     425                // The files_notes field was removed from the UI, so combine its value with general notes
     426                $file_notes    = get_post_meta( $post->ID, "_{$this->meta_key_prefix}_" . 'file_notes',    true );
     427                $general_notes = get_post_meta( $post->ID, "_{$this->meta_key_prefix}_" . 'general_notes', true );
     428
     429                if ( $file_notes ) {
     430                    $general_notes .= ' ' . $file_notes;
     431                    update_post_meta( $post->ID, "_{$this->meta_key_prefix}_" . 'general_notes', $general_notes );
     432                    delete_post_meta( $post->ID, "_{$this->meta_key_prefix}_" . 'file_notes' );
     433                }
     434
     435                $value = $general_notes;
     436                break;
     437
    444438            default:
    445439                $value = get_post_meta( $post->ID, "_{$this->meta_key_prefix}_" . $name, true );
     
    603597
    604598        // Verify nonces
    605         $nonces = array( 'status_nonce', 'general_info_nonce', 'payment_details_nonce', 'vendor_details_nonce', 'wcp_files_nonce' );    // todo add prefix to all of these
     599        $nonces = array( 'status_nonce', 'general_info_nonce', 'payment_details_nonce', 'vendor_details_nonce' );    // todo add prefix to all of these
    606600
    607601        foreach ( $nonces as $nonce ) {
     
    629623                case 'description':
    630624                case 'general_notes':
    631                 case 'file_notes':
    632625                case 'vendor_requested_payment_method':
    633626                    $safe_value = wp_kses( $unsafe_value, wp_kses_allowed_html( 'strip' ) );
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/input-textarea.php

    r995 r2416  
    77
    88    <td>
    9         <textarea id="<?php echo esc_attr( $name ); ?>" name="<?php echo esc_attr( $name ); ?>" class="large-text"><?php echo esc_html( $date ); ?></textarea>
     9        <textarea id="<?php echo esc_attr( $name ); ?>" name="<?php echo esc_attr( $name ); ?>" class="large-text"><?php
     10            echo esc_html( $text );
     11        ?></textarea>
    1012
    1113        <?php if ( ! empty( $description ) ) : ?>
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-general.php

    r2413 r2416  
    3232    ?>
    3333
     34    <?php $this->render_files_input( $post, 'Files', 'files', __( 'Attach supporting documentation including invoices, contracts, or other vendor correspondence. If no supporting documentation is available, please indicate the reason in the notes below.', 'wordcamporg' ) ); ?>
    3435    <?php $this->render_textarea_input( $post, 'Notes', 'general_notes', 'Any other details you want to share.' ); ?>
    3536</table>
Note: See TracChangeset for help on using the changeset viewer.