Making WordPress.org

Changeset 2617


Ignore:
Timestamp:
02/25/2016 07:34:11 PM (9 years ago)
Author:
kovshenin
Message:

WordCamp.org: Add new payment requests statuses/flow to the network dashboard.

Location:
sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network

  • sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/bootstrap.php

    r2421 r2617  
    2121     */
    2222    require_once( WP_PLUGIN_DIR . '/wordcamp-payments/includes/wordcamp-budgets.php' );
    23     if ( defined( 'WPORG_PROXIED_REQUEST' ) && WPORG_PROXIED_REQUEST ) {
    24         require_once( WP_PLUGIN_DIR . '/wordcamp-payments/includes/sponsor-invoice.php' );
    25     }
     23    require_once( WP_PLUGIN_DIR . '/wordcamp-payments/includes/sponsor-invoice.php' );
    2624
    2725    require_once( __DIR__ . '/includes/wordcamp-budgets-dashboard.php' );
    2826    require_once( __DIR__ . '/includes/payment-requests-dashboard.php' );
    29     if ( defined( 'WPORG_PROXIED_REQUEST' ) && WPORG_PROXIED_REQUEST ) {
    30         require_once( __DIR__ . '/includes/sponsor-invoices-dashboard.php' );
    31     }
     27    require_once( __DIR__ . '/includes/sponsor-invoices-dashboard.php' );
    3228    require_once( __DIR__ . '/includes/reimbursement-requests-dashboard.php' );
    3329
  • sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/payment-requests-dashboard.php

    r2597 r2617  
    9999            while ( $requests = get_posts( array(
    100100                'paged' => $paged++,
    101                 'post_status' => array( 'paid', 'unpaid', 'incomplete' ),
     101                'post_status' => 'any',
    102102                'post_type' => 'wcp_payment_request',
    103103                'posts_per_page' => 20,
     
    140140        if ( ! empty( $amount) ) {
    141141            $keywords[] = $amount;
     142        }
     143
     144        $back_compat_statuses = array(
     145            'unpaid' => 'draft',
     146            'incomplete' => 'wcb-incomplete',
     147            'paid' => 'wcb-paid',
     148        );
     149
     150        // Map old statuses to new statuses.
     151        if ( array_key_exists( $request->post_status, $back_compat_statuses ) ) {
     152            $request->post_status = $back_compat_statuses[ $request->post_status ];
    142153        }
    143154
     
    12301241        $tab = 'overdue';
    12311242        $tabs = array(
    1232             'pending',
    12331243            'overdue',
     1244
     1245            'pending-approval',
     1246            'approved',
     1247            'pending-payment',
    12341248            'paid',
     1249            'cancelled-failed',
    12351250            'incomplete',
     1251
    12361252            'export',
    12371253            'import',
     
    12511267        $current_section = self::get_current_tab();
    12521268        $sections = array(
    1253             'overdue' => 'Overdue',
    1254             'pending' => 'Pending',
    1255             'paid'    => 'Paid',
    1256             'incomplete' => __( 'Incomplete', 'wordcamporg' ),
    1257             'export'     => __( 'Export', 'wordcamporg' ),
    1258             'import'     => __( 'Import', 'wordcamporg' ),
     1269            'overdue'          => __( 'Overdue', 'wordcamporg' ), // pending-approval + after due date
     1270            'pending-approval' => __( 'Pending Approval', 'wordcamporg' ),
     1271            'approved'         => __( 'Approved', 'wordcamporg' ),
     1272            'pending-payment'  => __( 'Pending Payment', 'wordcamporg' ),
     1273            'paid'             => __( 'Paid', 'wordcamporg' ),
     1274            'cancelled-failed' => __( 'Cancelled/Failed', 'wordcamporg' ),
     1275            'incomplete'       => __( 'Incomplete', 'wordcamporg' ),
     1276            'export'           => __( 'Export', 'wordcamporg' ),
     1277            'import'           => __( 'Import', 'wordcamporg' ),
    12591278        );
    12601279
  • sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/payment-requests-list-table.php

    r2538 r2617  
    7777
    7878        if ( 'overdue' == $view ) {
    79             $where .= $wpdb->prepare( " AND `status` = 'unpaid' AND `due` > 0 AND `due` <= %d ", time() );
    80         } elseif ( 'pending' == $view ) {
    81             $where .= " AND `status` = 'unpaid' ";
     79            $where .= $wpdb->prepare( " AND `status` = 'wcb-pending-approval' AND `due` > 0 AND `due` <= %d ", time() );
     80        } elseif ( 'pending-approval' == $view ) {
     81            $where .= " AND `status` = 'wcb-pending-approval' ";
     82        } elseif ( 'approved' == $view ) {
     83            $where .= " AND `status` = 'wcb-approved' ";
     84        } elseif ( 'pending-payment' == $view ) {
     85            $where .= " AND `status` = 'wcb-pending-payment' ";
    8286        } elseif ( 'paid' == $view ) {
    83             $where .= " AND `status` = 'paid' ";
     87            $where .= " AND `status` = 'wcb-paid' ";
    8488            $orderby = 'created';
    8589            $order = 'desc';
    86         } elseif( 'incomplete' == $view ) {
    87             $where .= " AND `status` = 'incomplete' ";
     90        } elseif ( 'incomplete' == $view ) {
     91            $where .= " AND `status` = 'wcb-incomplete' ";
     92        } elseif ( 'cancelled-failed' == $view ) {
     93            $where .= " AND `status` IN ( 'wcb-failed', 'wcb-cancelled' ) ";
    8894        }
    8995
     
    153159     */
    154160    public function column_status( $request ) {
    155         return esc_html( ucwords( $request->post_status ) );
     161        $status = get_post_status_object( $request->post_status );
     162        return esc_html( $status->label );
    156163    }
    157164
Note: See TracChangeset for help on using the changeset viewer.