Making WordPress.org


Ignore:
Timestamp:
01/25/2019 03:51:59 AM (6 years ago)
Author:
iandunn
Message:

WordCamp Payments: Prevent sending invoices before contract is signed.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins
Files:
3 edited

Legend:

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

    r8139 r8141  
    251251
    252252    /**
     253     * Get all the status that occur after a camp has a signed contract.
     254     *
     255     * @return array
     256     */
     257    public static function get_after_contract_statuses() {
     258        return array(
     259            'wcpt-needs-fill-list',
     260            'wcpt-needs-schedule',
     261            'wcpt-scheduled',
     262            'wcpt-closed',
     263        );
     264    }
     265
     266    /**
    253267     * Get the milestones that correspond to each status
    254268     *
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-invoice.php

    r6067 r8141  
    66
    77namespace WordCamp\Budgets\Sponsor_Invoices;
     8use WP_Post;
     9use WordCamp_Loader;
    810
    911defined( 'WPINC' ) or die();
     
    244246 * Render the Status metabox
    245247 *
    246  * @param \WP_Post $post
     248 * @param WP_Post $post The invoice post
    247249 */
    248250function render_status_metabox( $post ) {
     251    require_once( WP_PLUGIN_DIR . '/wcpt/wcpt-event/class-event-loader.php' );
     252    require_once( WP_PLUGIN_DIR . '/wcpt/wcpt-wordcamp/wordcamp-loader.php' );
     253
    249254    wp_nonce_field( 'status', 'status_nonce' );
    250255
    251256    $delete_text = EMPTY_TRASH_DAYS ? esc_html__( 'Move to Trash' ) : esc_html__( 'Delete Permanently' );
     257    $wordcamp    = get_wordcamp_post();
    252258
    253259    /*
     
    269275    }
    270276
     277    $allowed_submit_statuses         = WordCamp_Loader::get_after_contract_statuses();
    271278    $current_user_can_edit_request = in_array( $post->post_status, $allowed_edit_statuses, true );
     279    $current_user_can_submit_request = $wordcamp && in_array( $wordcamp->post_status, $allowed_submit_statuses, true );
    272280
    273281    require_once( dirname( __DIR__ ) . '/views/sponsor-invoice/metabox-status.php' );
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-invoice/metabox-status.php

    r4967 r8141  
    22
    33namespace WordCamp\Budgets\Sponsor_Invoices;
     4use WP_Post;
     5
    46defined( 'WPINC' ) or die();
     7
     8/**
     9 * @var WP_Post $post
     10 * @var string  $delete_text
     11 * @var array   $allowed_edit_statuses
     12 * @var bool    $current_user_can_edit_request
     13 * @var bool    $current_user_can_submit_request
     14 */
    515
    616?>
     
    4151
    4252    <div id="major-publishing-actions">
    43         <?php if ( $current_user_can_edit_request ) : ?>
     53        <?php if ( $current_user_can_edit_request && $current_user_can_submit_request ) : ?>
    4454
    4555            <div id="delete-action">
     
    6474            <div class="clear"></div>
    6575
     76        <?php elseif ( ! $current_user_can_submit_request ) : ?>
     77
     78            <p>
     79                <?php _e( "Invoices can't be submitted until your venue contract has been signed.", 'wordcamporg' ); ?>
     80            </p>
     81
    6682        <?php else : ?>
    6783
Note: See TracChangeset for help on using the changeset viewer.