<!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>[2633] sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments: WordCamp.org: Reintegrate branch into trunk (wordcamp-payments)</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 { 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/2633">2633</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/2633","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>kovshenin</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-02-26 00:57:40 +0000 (Fri, 26 Feb 2016)</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.org: Reintegrate branch into trunk (wordcamp-payments)</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentscsswordcampbudgetscss">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css</a></li>
<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_htmlwpcontentpluginswordcamppaymentsjavascriptpaymentrequestsjs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js</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>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewspaymentrequestmetaboxmarkincompletephp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-mark-incomplete.php</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppayments">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<span class="cx" style="display: block; padding: 0 10px">Index: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
</span><span class="cx" style="display: block; padding: 0 10px">===================================================================
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">--- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments 2016-02-26 00:56:15 UTC (rev 2632)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments 2016-02-26 00:57:40 UTC (rev 2633)
</ins><a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppayments"></a>
<div class="propset"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Property changes: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments</h4>
<pre class="diff"><span>
</span></pre></div>
<a id="svnmergeinfo"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:mergeinfo</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/sites/branches/wcb-payment-request-statuses/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments:2603-2632
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentscsswordcampbudgetscss"></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/css/wordcamp-budgets.css</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/css/wordcamp-budgets.css 2016-02-26 00:56:15 UTC (rev 2632)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css 2016-02-26 00:57:40 UTC (rev 2633)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -13,6 +13,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> width: 100%;
</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">+#submitpost.wcb .misc-pub-section select {
+ font-weight: normal;
+}
+
+#wcb-save-draft {
+ float: left;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /* Forms */
</span><span class="cx" style="display: block; padding: 0 10px"> .wcb-form {
</span><span class="cx" style="display: block; padding: 0 10px"> display: table;
</span></span></pre></div>
<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 2016-02-26 00:56:15 UTC (rev 2632)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/payment-request.php 2016-02-26 00:57:40 UTC (rev 2633)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,6 +8,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const POST_TYPE = 'wcp_payment_request';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // @see https://core.trac.wordpress.org/ticket/19074
+ public static $transition_post_status = array();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> public function __construct() {
</span><span class="cx" style="display: block; padding: 0 10px"> // Initialization
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'init', array( $this, 'register_post_type' ));
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,8 +22,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'display_post_states', array( $this, 'display_post_states' ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Saving posts
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- add_filter( 'wp_insert_post_data', array( $this, 'update_request_status' ), 10, 2 );
- add_filter( 'wp_insert_post_data', array( $this, 'ensure_post_date_gmt_set' ), 10, 2 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ add_filter( 'wp_insert_post_data', array( $this, 'wp_insert_post_data' ), 10, 2 );
</ins><span class="cx" style="display: block; padding: 0 10px"> add_action( 'save_post', array( $this, 'save_payment' ), 10, 2 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_filter( 'map_meta_cap', array( $this, 'modify_capabilities' ), 10, 4 );
</span><span class="cx" style="display: block; padding: 0 10px"> add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -74,6 +76,86 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Register our custom post statuses
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public static function register_post_statuses() {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Uses core's draft status.
+
+ register_post_status( 'wcb-incomplete', array (
+ 'label' => _x( 'Incomplete', 'payment request', 'wordcamporg' ),
+ 'public' => false,
+ 'protected' => true,
+ 'label_count' => _nx_noop(
+ 'Incomplete <span class="count">(%s)</span>',
+ 'Incomplete <span class="count">(%s)</span>',
+ 'wordcamporg'
+ ),
+ ) );
+
+ register_post_status( 'wcb-pending-approval', array (
+ 'label' => _x( 'Pending Approval', 'payment request', 'wordcamporg' ),
+ 'public' => false,
+ 'protected' => true,
+ 'label_count' => _nx_noop(
+ 'Pending Approval <span class="count">(%s)</span>',
+ 'Pending Approval <span class="count">(%s)</span>',
+ 'wordcamporg'
+ ),
+ ) );
+
+ register_post_status( 'wcb-approved', array (
+ 'label' => _x( 'Approved', 'payment request', 'wordcamporg' ),
+ 'public' => false,
+ 'protected' => true,
+ 'label_count' => _nx_noop(
+ 'Approved <span class="count">(%s)</span>',
+ 'Approved <span class="count">(%s)</span>',
+ 'wordcamporg'
+ ),
+ ) );
+
+ register_post_status( 'wcb-pending-payment', array (
+ 'label' => _x( 'Pending Payment', 'payment request', 'wordcamporg' ),
+ 'public' => false,
+ 'protected' => true,
+ 'label_count' => _nx_noop(
+ 'Pending Payment <span class="count">(%s)</span>',
+ 'Pending Payment <span class="count">(%s)</span>',
+ 'wordcamporg'
+ ),
+ ) );
+
+ register_post_status( 'wcb-paid', array (
+ 'label' => _x( 'Paid', 'payment request', 'wordcamporg' ),
+ 'public' => false,
+ 'protected' => true,
+ 'label_count' => _nx_noop(
+ 'Paid <span class="count">(%s)</span>',
+ 'Paid <span class="count">(%s)</span>',
+ 'wordcamporg'
+ ),
+ ) );
+
+ register_post_status( 'wcb-failed', array (
+ 'label' => _x( 'Failed', 'payment request', 'wordcamporg' ),
+ 'public' => false,
+ 'protected' => true,
+ 'label_count' => _nx_noop(
+ 'Failed <span class="count">(%s)</span>',
+ 'Failed <span class="count">(%s)</span>',
+ 'wordcamporg'
+ ),
+ ) );
+
+ register_post_status( 'wcb-cancelled', array (
+ 'label' => _x( 'Cancelled', 'payment request', 'wordcamporg' ),
+ 'public' => false,
+ 'protected' => true,
+ 'label_count' => _nx_noop(
+ 'Cancelled <span class="count">(%s)</span>',
+ 'Cancelled <span class="count">(%s)</span>',
+ 'wordcamporg'
+ ),
+ ) );
+
+ // Legacy statuses
</ins><span class="cx" style="display: block; padding: 0 10px"> register_post_status(
</span><span class="cx" style="display: block; padding: 0 10px"> 'paid',
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -124,17 +206,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'high'
</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">- if ( 'incomplete' != $post->post_status && current_user_can( 'manage_network' ) ) {
- add_meta_box(
- 'wcp_mark_incomplete',
- __( 'Mark as Incomplete', 'wordcamporg' ),
- array( $this, 'render_mark_incomplete_metabox' ),
- self::POST_TYPE,
- 'side',
- 'high'
- );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> add_meta_box(
</span><span class="cx" style="display: block; padding: 0 10px"> 'wcp_general_info',
</span><span class="cx" style="display: block; padding: 0 10px"> __( 'General Information', 'wordcamporg' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -205,10 +276,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public function render_status_metabox( $post ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wp_nonce_field( 'status', 'status_nonce' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $delete_text = EMPTY_TRASH_DAYS ? __( 'Move to Trash' ) : __( 'Delete Permanently' );
- $submit_text = 'auto-draft' == $post->post_status ? __( 'Submit Request', 'wordcamporg' ) : __( 'Update Request', 'wordcamporg' );
- $current_user_can_edit_request = 'paid' != $post->post_status || current_user_can( 'manage_network' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $back_compat_statuses = array(
+ 'unpaid' => 'draft',
+ 'incomplete' => 'wcb-incomplete',
+ 'paid' => 'wcb-paid',
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Map old statuses to new statuses.
+ if ( array_key_exists( $post->post_status, $back_compat_statuses ) ) {
+ $post->post_status = $back_compat_statuses[ $post->post_status ];
+ }
+
+ $editable_statuses = array( 'auto-draft', 'draft', 'wcb-incomplete' );
+ $current_user_can_edit_request = false;
+ $submit_text = _x( 'Update', 'payment request', 'wordcamporg' );
+
+ if ( current_user_can( 'manage_network' ) ) {
+ $current_user_can_edit_request = true;
+ } elseif ( in_array( $post->post_status, $editable_statuses ) ) {
+ $submit_text = __( 'Submit for Review', 'wordcamporg' );
+ $current_user_can_edit_request = true;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $date_vendor_paid = get_post_meta( $post->ID, '_camppayments_date_vendor_paid', true );
</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"> $date_vendor_paid_readonly = false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -216,18 +305,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $date_vendor_paid_readonly = true;
</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">+ $incomplete_notes = get_post_meta( $post->ID, '_wcp_incomplete_notes', true );
+ $incomplete_readonly = ! current_user_can( 'manage_network' ) ? 'readonly' : '';
+
</ins><span class="cx" style="display: block; padding: 0 10px"> require_once( dirname( __DIR__ ) . '/views/payment-request/metabox-status.php' );
</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">- /**
- * Render the Mark as Incomplete metabox
- *
- * @param WP_Post $post
- */
- public function render_mark_incomplete_metabox( $post ) {
- wp_nonce_field( 'mark_incomplete', 'mark_incomplete_nonce' );
-
- require_once( dirname( __DIR__ ) . '/views/payment-request/metabox-mark-incomplete.php' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public static function get_post_statuses() {
+ return array(
+ 'draft',
+ 'wcb-incomplete',
+ 'wcb-pending-approval',
+ 'wcb-approved',
+ 'wcb-pending-payment',
+ 'wcb-paid',
+ 'wcb-failed',
+ 'wcb-cancelled',
+ );
</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"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -475,118 +569,88 @@
</span><span class="cx" style="display: block; padding: 0 10px"> function display_post_states( $states ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $post;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'paid' == $post->post_status && 'paid' != get_query_var( 'post_status' ) ) {
- $states['paid'] = __( 'Paid', 'wordcamporg' );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $post->post_type != self::POST_TYPE )
+ return $states;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'unpaid' == $post->post_status && 'unpaid' != get_query_var( 'post_status' ) ) {
- $states['unpaid'] = __( 'Unpaid', 'wordcamporg' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Back-compat
+ $back_compat_statuses = array(
+ 'unpaid' => 'draft',
+ 'incomplete' => 'wcb-incomplete',
+ 'paid' => 'wcb-paid',
+ );
+
+ // Map old statuses to new statuses.
+ if ( array_key_exists( $post->post_status, $back_compat_statuses ) ) {
+ $post->post_status = $back_compat_statuses[ $post->post_status ];
</ins><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">- if ( 'incomplete' == $post->post_status && 'incomplete' != get_query_var( 'post_status' ) ) {
- $states['incomplete'] = __( 'Incomplete', 'wordcamporg' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $status = get_post_status_object( $post->post_status );
+ if ( get_query_var( 'post_status' ) != $post->post_status ) {
+ $states[ $status->name ] = $status->label;
</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"> return $states;
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set the request's status based on whether the vendor has been paid.
</del><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $post_data
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $post_data_raw
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ *
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function update_request_status( $post_data, $post_data_raw ) {
- if ( WordCamp_Budgets::post_edit_is_actionable( $post_data, self::POST_TYPE ) ) {
- if ( $this->should_mark_request_incomplete() ) {
- $post_data['post_status'] = 'incomplete';
- $this->notify_requester_request_incomplete( $post_data_raw['ID'], $post_data, $post_data_raw );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function wp_insert_post_data( $post_data, $post_data_raw ) {
+ if ( $post_data['post_type'] != self::POST_TYPE )
+ return $post_data;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- update_post_meta( $post_data_raw['ID'], '_wcp_incomplete_notes', sanitize_text_field( $post_data_raw['wcp_mark_incomplete_notes'] ) );
- } else {
- $previous_status = $post_data['post_status'];
- $valid_paid_date = false !== strtotime( sanitize_text_field( $_POST['date_vendor_paid'] ) );
- // todo realign
-
- if ( current_user_can( 'manage_network' ) && $valid_paid_date ) {
- $post_data['post_status'] = 'paid';
- } else {
- $post_data['post_status'] = 'unpaid';
- }
-
- if ( 'paid' != $previous_status && 'paid' == $post_data['post_status'] ) {
- $this->notify_requester_payment_made( $post_data_raw['ID'], $post_data );
- }
- }
- }
-
- return $post_data;
- }
-
- /**
- * Ensure that new posts have the `post_date_gmt` field populated.
- *
- * Core only handles this for post types that use the `draft` status (see r8636).
- *
- * @param array $post_data
- * @param array $post_data_raw
- *
- * @return array
- */
- public function ensure_post_date_gmt_set( $post_data, $post_data_raw ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Ensure that new posts have the `post_date_gmt` field populated.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'auto-draft' !== $post_data['post_status'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( '0000-00-00 00:00:00' === $post_data['post_date_gmt'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] );
</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><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $post_data;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Save Draft button was clicked.
+ if ( ! empty( $post_data_raw['wcb-save-draft'] ) ) {
+ $post_data['post_status'] = 'draft';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /**
- * Determine if the user wants to mark a vendor payment as incomplete, and if that is valid
- *
- * @return bool
- */
- protected function should_mark_request_incomplete() {
- $mark_incomplete = false;
-
- if ( isset( $_POST['wcp_mark_incomplete_checkbox'] ) && 'on' == $_POST['wcp_mark_incomplete_checkbox'] && ! empty( $_POST['wcp_mark_incomplete_notes'] ) ) {
- if ( isset( $_POST['mark_incomplete_nonce'] ) && wp_verify_nonce( $_POST['mark_incomplete_nonce'], 'mark_incomplete' ) ) {
- if ( current_user_can( 'manage_network' ) ) {
- $mark_incomplete = true;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Submit for Review button was clicked.
+ if ( ! current_user_can( 'manage_network' ) ) {
+ $editable_statuses = array( 'auto-draft', 'draft', 'wcb-incomplete' );
+ if ( ! empty( $post_data_raw['wcb-update'] ) && in_array( $post_data['post_status'], $editable_statuses ) ) {
+ $post_data['post_status'] = 'wcb-pending-approval';
</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">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- return $mark_incomplete;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $post_data;
</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"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Notify the payment requester that it has been marked as paid.
</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 int $request_id
- * @param array $post_data
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int|WP_Post $post
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected function notify_requester_payment_made( $request_id, $post_data ) {
- if ( ! $to = WordCamp_Budgets::get_requester_formatted_email( $post_data['post_author'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected function notify_requester_payment_made( $post ) {
+ $post = get_post( $post );
+
+ if ( ! $to = WordCamp_Budgets::get_requester_formatted_email( $post->post_author ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</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">- $subject = sprintf( '`%s` has been paid', $post_data['post_title'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $subject = sprintf( '"%s" has been paid', $post->post_title );
</ins><span class="cx" style="display: block; padding: 0 10px"> $headers = array( 'Reply-To: support@wordcamp.org' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $message = sprintf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "The request for `%s` has been marked as paid by WordCamp Central.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "The request for \"%s\" has been marked as paid by WordCamp Central.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> You can view the request at:
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> %s
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> If you have any questions, please reply to let us know.",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_data['post_title'],
- admin_url( sprintf( 'post.php?post=%s&action=edit', $request_id ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post->post_title,
+ admin_url( sprintf( 'post.php?post=%s&action=edit', $post->ID ) )
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $message = str_replace( "\t", '', $message );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -596,20 +660,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Notify the payment requester that it has been marked as paid.
</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 int $request_id
- * @param array $post_data
- * @param array $post_data_raw
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int|WP_Post $post
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected function notify_requester_request_incomplete( $request_id, $post_data, $post_data_raw ) {
- if ( ! $to = WordCamp_Budgets::get_requester_formatted_email( $post_data['post_author'] ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected function notify_requester_request_incomplete( $post ) {
+ $post = get_post( $post );
+
+ if ( ! $to = WordCamp_Budgets::get_requester_formatted_email( $post->post_author ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</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">- $subject = sprintf( '`%s` is incomplete', $post_data['post_title'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $subject = sprintf( '"%s" is incomplete', $post->post_title );
</ins><span class="cx" style="display: block; padding: 0 10px"> $headers = array( 'Reply-To: support@wordcamp.org' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $notes = get_post_meta( $post->ID, '_wcp_incomplete_notes', true );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $message = sprintf(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "The request for `%s` has been marked as incomplete by WordCamp Central.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "The request for \"%s\" has been marked as incomplete by WordCamp Central.
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> The reason for this is: %s
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -618,9 +683,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> %s
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> If you have any questions, please reply to let us know.",
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $post_data['post_title'],
- sanitize_text_field( stripslashes( $post_data_raw['wcp_mark_incomplete_notes'] ) ),
- admin_url( sprintf( 'post.php?post=%s&action=edit', $request_id ) )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post->post_title,
+ esc_html( $notes ),
+ admin_url( sprintf( 'post.php?post=%s&action=edit', $post->ID ) )
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> $message = str_replace( "\t", '', $message );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -634,6 +699,57 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Post $post
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function save_payment( $post_id, $post ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ // Update the timestamp and logs either way.
+ if ( $post->post_type == self::POST_TYPE && $post_id ) {
+ update_post_meta( $post_id, '_wcb_updated_timestamp', time() );
+
+ $user = get_user_by( 'id', get_current_user_id() );
+
+ // Look at post status transitions.
+ foreach ( self::$transition_post_status as $data ) {
+ list( $new, $old, $transition_post ) = $data;
+
+ // Transitioning a different post.
+ if ( $transition_post->ID != $post->ID )
+ continue;
+
+ if ( $new == 'incomplete' || $new == 'wcb-incomplete' ) {
+ $incomplete_text = get_post_meta( $post->ID, '_wcp_incomplete_notes', true );
+ $incomplete_text = preg_replace( '#\.$#', '', $incomplete_text ); // trailing-undot-it.
+ WordCamp_Budgets::log( $post->ID, $user->ID, sprintf( 'Marked as incomplete: %s', $incomplete_text ), array(
+ 'action' => 'marked-incomplete',
+ 'reason' => 'maybe notes',
+ ) );
+
+ $this->notify_requester_request_incomplete( $post->ID );
+ WordCamp_Budgets::log( $post->ID, $user->ID, 'Incomplete notification e-mail sent.', array(
+ 'action' => 'incomplete-notification-sent',
+ ) );
+
+ } elseif ( $new == 'paid' || $new == 'wcb-paid' ) {
+ WordCamp_Budgets::log( $post->ID, $user->ID, 'Marked as paid', array(
+ 'action' => 'marked-paid',
+ ) );
+
+ $this->notify_requester_payment_made( $post->ID );
+ WordCamp_Budgets::log( $post->ID, $user->ID, 'Paid notification e-mail sent.', array(
+ 'action' => 'paid-notification-sent',
+ ) );
+
+ } elseif ( $old == 'auto-draft' ) {
+ WordCamp_Budgets::log( $post->ID, $user->ID, 'Request created', array(
+ 'action' => 'updated',
+ ) );
+ }
+ }
+
+ WordCamp_Budgets::log( $post->ID, $user->ID, 'Request updated', array(
+ 'action' => 'updated',
+ ) );
+ }
+
+ // The rest only if triggered by a user submitting a form.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! WordCamp_Budgets::post_edit_is_actionable( $post, self::POST_TYPE ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -650,7 +766,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Sanitize and save the field values
</span><span class="cx" style="display: block; padding: 0 10px"> $this->sanitize_save_normal_fields( $post_id );
</span><span class="cx" style="display: block; padding: 0 10px"> WordCamp_Budgets::validate_save_payment_method_fields( $post_id, 'camppayments' );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $this->sanitize_save_misc_fields( $post_id );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $this->sanitize_save_misc_fields( $post_id );
</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"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -715,12 +831,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param int $post_id
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> protected function sanitize_save_misc_fields( $post_id ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $post = get_post( $post_id );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Status
</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"> $safe_value = strtotime( sanitize_text_field( $_POST['date_vendor_paid'] ) );
</span><span class="cx" style="display: block; padding: 0 10px"> update_post_meta( $post_id, '_camppayments_date_vendor_paid', $safe_value );
</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">+ if ( isset( $_POST['wcp_mark_incomplete_notes'] ) ) {
+ $safe_value = '';
+ if ( $post->post_status == 'wcb-incomplete' ) {
+ $safe_value = wp_kses( $_POST['wcp_mark_incomplete_notes'], wp_kses_allowed_html( 'strip' ) );
+ }
+
+ update_post_meta( $post_id, '_wcp_incomplete_notes', $safe_value );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Attach existing files
</span><span class="cx" style="display: block; padding: 0 10px"> remove_action( 'save_post', array( $this, 'save_payment' ), 10 ); // avoid infinite recursion
</span><span class="cx" style="display: block; padding: 0 10px"> WordCamp_Budgets::attach_existing_files( $post_id, $_POST );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -738,30 +865,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $post->post_type != self::POST_TYPE )
</span><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $user = get_user_by( 'id', get_current_user_id() );
- if ( $new == 'auto-draft' )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $new == 'auto-draft' || $new == $old )
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $new == 'incomplete' && $old != 'incomplete' ) {
- $incomplete_text = get_post_meta( $post->ID, '_wcp_incomplete_notes', true );
- $incomplete_text = preg_replace( '#\.$#', '', $incomplete_text ); // trailing-undot-it.
- WordCamp_Budgets::log( $post->ID, $user->ID, sprintf( 'Marked as incomplete: %s', $incomplete_text ), array(
- 'action' => 'marked-incomplete',
- 'reason' => 'maybe notes',
- ) );
- } elseif ( $new == 'paid' && $old != 'paid' ) {
- WordCamp_Budgets::log( $post->ID, $user->ID, 'Marked as paid', array(
- 'action' => 'marked-paid',
- ) );
- } elseif ( $old == 'auto-draft' && $new != 'auto-draft' ) {
- WordCamp_Budgets::log( $post->ID, $user->ID, 'Request created', array(
- 'action' => 'updated',
- ) );
- } else {
- WordCamp_Budgets::log( $post->ID, $user->ID, 'Request updated', array(
- 'action' => 'updated',
- ) );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Move logging to save_post because transitions are fired before save_post.
+ self::$transition_post_status[] = array( $new, $old, $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"> /**
</span></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptpaymentrequestsjs"></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/javascript/payment-requests.js</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/javascript/payment-requests.js 2016-02-26 00:56:15 UTC (rev 2632)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/payment-requests.js 2016-02-26 00:57:40 UTC (rev 2633)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,7 +3,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> var wcb = window.WordCampBudgets;
</span><span class="cx" style="display: block; padding: 0 10px"> var app = wcb.PaymentRequests = {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
</ins><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Main entry point
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -31,7 +31,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> currency.change( wcb.setDefaultPaymentMethod );
</span><span class="cx" style="display: block; padding: 0 10px"> currency.trigger( 'change' ); // Set the initial state
</span><span class="cx" style="display: block; padding: 0 10px"> $( '#row-files' ).find( 'a.wcb-insert-media' ).click( wcb.showUploadModal );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $( '#wcp_mark_incomplete_checkbox' ).click( app.requireNotes );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ $('[name="post_status"]').on('change', function() {
+ var $notes = $('.wcb-mark-incomplete-notes'),
+ state = $(this).val() == 'wcb-incomplete';
+
+ $notes.toggle(state);
+ $notes.find('textarea').attr('required', state);
+ }).trigger('change');
</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"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -53,25 +60,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> } catch ( exception ) {
</span><span class="cx" style="display: block; padding: 0 10px"> wcb.log( exception );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- },
-
- /**
- * Require notes when the request is being marked as incomplete
- *
- * @param {object} event
- */
- requireNotes : function( event ) {
- try {
- var notes = $( '#wcp_mark_incomplete_notes' );
-
- if ( 'checked' === $( '#wcp_mark_incomplete_checkbox' ).attr( 'checked' ) ) {
- notes.attr( 'required', true );
- } else {
- notes.attr( 'required', false );
- }
- } catch ( exception ) {
- wcb.log( exception );
- }
</del><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></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewspaymentrequestmetaboxmarkincompletephp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-mark-incomplete.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-mark-incomplete.php 2016-02-26 00:56:15 UTC (rev 2632)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-mark-incomplete.php 2016-02-26 00:57:40 UTC (rev 2633)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,17 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<div id="wcp_mark_incomplete">
- <p>
- <?php _e( 'Marking a request as incomplete will notify the requester that they need to come back and give
- you more information before you can process the payment.', 'wordcamporg' ); ?>
- </p>
-
- <p>
- <input type="checkbox" id="wcp_mark_incomplete_checkbox" name="wcp_mark_incomplete_checkbox" />
- <label for="wcp_mark_incomplete_checkbox">Mark as Incomplete</label>
- </p>
-
- <p>
- <label for="wcp_mark_incomplete_notes">What information is needed?</label>
- <textarea id="wcp_mark_incomplete_notes" name="wcp_mark_incomplete_notes" class="large-text"
- placeholder="Need to attach receipt, etc"></textarea>
- </p>
-</div> <!-- #wco_mark_incomplete -->
</del></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 2016-02-26 00:56:15 UTC (rev 2632)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/payment-request/metabox-status.php 2016-02-26 00:57:40 UTC (rev 2633)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,7 +1,17 @@
</span><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><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ <?php if ( $current_user_can_edit_request && ! current_user_can( 'manage_network' ) ) : ?>
+ <div id="minor-publishing-actions">
+ <div id="save-action">
+ <?php submit_button( __( 'Save Draft', 'wordcamporg' ), 'button', 'wcb-save-draft', false ); ?>
+ <span class="spinner"></span>
+ </div>
+ <div class="clear"></div>
+ </div>
+ <?php endif; ?>
+
</ins><span class="cx" style="display: block; padding: 0 10px"> <div id="misc-publishing-actions">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
</del><span class="cx" style="display: block; padding: 0 10px"> <div class="misc-pub-section">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php _e( 'ID:', 'wordcamporg' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <span>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -16,24 +26,45 @@
</span><span class="cx" style="display: block; padding: 0 10px"> </span>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</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 if ( $post->post_status != 'auto-draft' ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <div class="misc-pub-section">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php $this->render_text_input( $post, 'Date Vendor was Paid', 'date_vendor_paid', '', 'date', array(), $date_vendor_paid_readonly ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="misc-pub-section misc-pub-post-status">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <label for="post_status"><?php _e( 'Status:' ) ?></label>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <label>
+ <?php _e( 'Status:' ) ?>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <span id="post-status-display">
- <?php if ( 'incomplete' == $post->post_status ) : ?>
- <?php _e( 'Incomplete', 'wordcamporg' ); ?>
- <?php elseif ( 'paid' == $post->post_status ) : ?>
- <?php _e( 'Paid' ); ?>
- <?php else : ?>
- <?php _e( 'Not Paid' ); ?>
- <?php endif; ?>
- </span>
- </div> <!-- .misc-pub-section -->
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <span id="post-status-display">
+ <?php if ( current_user_can( 'manage_network' ) ) : ?>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <select name="post_status">
+ <?php foreach ( self::get_post_statuses() as $status ) : ?>
+ <?php $status = get_post_status_object( $status ); ?>
+ <option value="<?php echo esc_attr( $status->name ); ?>" <?php selected( $post->post_status, $status->name ); ?> >
+ <?php echo esc_html( $status->label ); ?>
+ </option>
+ <?php endforeach; ?>
+ </select>
+
+ <?php else : ?>
+
+ <?php $status = get_post_status_object( $post->post_status ); ?>
+ <?php echo esc_html( $status->label ); ?>
+ <input type="hidden" name="post_status" value="<?php echo esc_attr( $post->post_status ); ?>" />
+
+ <?php endif; ?>
+ </span>
+ </label>
+ </div>
+ <?php endif; ?>
+
+ <div class="misc-pub-section hide-if-js wcb-mark-incomplete-notes">
+ <label for="wcp_mark_incomplete_notes">What information is needed?</label>
+ <textarea id="wcp_mark_incomplete_notes" name="wcp_mark_incomplete_notes" class="large-text" rows="5"
+ placeholder="Need to attach receipt, etc" <?php echo $incomplete_readonly; ?>><?php echo esc_textarea( $incomplete_notes ); ?></textarea>
+ </div>
+
</ins><span class="cx" style="display: block; padding: 0 10px"> <div class="clear"></div>
</span><span class="cx" style="display: block; padding: 0 10px"> </div> <!-- #misc-publishing-actions -->
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -47,21 +78,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="delete-action">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php if ( current_user_can( 'delete_post', $post->ID ) ) : ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php echo $delete_text; ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php _e( 'Delete', 'wordcamporg' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> </a>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <div id="publishing-action">
</span><span class="cx" style="display: block; padding: 0 10px"> <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr( $submit_text ) ?>" />
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <?php submit_button( $submit_text, 'primary button-large', 'save', false, array( 'accesskey' => 'p' ) ); ?>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php submit_button( $submit_text, 'primary button-large', 'wcb-update', false, array( 'accesskey' => 'p' ) ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> </div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="clear"></div>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php else : ?>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <p><?php _e( 'Paid requests are closed and cannot be edited.', 'wordcamporg' ); ?></p>
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php _e( 'This request can not be edited.', 'wordcamporg' ); ?>
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php endif; ?>
</span><span class="cx" style="display: block; padding: 0 10px"> </div> <!-- #major-publishing-actions -->
</span></span></pre>
</div>
</div>
</body>
</html>