<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[8136] sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments: WordCamp Payments: Prevent submission of requests that have no documentation</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/8136">8136</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/8136","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>coreymckrill</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-01-24 14:31:10 +0000 (Thu, 24 Jan 2019)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WordCamp Payments: Prevent submission of requests that have no documentation

For both Payment Requests and Reimbursement Requests:

* Add a method to check and see if the request post can be submitted. Currently this just checks to see if the post has one or more files attached to it.
* When the post fails the check, show a note in the Status metabox that documentation must be attached first, and don't render the Submit for Review button.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludespaymentrequestphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludesreimbursementrequestphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/reimbursement-request.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludeswordcampbudgetsphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewspaymentrequestmetaboxstatusphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-status.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewsreimbursementrequestmetaboxstatusphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/reimbursement-request/metabox-status.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewswordcampbudgetsmajorpublishingactionsphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/wordcamp-budgets/major-publishing-actions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludespaymentrequestphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php    2019-01-24 14:28:53 UTC (rev 8135)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php      2019-01-24 14:31:10 UTC (rev 8136)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -111,6 +111,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Get a list of statuses for which posts can be edited by non-admins.
+        *
+        * @return array
+        */
+       protected static function get_editable_statuses() {
+               return [ 'auto-draft', 'draft', 'wcb-incomplete' ];
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Register meta boxes
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function init_meta_boxes() {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -230,16 +239,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        $post->post_status = $back_compat_statuses[ $post->post_status ];
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $editable_statuses = array( 'auto-draft', 'draft', 'wcb-incomplete' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $editable_statuses = self::get_editable_statuses();
</ins><span class="cx" style="display: block; padding: 0 10px">                 $current_user_can_edit_request = false;
</span><span class="cx" style="display: block; padding: 0 10px">                $submit_text = esc_html_x( 'Update', 'payment request', 'wordcamporg' );
</span><span class="cx" style="display: block; padding: 0 10px">                $submit_note = '';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                $submit_note_class = 'warning';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                if ( current_user_can( 'manage_network' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $current_user_can_edit_request = true;
</span><span class="cx" style="display: block; padding: 0 10px">                } elseif ( in_array( $post->post_status, $editable_statuses ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $submit_text = esc_html__( 'Submit for Review', 'wordcamporg' );
-                       $submit_note = esc_html__( 'Once submitted for review, this request can not be edited.', 'wordcamporg' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( WordCamp_Budgets::can_submit_request( $post ) ) {
+                               $submit_text = __( 'Submit for Review', 'wordcamporg' );
+                               $submit_note = __( 'Once submitted for review, this request cannot be edited.', 'wordcamporg' );
+                       } else {
+                               $submit_note = __( 'Please add an invoice or other supporting documentation in the Files section and save the draft.', 'wordcamporg' );
+                               $submit_note_class = 'error';
+                       }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                         $current_user_can_edit_request = true;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -583,7 +599,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Submit for Review button was clicked.
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! current_user_can( 'manage_network' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        $editable_statuses = array( 'auto-draft', 'draft', 'wcb-incomplete' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $editable_statuses = self::get_editable_statuses();
</ins><span class="cx" style="display: block; padding: 0 10px">                         if ( ! empty( $post_data_raw['wcb-update'] ) && in_array( $post_data['post_status'], $editable_statuses ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                                $post_data['post_status'] = 'wcb-pending-approval';
</span><span class="cx" style="display: block; padding: 0 10px">                        }
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludesreimbursementrequestphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/reimbursement-request.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/reimbursement-request.php      2019-01-24 14:28:53 UTC (rev 8135)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/reimbursement-request.php        2019-01-24 14:31:10 UTC (rev 8136)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,11 +5,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordCamp\Budgets\Reimbursement_Requests;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+defined( 'WPINC' ) or die();
+
+use WP_Post;
</ins><span class="cx" style="display: block; padding: 0 10px"> use WCP_Encryption;
</span><span class="cx" style="display: block; padding: 0 10px"> use WordCamp\Utilities;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+use WordCamp_Budgets;
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-defined( 'WPINC' ) or die();
-
</del><span class="cx" style="display: block; padding: 0 10px"> const POST_TYPE = 'wcb_reimbursement';
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> // Initialization
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -250,7 +252,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * requests and to submit notes, but they should only be able to change the form fields if the post hasn't been
</span><span class="cx" style="display: block; padding: 0 10px">  * submitted yet, or if we've asked for more information.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param \WP_Post $post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $post
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @return bool
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -262,7 +264,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Render the Status metabox
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param \WP_Post $post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $post
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function render_status_metabox( $post ) {
</span><span class="cx" style="display: block; padding: 0 10px">        wp_nonce_field( 'status', 'status_nonce' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -285,12 +287,19 @@
</span><span class="cx" style="display: block; padding: 0 10px">        $current_user_can_edit_request = false;
</span><span class="cx" style="display: block; padding: 0 10px">        $submit_text = esc_html_x( 'Update', 'payment request', 'wordcamporg' );
</span><span class="cx" style="display: block; padding: 0 10px">        $submit_note = '';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        $submit_note_class = 'warning';
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( current_user_can( 'manage_network' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $current_user_can_edit_request = true;
</span><span class="cx" style="display: block; padding: 0 10px">        } elseif ( in_array( $post->post_status, $editable_statuses ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $submit_text = esc_html__( 'Submit for Review', 'wordcamporg' );
-               $submit_note = esc_html__( 'Once submitted for review, this request can not be edited.', 'wordcamporg' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( WordCamp_Budgets::can_submit_request( $post ) ) {
+                       $submit_text = __( 'Submit for Review', 'wordcamporg' );
+                       $submit_note = __( 'Once submitted for review, this request cannot be edited.', 'wordcamporg' );
+               } else {
+                       $submit_note = __( 'Please add an invoice or other supporting documentation in the Files section and save the draft.', 'wordcamporg' );
+                       $submit_note_class = 'error';
+               }
+
</ins><span class="cx" style="display: block; padding: 0 10px">                 $current_user_can_edit_request = true;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -299,7 +308,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $request_id         = get_current_blog_id() . '-' . $post->ID;
</span><span class="cx" style="display: block; padding: 0 10px">        $requested_by       = \WordCamp_Budgets::get_requester_name( $post->post_author );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $update_text        = current_user_can( 'manage_network' ) ? esc_html__( 'Update Request', 'wordcamporg' ) : esc_html__( 'Send Request', 'wordcamporg' );
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        require_once( dirname( __DIR__ ) . '/views/reimbursement-request/metabox-status.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -307,7 +315,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Render the Notes metabox
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param \WP_Post $post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $post
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function render_notes_metabox( $post ) {
</span><span class="cx" style="display: block; padding: 0 10px">        wp_nonce_field( 'notes', 'notes_nonce' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -320,7 +328,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Render General Information Metabox
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param \WP_Post $post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $post
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function render_general_information_metabox( $post ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -364,7 +372,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Render Expenses Metabox
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param \WP_Post $post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $post
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function render_expenses_metabox( $post ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -439,7 +447,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * Save the post's data
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param int      $post_id
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param \WP_Post $post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $post
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function save_request( $post_id, $post ) {
</span><span class="cx" style="display: block; padding: 0 10px">        if ( ! \WordCamp_Budgets::post_edit_is_actionable( $post, POST_TYPE ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -464,7 +472,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * To avoid that, we create a stub WP_Post with the original post status, and give that to
</span><span class="cx" style="display: block; padding: 0 10px">         * user_can_edit_request() instead.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        $original_post = new \WP_Post( (object) array( 'post_status' => $_POST['original_post_status'] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $original_post = new WP_Post( (object) array( 'post_status' => $_POST['original_post_status'] ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( user_can_edit_request( $original_post ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                $text_fields = array( 'name_of_payer', 'currency', 'reason', 'reason_other' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -670,7 +678,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Validate and save expense data
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param \WP_Post $post
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $post
</ins><span class="cx" style="display: block; padding: 0 10px">  * @param array    $expenses
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function validate_and_save_notes( $post, $new_note_message ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -715,7 +723,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px">  * Notify WordCamp Central or the request author when new notes are added
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param \WP_Post $request
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $request
</ins><span class="cx" style="display: block; padding: 0 10px">  * @param array    $note
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function notify_parties_of_new_note( $request, $note ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -761,7 +769,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param string   $new_status
</span><span class="cx" style="display: block; padding: 0 10px">  * @param string   $old_status
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param \WP_Post $request
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param WP_Post $request
</ins><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function notify_organizer_request_updated( $new_status, $old_status, $request ) {
</span><span class="cx" style="display: block; padding: 0 10px">        if ( $request->post_type !== POST_TYPE ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1549,4 +1557,4 @@
</span><span class="cx" style="display: block; padding: 0 10px">        // JPM chokes on accents and non-latin characters.
</span><span class="cx" style="display: block; padding: 0 10px">        $results = remove_accents( $results );
</span><span class="cx" style="display: block; padding: 0 10px">        return $results;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-}
</del><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of file
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+}
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludeswordcampbudgetsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php   2019-01-24 14:28:53 UTC (rev 8135)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php     2019-01-24 14:31:10 UTC (rev 8136)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2668,6 +2668,21 @@
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Check if a request post meets the requirements to be submitted for review.
+        *
+        * @param WP_Post $post
+        */
+       public static function can_submit_request( $post ) {
+               // A request must have documentation attached before it can be submitted.
+               $files = self::get_attached_files( $post );
+               if ( empty( $files ) ) {
+                       return false;
+               }
+
+               return true;
+       }
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Get the files attached to a post
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @param WP_Post $post
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewspaymentrequestmetaboxstatusphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-status.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-status.php        2019-01-24 14:28:53 UTC (rev 8135)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-status.php  2019-01-24 14:31:10 UTC (rev 8136)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,3 +1,16 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * @var WP_Post             $post
+ * @var WCP_Payment_Request $this
+ * @var bool                $current_user_can_edit_request
+ * @var string              $submit_text
+ * @var string              $submit_note
+ * @var string              $submit_note_class
+ * @var bool                $date_vendor_paid_readonly
+ * @var string              $incomplete_notes
+ * @var bool                $incomplete_readonly
+ */
+?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <div id="submitpost" class="wcb submitbox">
</span><span class="cx" style="display: block; padding: 0 10px">        <div id="minor-publishing">
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -39,7 +52,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">                                                <?php if ( current_user_can( 'manage_network' ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                                                        <select id="wcb_status" name="post_status">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                                                <?php foreach ( self::get_post_statuses() as $status ) : ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                                         <?php foreach ( WCP_Payment_Request::get_post_statuses() as $status ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">                                                                         <?php $status = get_post_status_object( $status ); ?>
</span><span class="cx" style="display: block; padding: 0 10px">                                                                        <option value="<?php echo esc_attr( $status->name ); ?>" <?php selected( $post->post_status, $status->name ); ?> >
</span><span class="cx" style="display: block; padding: 0 10px">                                                                                <?php echo esc_html( $status->label ); ?>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -82,35 +95,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="clear"></div>
</span><span class="cx" style="display: block; padding: 0 10px">        </div> <!-- #minor-publishing -->
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        <?php require dirname( __DIR__ ) . '/wordcamp-budgets/major-publishing-actions.php'; ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <div id="major-publishing-actions">
-               <?php if ( $current_user_can_edit_request ) : ?>
-
-                       <?php if ( !empty( $submit_note ) ) : ?>
-                               <div><?php echo $submit_note; ?></div>
-                       <?php endif; ?>
-
-
-                       <div id="delete-action">
-                               <?php if ( current_user_can( 'delete_post', $post->ID ) ) : ?>
-                                       <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>">
-                                               <?php _e( 'Delete', 'wordcamporg' ); ?>
-                                       </a>
-                               <?php endif; ?>
-                       </div>
-
-                       <div id="publishing-action">
-                               <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr( $submit_text ) ?>" />
-                               <?php submit_button( $submit_text, 'primary button-large', 'wcb-update', false, array( 'accesskey' => 'p' ) ); ?>
-                       </div>
-
-                       <div class="clear"></div>
-
-               <?php else : ?>
-
-                       <?php _e( 'This request can not be edited.', 'wordcamporg' ); ?>
-
-               <?php endif; ?>
-       </div> <!-- #major-publishing-actions -->
-
</del><span class="cx" style="display: block; padding: 0 10px"> </div> <!-- .submitbox -->
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewsreimbursementrequestmetaboxstatusphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/reimbursement-request/metabox-status.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/reimbursement-request/metabox-status.php  2019-01-24 14:28:53 UTC (rev 8135)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/reimbursement-request/metabox-status.php    2019-01-24 14:31:10 UTC (rev 8136)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,6 +3,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> namespace WordCamp\Budgets\Reimbursement_Requests;
</span><span class="cx" style="display: block; padding: 0 10px"> defined( 'WPINC' ) or die();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * @var \WP_Post $post
+ * @var bool     $current_user_can_edit_request
+ * @var string   $request_id
+ * @var string   $requested_by
+ * @var string   $incomplete_notes
+ * @var bool     $incomplete_readonly
+ * @var string   $submit_text
+ * @var string   $submit_note
+ * @var string   $submit_note_class
+ */
</ins><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="submitpost" class="wcb submitbox">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -84,33 +95,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">                <div class="clear"></div>
</span><span class="cx" style="display: block; padding: 0 10px">        </div> <!-- #minor-publishing -->
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        <?php require dirname( __DIR__ ) . '/wordcamp-budgets/major-publishing-actions.php'; ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        <div id="major-publishing-actions">
-               <?php if ( $current_user_can_edit_request ) : ?>
-                       <?php if ( !empty( $submit_note ) ) : ?>
-                               <div><?php echo $submit_note; ?></div>
-                       <?php endif; ?>
-
-                       <div id="delete-action">
-                               <?php if ( current_user_can( 'delete_post', $post->ID ) ) : ?>
-                                       <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>">
-                                               <?php _e( 'Delete', 'wordcamporg' ); ?>
-                                       </a>
-                               <?php endif; ?>
-                       </div>
-
-                       <div id="publishing-action">
-                               <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr( $submit_text ) ?>" />
-                               <?php submit_button( $submit_text, 'primary button-large', 'wcb-update', false, array( 'accesskey' => 'p' ) ); ?>
-                       </div>
-
-                       <div class="clear"></div>
-
-               <?php else : ?>
-
-                       <?php _e( 'This request can not be edited.', 'wordcamporg' ); ?>
-
-               <?php endif; ?>
-       </div> <!-- #major-publishing-actions -->
-
</del><span class="cx" style="display: block; padding: 0 10px"> </div> <!-- .submitbox -->
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewswordcampbudgetsmajorpublishingactionsphp"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/wordcamp-budgets/major-publishing-actions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/wordcamp-budgets/major-publishing-actions.php                             (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/wordcamp-budgets/major-publishing-actions.php       2019-01-24 14:31:10 UTC (rev 8136)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,42 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+/**
+ * @var WP_Post $post
+ * @var bool    $current_user_can_edit_request
+ * @var string  $submit_text
+ * @var string  $submit_note
+ * @var string  $submit_note_class
+ */
+?>
+
+<div id="major-publishing-actions">
+       <?php if ( $current_user_can_edit_request ) : ?>
+
+               <?php if ( ! empty( $submit_note ) ) : ?>
+                       <div class="notice notice-<?php echo esc_attr( $submit_note_class ); ?> inline">
+                               <?php echo wpautop( esc_html( $submit_note ) ); ?>
+                       </div>
+               <?php endif; ?>
+
+               <?php if ( current_user_can( 'delete_post', $post->ID ) ) : ?>
+                       <div id="delete-action">
+                               <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>">
+                                       <?php _e( 'Delete', 'wordcamporg' ); ?>
+                               </a>
+                       </div>
+               <?php endif; ?>
+
+               <?php if ( \WordCamp_Budgets::can_submit_request( $post ) ) : ?>
+                       <div id="publishing-action">
+                               <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr( $submit_text ) ?>" />
+                               <?php submit_button( $submit_text, 'primary button-large', 'wcb-update', false, array( 'accesskey' => 'p' ) ); ?>
+                       </div>
+               <?php endif; ?>
+
+               <div class="clear"></div>
+
+       <?php else : ?>
+
+               <?php _e( 'This request can not be edited.', 'wordcamporg' ); ?>
+
+       <?php endif; ?>
+</div> <!-- #major-publishing-actions -->
</ins></span></pre>
</div>
</div>

</body>
</html>