Making WordPress.org

Changeset 2647


Ignore:
Timestamp:
02/26/2016 11:34:08 PM (8 years ago)
Author:
kovshenin
Message:

WordCamp Budgets: New post statuses/flow compatibily for reimbursement requests.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/reimbursement-requests-dashboard.php

    r2537 r2647  
    4242
    4343    $list_table->prepare_items();
     44    $section_explanation = '';
    4445
    4546    switch ( get_current_section() ) {
    46         case 'submitted':
     47        case 'wcb-pending-approval':
    4748            $section_explanation = 'These requests have been completed by the organizer, and need to be reviewed by a deputy.';
    4849            break;
    4950
    50         case 'info_requested':
     51        case 'wcb-incomplete':
    5152            $section_explanation = 'These requests have been reviewed by a deputy, and sent back to the organizer because they lacked some required information.';
    5253            break;
    5354
    54         case 'rejected':
    55             $section_explanation = 'These requests have been reviewed by a deputy and rejected.';
    56             break;
    57 
    58         case 'in_process':
    59             $section_explanation = "These requests have been reviewed by a deputy and payment is pending.";
    60             break;
    61 
    62         case 'paid':
     55        case 'wcb-cancelled':
     56            $section_explanation = 'These requests have been reviewed by a deputy and cancelled/rejected.';
     57            break;
     58
     59        case 'wcb-approved':
     60            $section_explanation = "These requests have been reviewed and approved by a deputy and payment is pending.";
     61            break;
     62
     63        case 'wcb-pending-payment':
     64            $section_explanation = 'These requests have been exported to our banking software, pending release.';
     65            break;
     66
     67        case 'wcb-paid':
    6368            $section_explanation = 'These requests have been paid and closed.';
    6469            break;
     
    9095 */
    9196function get_section_slugs() {
    92     $slugs = array_keys( \WordCamp\Budgets\Reimbursement_Requests\get_custom_statuses() );
    93 
    94     foreach( $slugs as & $slug ) {
    95         $slug = str_replace( 'wcbrr_', '', $slug );
    96     }
    97 
    98     return $slugs;
     97    return \WordCamp\Budgets\Reimbursement_Requests\get_post_statuses();
    9998}
    10099
     
    105104 */
    106105function get_submenu_page_sections() {
    107     $statuses        = \WordCamp\Budgets\Reimbursement_Requests\get_custom_statuses();
     106    $statuses        = \WordCamp\Budgets\Reimbursement_Requests\get_post_statuses();
    108107    $sections        = array();
    109108    $current_section = get_current_section();
    110109
    111     foreach ( $statuses as $status_slug => $status_name ) {
    112         $status_slug = str_replace( 'wcbrr_', '', $status_slug );    // make the URL easier to read
     110    foreach ( $statuses as $status ) {
     111        $status = get_post_status_object( $status );
    113112
    114113        $classes = 'nav-tab';
    115         if ( $status_slug === $current_section ) {
     114        if ( $status->name === $current_section ) {
    116115            $classes .= ' nav-tab-active';
    117116        }
     
    120119            array(
    121120                'page'    => 'reimbursement-requests-dashboard',
    122                 'section' => $status_slug,
     121                'section' => $status->name,
    123122            ),
    124123            network_admin_url( 'admin.php' )
    125124        );
    126125
    127         $sections[ $status_slug ] = array(
     126        $sections[ $status->name ] = array(
    128127            'classes' => $classes,
    129128            'href'    => $href,
    130             'text'    => $status_name,
     129            'text'    => $status->label,
    131130        );
    132131    }
     
    198197    }
    199198
     199    // Back-compat.
     200    $back_compat_statuses = array(
     201        'wcbrr_submitted' => 'pending-approval',
     202        'wcbrr_info_requested' => 'wcb-incomplete',
     203        'wcbrr_rejected' => 'wcb-failed',
     204        'wcbrr_in_process' => 'pending-payment',
     205        'wcbrr_paid' => 'wcb-paid',
     206    );
     207
     208    // Map old statuses to new statuses.
     209    if ( array_key_exists( $request->post_status, $back_compat_statuses ) ) {
     210        $request->post_status = $back_compat_statuses[ $request->post_status ];
     211    }
     212
    200213    // Drafts, etc aren't displayed in the list table, so there's no reason to index them
    201     $ignored_statuses = array( 'auto-draft', 'draft', 'trash' );
     214    $ignored_statuses = array( 'auto-draft', 'trash' );
    202215    // todo also `inherit`. should switch to whitelist instead of blacklist
    203216
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/reimbursement-requests-list-table.php

    r2538 r2647  
    4242
    4343        $table_name = get_index_table_name();
    44         $status     = 'wcbrr_' . get_current_section();
     44        $status     = get_current_section();
    4545        $paged      = isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
    4646        $limit      = 30;
Note: See TracChangeset for help on using the changeset viewer.