<!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>[2301] sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments: WordCamp Budgets: Add new post type for Sponsor Invoices.</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/2301">2301</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/2301","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>iandunn</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2016-01-16 00:21:14 +0000 (Sat, 16 Jan 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 Budgets: Add new post type for Sponsor Invoices.

Fixes <a href="http://meta.trac.wordpress.org/ticket/790">#790</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsbootstrapphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/bootstrap.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentscsswordcampbudgetscss">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludessponsorinvoicephp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-invoice.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptsponsorinvoicesjs">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/sponsor-invoices.js</a></li>
<li>sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-invoice/</li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewssponsorinvoicemetaboxgeneralphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-invoice/metabox-general.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewssponsorinvoicemetaboxstatusphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-invoice/metabox-status.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewssponsorinvoicetemplaterequiredfieldsincompletephp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-invoice/template-required-fields-incomplete.php</a></li>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewssponsorinvoicetemplatesponsorinformationphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-invoice/template-sponsor-information.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsbootstrapphp"></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/bootstrap.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/bootstrap.php   2016-01-15 23:52:33 UTC (rev 2300)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/bootstrap.php     2016-01-16 00:21:14 UTC (rev 2301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -15,6 +15,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_admin() ) {
</span><span class="cx" style="display: block; padding: 0 10px">        require_once( __DIR__ . '/includes/wordcamp-budgets.php' );
</span><span class="cx" style="display: block; padding: 0 10px">        require_once( __DIR__ . '/includes/payment-request.php' );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+        require_once( __DIR__ . '/includes/sponsor-invoice.php' );
</ins><span class="cx" style="display: block; padding: 0 10px">         require_once( __DIR__ . '/includes/encryption.php' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        $GLOBALS['wordcamp_budgets']    = new WordCamp_Budgets();
</span></span></pre></div>
<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-01-15 23:52:33 UTC (rev 2300)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/css/wordcamp-budgets.css  2016-01-16 00:21:14 UTC (rev 2301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,11 +1,43 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px">  * Common
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-.menu-icon-wcp_payment_request .wp-menu-image img {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.menu-icon-wcp_payment_request .wp-menu-image img,
+.menu-icon-wcb_sponsor_invoice .wp-menu-image img {
</ins><span class="cx" style="display: block; padding: 0 10px">         margin-left: 9px;
</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">+/* Forms */
+.wcb-form {
+       display: table;
+}
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+.wcb-form li {
+       display: table-row;
+}
+
+.wcb-form li label {
+       display: table-cell;
+       margin-bottom: 1em;
+       vertical-align: top;
+       font-weight: bold;
+}
+
+.wcb-form li > input,
+.wcb-form li > select,
+.wcb-form li > textarea,
+.wcb-form-input-wrapper {
+       display: table-cell;
+       margin-left: 1em;
+       margin-bottom: 1em;
+}
+
+/* margins from above selector aren't applied */
+.wcb-form-input-wrapper {
+       padding-left: 1em;
+       padding-bottom: 1em;
+}
+
+
</ins><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px">  * Payment Requests
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,8 +52,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">        margin-right: 20px;
</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">-
-/* Files  */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* Files */
</ins><span class="cx" style="display: block; padding: 0 10px"> #wcp_files .description {
</span><span class="cx" style="display: block; padding: 0 10px">        margin-bottom: 1em;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -53,3 +84,36 @@
</span><span class="cx" style="display: block; padding: 0 10px"> #wcp_log td.timestamp {
</span><span class="cx" style="display: block; padding: 0 10px">        width: 130px;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+
+/*
+ * Sponsor Invoices
+ */
+
+#wcbsi-billing-information {
+       overflow: auto;
+}
+
+#wcbsi-billing-contact {
+       padding-right: 1em;
+}
+
+#wcbsi-billing-contact,
+#wcbsi-billing-address {
+       float: left;
+       width: 50%;
+       box-sizing: border-box;
+}
+
+#submitpost.wcbsi #minor-publishing-actions {
+       text-align: left;
+}
+
+/* todo this also exists in Dashboard CSS, so maybe centralize */
+.wcbsi-inline-notice {
+       margin-bottom: 5px;
+       box-shadow:    none;
+       border-top:    1px solid rgba( 0, 0, 0, 0.1 );
+       border-right:  1px solid rgba( 0, 0, 0, 0.1 );
+       border-bottom: 1px solid rgba( 0, 0, 0, 0.1 );
+}
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsincludessponsorinvoicephp"></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/includes/sponsor-invoice.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/sponsor-invoice.php                            (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-invoice.php      2016-01-16 00:21:14 UTC (rev 2301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,475 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+/*
+ * Create Sponsor Invoice Post type
+ */
+
+namespace WordCamp\Budgets\Sponsor_Invoices;
+
+defined( 'WPINC' ) or die();
+
+const POST_TYPE = 'wcb_sponsor_invoice';
+
+// Initialization
+add_action( 'init',                  __NAMESPACE__ . '\register_post_type'        );
+add_action( 'init',                  __NAMESPACE__ . '\register_post_statuses'    );
+add_action( 'add_meta_boxes',        __NAMESPACE__ . '\init_meta_boxes'           );
+add_action( 'admin_enqueue_scripts', __NAMESPACE__ . '\enqueue_assets',        11 );
+
+// Admin UI
+add_filter( 'display_post_states',                        __NAMESPACE__ . '\display_post_states'       );
+add_filter( 'manage_'. POST_TYPE .'_posts_columns',       __NAMESPACE__ . '\get_columns'               );
+add_action( 'manage_'. POST_TYPE .'_posts_custom_column', __NAMESPACE__ . '\render_columns',     10, 2 );
+
+// Saving posts
+add_filter( 'wp_insert_post_data', __NAMESPACE__ . '\set_invoice_status',  10, 2 );
+add_action( 'save_post',           __NAMESPACE__ . '\save_invoice',        10, 2 );
+add_filter( 'map_meta_cap',        __NAMESPACE__ . '\modify_capabilities', 10, 4 );
+
+/**
+ * Register the custom post type
+ *
+ * @return object | \WP_Error
+ */
+function register_post_type() {
+       $labels = array(
+               'name'               => _x( 'Sponsor Invoices', 'general sponsor invoices', 'wordcamporg' ),
+               'singular_name'      => _x( 'Sponsor Invoice',  'post type singular name',  'wordcamporg' ),
+               'menu_name'          => _x( 'Sponsor Invoices', 'admin menu',               'wordcamporg' ),
+               'name_admin_bar'     => _x( 'Sponsor Invoices', 'add new on admin bar',     'wordcamporg' ),
+               'add_new'            => _x( 'Add New',          'invoice',                  'wordcamporg' ),
+
+               'add_new_item'       => __( 'Add New Sponsor Invoice',    'wordcamporg' ),
+               'new_item'           => __( 'New Invoice',                'wordcamporg' ),
+               'edit_item'          => __( 'Edit Invoice',               'wordcamporg' ),
+               'view_item'          => __( 'View Invoice',               'wordcamporg' ),
+               'all_items'          => __( 'Invoices',                   'wordcamporg' ),
+               'search_items'       => __( 'Search Invoices',            'wordcamporg' ),
+               'not_found'          => __( 'No invoice found.',          'wordcamporg' ),
+               'not_found_in_trash' => __( 'No invoice found in Trash.', 'wordcamporg' ),
+       );
+
+       $args = array(
+               'labels'            => $labels,
+               'description'       => 'WordCamp Sponsor Invoices',
+               'public'            => false,
+               'show_ui'           => true,
+               'show_in_nav_menus' => true,
+               'menu_icon'         => plugins_url( 'images/dollar-sign-icon.svg', dirname( __FILE__ ) ),
+               'supports'          => array( 'title' ),
+               'has_archive'       => true,
+       );
+       
+       return \register_post_type( POST_TYPE, $args );
+}
+
+/**
+ * Get the slugs and names for our custom post statuses
+ *
+ * @return array
+ */
+function get_custom_statuses() {
+       return array(
+               'wcbsi_submitted' => __( 'Submitted', 'wordcamporg' ),
+               'wcbsi_approved'  => __( 'Approved',  'wordcamporg' ),
+               'wcbsi_paid'      => __( 'Paid',      'wordcamporg' ),
+       );
+}
+
+/**
+ * Register our custom post statuses
+ */
+function register_post_statuses() {
+       // todo use get_custom_statuses() for DRYness, but need to handle label_count
+
+       register_post_status(
+               'wcbsi_submitted',
+               array(
+                       'label'              => _x( 'Submitted', 'post', 'wordcamporg' ),
+                       'label_count'        => _nx_noop( 'Submitted <span class="count">(%s)</span>', 'Submitted <span class="count">(%s)</span>', 'wordcamporg' ),
+                       'public'             => true,
+                       'publicly_queryable' => false,
+               )
+       );
+
+       register_post_status(
+               'wcbsi_approved',
+               array(
+                       'label'              => _x( 'Approved', 'post', 'wordcamporg' ),
+                       'label_count'        => _nx_noop( 'Approved <span class="count">(%s)</span>', 'Approved <span class="count">(%s)</span>', 'wordcamporg' ),
+                       'public'             => true,
+                       'publicly_queryable' => false,
+               )
+       );
+
+       register_post_status(
+               'wcbsi_paid',
+               array(
+                       'label'              => _x( 'Paid', 'post', 'wordcamporg' ),
+                       'label_count'        => _nx_noop( 'Paid <span class="count">(%s)</span>', 'Paid <span class="count">(%s)</span>', 'wordcamporg' ),
+                       'public'             => true,
+                       'publicly_queryable' => false,
+               )
+       );
+}
+
+/**
+ * Register meta boxes
+ */
+function init_meta_boxes() {
+       // Replace Core's status box with a custom one
+       remove_meta_box( 'submitdiv', POST_TYPE, 'side' );
+
+       add_meta_box(
+               'submitdiv',
+               __( 'Status', 'wordcamporg' ),
+               __NAMESPACE__ . '\render_status_metabox',
+               POST_TYPE,
+               'side',
+               'high'
+       );
+
+       add_meta_box(
+               'wcbsi_sponsor_invoice',
+               __( 'Sponsor Invoice', 'wordcamporg' ),
+               __NAMESPACE__ . '\render_sponsor_invoice_metabox',
+               POST_TYPE,
+               'normal',
+               'high'
+       );
+}
+
+/**
+ * Enqueue scripts and stylesheets
+ */
+function enqueue_assets() {
+       wp_register_script(
+               'sponsor-invoices',
+               plugins_url( 'javascript/sponsor-invoices.js', __DIR__ ),
+               array( 'jquery', 'jquery-ui-datepicker', 'underscore', 'wp-util' ),
+               \WordCamp_Budgets::VERSION,
+               true
+       );
+
+       $current_screen = get_current_screen();
+
+       if ( POST_TYPE !== $current_screen->id ) {
+               return;
+       }
+
+       wp_enqueue_script( 'sponsor-invoices' );
+}
+
+/**
+ * Prepare sponsor data for displaying in the UI
+ *
+ * @param int $sponsor_id If passed, will return only data for that sponsor. Otherwise returns all sponsors.
+ *
+ * @return array
+ */
+function prepare_sponsor_data( $sponsor_id = null ) {
+       $data = array();
+
+       $field_names = array(
+               'company_name', 'first_name', 'last_name', 'email_address', 'phone_number', 'tax_resale_number',
+               'street_address1', 'street_address2', 'city', 'state', 'zip_code', 'country'
+       );
+
+       // These use dashes instead of underscores because the loop below converts to dashes
+       $required_fields = array(
+               'company-name', 'first-name', 'last-name', 'email-address', 'phone-number', 'tax-resale-number',
+               'street-address1', 'city', 'state', 'zip-code', 'country'
+       );
+
+       if ( $sponsor_id ) {
+               $sponsors = array( get_post( $sponsor_id ) );
+       } else {
+               $sponsors = get_posts( array(
+                       'post_type'      => 'wcb_sponsor',
+                       'posts_per_page' => 100,
+               ) );
+       }
+
+       foreach ( $sponsors as $sponsor ) {
+               $meta_values = get_post_custom( $sponsor->ID );
+
+               $data[ $sponsor->ID ] = array( 'name' => $sponsor->post_title );
+               $data[ $sponsor->ID ]['data_attributes']['edit-url'] = admin_url( sprintf( 'post.php?post=%s&action=edit', $sponsor->ID ) );
+
+               foreach ( $field_names as $name ) {
+                       $meta_key = "_wcpt_sponsor_$name";
+                       $data_key = str_replace( '_', '-', $name ); // for consistency with JavaScript conventions
+                       $value    = '';
+
+                       if ( isset( $meta_values[ $meta_key ][0] ) ) {
+                                $value = $meta_values[ $meta_key ][0];
+                       }
+
+                       $data[ $sponsor->ID ]['data_attributes'][ $data_key ] = $value;
+               }
+
+               $complete = required_fields_complete( $data[ $sponsor->ID ]['data_attributes'], $required_fields );
+               $data[ $sponsor->ID ]['data_attributes']['required-fields-complete'] = $complete ? 'true' : 'false';
+       }
+
+       return $data;
+}
+
+/**
+ * Check if all of the required fields have values
+ *
+ * @param $submitted_values
+ * @param $required_fields
+ *
+ * @return bool
+ */
+function required_fields_complete( $submitted_values, $required_fields ) {
+       $complete = true;
+
+       foreach ( $submitted_values as $key => $value ) {
+               if ( in_array( $key, $required_fields, true ) ) {
+                       if ( empty( $value ) || 'null' === substr( $value, 0, 4 ) ) {
+                               $complete = false;
+                               break;
+                       }
+               }
+       }
+
+       return $complete;
+}
+
+/**
+ * Render the Status metabox
+ *
+ * @param \WP_Post $post
+ */
+function render_status_metabox( $post ) {
+       wp_nonce_field( 'status', 'status_nonce' );
+
+       $delete_text = EMPTY_TRASH_DAYS ? __( 'Move to Trash' ) : __( 'Delete Permanently' );
+
+       /*
+        * We can't use current_user_can( 'edit_post', N ) in this case, because the restriction only applies when
+        * submitting the edit form, not when viewing the post. So, instead, we simulate get the same result in a
+        * different way.
+        */
+       $current_user_can_edit_request = in_array( $post->post_status, array( 'auto-draft', 'draft' ), true ) || current_user_can( 'manage_network' );
+
+       require_once( dirname( __DIR__ ) . '/views/sponsor-invoice/metabox-status.php' );
+}
+
+/**
+ * Render Sponsor Invoice Metabox
+ *
+ * @param \WP_Post $post
+ *
+ */
+function render_sponsor_invoice_metabox( $post ) {
+       wp_nonce_field( 'sponsor_invoice', 'sponsor_invoice_nonce' );
+
+       $available_sponsors   = prepare_sponsor_data();
+       $available_currencies = \WordCamp_Budgets::get_currencies();
+       $selected_sponsor_id  = get_post_meta( $post->ID, '_wcbsi_sponsor_id',      true );
+       $selected_currency    = get_post_meta( $post->ID, '_wcbsi_currency',        true );
+       $due_date             = get_post_meta( $post->ID, '_wcbsi_due_date',        true );
+       $description          = get_post_meta( $post->ID, '_wcbsi_description',     true );
+       $amount               = get_post_meta( $post->ID, '_wcbsi_amount',          true );
+       $invoice_message      = get_post_meta( $post->ID, '_wcbsi_invoice_message', true );
+
+       if ( $due_date ) {
+               $due_date = date( 'Y-m-d', $due_date );
+       }
+
+       require_once( dirname( __DIR__ ) . '/views/sponsor-invoice/metabox-general.php' );
+}
+
+/**
+ * Display the status of a post after its title on the Payment Requests page
+ *
+ * @param array $states
+ *
+ * @return array
+ */
+function display_post_states( $states ) {
+       global $post;
+
+       $custom_states = get_custom_statuses();
+
+       foreach ( $custom_states as $slug => $name ) {
+               if ( $slug == $post->post_status && $slug != get_query_var( 'post_status' ) ) {
+                       $states[ $slug ] = $name;
+               }
+       }
+
+       return $states;
+}
+
+/**
+ * Set the status when invoices are submitted.
+ *
+ * @param array $post_data
+ * @param array $post_data_raw
+ *
+ * @return array
+ */
+function set_invoice_status( $post_data, $post_data_raw ) {
+       if ( ! \WordCamp_Budgets::post_edit_is_actionable( $post_data, POST_TYPE ) ) {
+               return $post_data;
+       }
+
+       $sponsor                 = prepare_sponsor_data( $post_data_raw['_wcbsi_sponsor_id'] );
+       $sponsor                 = array_pop( $sponsor );
+       $sponsor_fields_complete = 'true' === $sponsor['data_attributes']['required-fields-complete'];
+
+       $required_invoice_fields = array(
+               '_wcbsi_sponsor_id', '_wcbsi_due_date', '_wcbsi_description', '_wcbsi_currency', '_wcbsi_amount',
+               '_wcbsi_invoice_message'
+       );
+       $invoice_fields_complete = required_fields_complete( $post_data_raw, $required_invoice_fields );
+
+       if ( ! $sponsor_fields_complete || ! $invoice_fields_complete ) {
+               // Set to draft if any required info isn't available
+               $post_data['post_status'] = 'draft';
+
+               // todo this should run after save, b/c sanitization/validation could empty out some fields
+
+       } else if ( in_array( $post_data['post_status'], array( 'auto-draft', 'draft' ), true ) && isset( $_POST['send-invoice'] ) ) {
+               /*
+                * Only set to submitted if the previous status was a draft, because a network admin can make changes
+                * after it's been submitted, and we don't want to revert the post status in those cases.
+                */
+
+               $post_data['post_status'] = 'wcbsi_submitted';
+       }
+
+       return $post_data;
+}
+
+/**
+ * Save the post's data
+ *
+ * @param int      $post_id
+ * @param \WP_Post $post
+ */
+function save_invoice( $post_id, $post ) {
+       if ( ! \WordCamp_Budgets::post_edit_is_actionable( $post, POST_TYPE ) ) {
+               return;
+       }
+
+       // Verify nonces
+       $nonces = array( 'status_nonce', 'sponsor_invoice_nonce' );
+
+       foreach ( $nonces as $nonce ) {
+               check_admin_referer( str_replace( '_nonce', '', $nonce ), $nonce );
+       }
+
+       // Sanitize and save the field values
+       $fields = array( 'sponsor_id', 'currency', 'due_date', 'description', 'amount', 'invoice_message' );
+
+       foreach( $fields as $field ) {
+               $meta_key = "_wcbsi_$field";
+               $value = sanitize_text_field( wp_unslash( $_POST[ $meta_key ] ) );
+
+               if ( 'due_date' == $field ) {
+                       $value = strtotime( $value );
+               }
+
+               if ( 'amount' == $field ) {
+                       $value = preg_replace( '#[^\d.-]+#', '', $value );
+                       $value = round( floatval( $value ), 2 );
+               }
+
+               if ( empty( $value ) ) {
+                       delete_post_meta( $post_id, $meta_key );
+               } else {
+                       update_post_meta( $post_id, $meta_key, $value );
+               }
+       }
+}
+
+/**
+ * Define columns for the Payment Requests screen.
+ *
+ * @param array $_columns
+ * @return array
+ */
+function get_columns( $_columns ) {
+       $columns = array(
+               'cb'             => $_columns['cb'],
+               'author'         => __( 'Author' ),
+               'title'          => $_columns['title'],
+               'date'           => $_columns['date'],
+               'due_date'       => __( 'Due Date', 'wordcamporg' ),
+               'sponsor_name'   => __( 'Sponsor',  'wordcamporg' ),
+               'payment_amount' => __( 'Amount',   'wordcamporg' ),
+       );
+
+       return $columns;
+}
+
+/**
+ * Render custom columns on the Payment Requests screen.
+ *
+ * @param string $column
+ * @param int $post_id
+ */
+function render_columns( $column, $post_id ) {
+       switch ( $column ) {
+               case 'due_date':
+                       if ( $date = get_post_meta( $post_id, '_wcbsi_due_date', true ) ) {
+                               echo date( 'Y-m-d', $date );
+                       }
+                       break;
+
+               case 'sponsor_name':
+                       // todo could reuse get_sponsor_name() from dashboard if made some minor modifications
+
+                       $sponsor = get_post( get_post_meta( $post_id, '_wcbsi_sponsor_id', true ) );
+                       echo esc_html( $sponsor->post_title );
+                       break;
+
+               case 'payment_amount':
+                       $currency = get_post_meta( $post_id, '_wcbsi_currency', true );
+                       if ( false === strpos( $currency, 'null' ) ) {
+                               echo esc_html( $currency ) . ' ';
+                       }
+
+                       echo esc_html( get_post_meta( $post_id, '_wcbsi_amount', true ) );
+                       break;
+       }
+}
+
+/**
+ * Modify the default capabilities
+ *
+ * @param array  $required_capabilities The primitive capabilities that are required to perform the requested meta capability
+ * @param string $requested_capability  The requested meta capability
+ * @param int    $user_id               The user ID.
+ * @param array  $args                  Adds the context to the cap. Typically the object ID.
+ */
+function modify_capabilities( $required_capabilities, $requested_capability, $user_id, $args ) {
+       // todo maybe centralize this, since almost identical to counterpart in payment-requests.php
+
+       global $post;
+
+       if ( is_a( $post, 'WP_Post' ) && POST_TYPE == $post->post_type ) {
+               /*
+                * Only network admins can edit/delete requests once they've been submitted.
+                *
+                * The organizer can still open the request (in order to view the status and details), but won't be allowed to make any changes to it.
+                */
+               if ( ! in_array( $post->post_status, array( 'auto-draft', 'draft' ), true ) ) {
+                       if ( 'edit_post' == $requested_capability ) {
+                               if ( isset( $_REQUEST['action'] ) && 'edit' != $_REQUEST['action'] ) {
+                                       $required_capabilities[] = 'manage_network';
+                               }
+                       }
+
+                       if ( 'delete_post' == $requested_capability ) {
+                               $required_capabilities[] = 'manage_network';
+                       }
+               }
+       }
+
+       return $required_capabilities;
+}
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsjavascriptsponsorinvoicesjs"></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/javascript/sponsor-invoices.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/sponsor-invoices.js                          (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/sponsor-invoices.js    2016-01-16 00:21:14 UTC (rev 2301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,98 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+jQuery( document ).ready( function( $ ) {
+       'use strict';
+
+       $.sponsorInvoices = {
+
+               /**
+                * Main entry point
+                */
+               init: function() {
+                       try {
+                               $.sponsorInvoices.registerEventHandlers();
+                               $( '#_wcbsi_sponsor_id' ).trigger( 'change' );  // Populate the initial sponsor information
+                               $.sponsorInvoices.setupDatePicker();
+                       } catch ( exception ) {
+                               $.sponsorInvoices.log( exception );
+                       }
+               },
+
+               /**
+                * Registers event handlers
+                */
+               registerEventHandlers : function() {
+                       $( '#_wcbsi_sponsor_id' ).change( $.sponsorInvoices.populateSponsorInformation );
+
+                       // todo detect when invoice fields incomplete, disable submit button (but not draft), and show notice
+               },
+
+               /**
+                * Toggle the payment method fields based on which method is selected
+                *
+                * @param {object} event
+                */
+               populateSponsorInformation : function( event ) {
+                       try {
+                               var info              = $( 'option:selected', this ).data(),
+                                   sendInvoiceButton = $( '#send-invoice' ),
+                                   infoContainer     = $( '#wcbsi-sponsor-information' ),
+                                   infoTemplate;
+
+                               if ( $.isEmptyObject( info ) ) {
+                                       infoContainer.html( '' );
+                                       return;
+                               }
+
+                               if ( info.requiredFieldsComplete ) {
+                                       infoTemplate = wp.template( 'wcbsi-sponsor-information' );
+                                       sendInvoiceButton.prop( 'disabled', false );
+                               } else {
+                                       infoTemplate = wp.template( 'wcbsi-required-fields-incomplete' );
+                                       sendInvoiceButton.prop( 'disabled', true );
+                               }
+
+                               infoContainer.html( infoTemplate( info ) );
+                       } catch ( exception ) {
+                               $.sponsorInvoices.log( exception );
+                       }
+               },
+
+               /**
+                * Fallback to the jQueryUI datepicker if the browser doesn't support <input type="date">
+                *
+                * todo this is mostly duplicate of same function in payment-requests.js. should make DRY
+                */
+               setupDatePicker : function() {
+                       var browserTest = document.createElement( 'input' );
+                       browserTest.setAttribute( 'type', 'date' );
+
+                       if ( 'text' === browserTest.type ) {
+                               $( '#wcbsi_sponsor_invoice' ).find( 'input[type=date]' ).not( '[readonly="readonly"]' ).datepicker( {
+                                       dateFormat : 'yy-mm-dd',
+                                       changeMonth: true,
+                                       changeYear : true
+                               } );
+                       }
+               },
+
+               /**
+                * Log a message to the console
+                *
+                * @todo centralize this for all modules to use
+                *
+                * @param {*} error
+                */
+               log : function( error ) {
+                       if ( ! window.console ) {
+                               return;
+                       }
+
+                       if ( 'string' === typeof error ) {
+                               console.log( 'WordCamp Sponsor Invoices: ' + error );
+                       } else {
+                               console.log( 'WordCamp Sponsor Invoices: ', error );
+                       }
+               }
+       };
+
+       $.sponsorInvoices.init();
+} );
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewssponsorinvoicemetaboxgeneralphp"></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/sponsor-invoice/metabox-general.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/sponsor-invoice/metabox-general.php                               (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-invoice/metabox-general.php 2016-01-16 00:21:14 UTC (rev 2301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,120 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace WordCamp\Budgets\Sponsor_Invoices;
+defined( 'WPINC' ) or die();
+
+?>
+
+<ul class="wcb-form">
+       <li>
+               <label for="_wcbsi_sponsor_id">
+                       <?php _e( 'Sponsor:', 'wordcamporg' ) ?>
+               </label>
+
+               <div class="wcb-form-input-wrapper">
+                       <select id="_wcbsi_sponsor_id" name="_wcbsi_sponsor_id">
+                               <option value="null-select-one">
+                                       <?php _e( '-- Select a Sponsor --', 'wordcamporg' ); ?>
+                               </option>
+
+                               <option value="null-separator1"></option>
+
+                               <?php foreach ( $available_sponsors as $sponsor_id => $sponsor ) : ?>
+                                       <option
+                                               value="<?php echo esc_attr( $sponsor_id ); ?>"
+                                               <?php selected( $sponsor_id, $selected_sponsor_id ); ?>
+
+                                               <?php foreach ( $sponsor['data_attributes'] as $attribute_key => $attribute_value ) : ?>
+                                                       data-<?php echo esc_attr( $attribute_key ); ?>="<?php echo esc_attr( $attribute_value ); ?>"
+                                               <?php endforeach; ?>
+                                       >
+                                               <?php echo esc_html( $sponsor['name'] ); ?>
+                                       </option>
+                               <?php endforeach; ?>
+                       </select>
+
+                       <div id="wcbsi-sponsor-information"></div> <?php // This will be populated dynamically ?>
+
+                       <?php require( __DIR__ . '/template-sponsor-information.php'        ); ?>
+                       <?php require( __DIR__ . '/template-required-fields-incomplete.php' ); ?>
+               </div>
+       </li>
+
+       <li>
+               <label for="_wcbsi_due_date">
+                       <?php _e( 'Due Date:', 'wordcamporg' ); ?>
+               </label>
+
+               <input
+                       type="date"
+                       class="regular-text"
+                       id="_wcbsi_due_date"
+                       name="_wcbsi_due_date"
+                       value="<?php echo esc_attr( $due_date ); ?>"
+               />
+       </li>
+
+       <li>
+               <label for="_wcbsi_description">
+                       <?php _e( 'Description:', 'wordcamporg' ); ?>
+               </label>
+
+               <input
+                       type="text"
+                       class="regular-text"
+                       id="_wcbsi_description"
+                       name="_wcbsi_description"
+                       value="<?php echo esc_attr( $description ); ?>"
+               />
+       </li>
+
+       <li>
+               <label for="_wcbsi_currency">
+                       <?php _e( 'Currency:', 'wordcamporg' ) ?>
+               </label>
+
+               <select id="_wcbsi_currency" name="_wcbsi_currency">
+                       <option value="null-select-one">
+                               <?php _e( '-- Select a Currency --', 'wordcamporg' ); ?>
+                       </option>
+                       <option value="null-separator1"></option>
+
+                       <?php foreach ( $available_currencies as $currency_key => $currency_name ) : ?>
+                               <option value="<?php echo esc_attr( $currency_key ); ?>" <?php selected( $currency_key, $selected_currency ); ?> >
+                                       <?php echo esc_html( $currency_name ); ?>
+                               </option>
+                       <?php endforeach; ?>
+               </select>
+       </li>
+
+       <li>
+               <label for="_wcbsi_amount">
+                       <?php _e( 'Amount:', 'wordcamporg' ); ?>
+               </label>
+
+               <div class="wcb-form-input-wrapper">
+                       <input
+                               type="text"
+                               class="regular-text"
+                               id="_wcbsi_amount"
+                               name="_wcbsi_amount"
+                               value="<?php echo esc_attr( $amount ); ?>"
+                       />
+
+                       <p class="description">
+                               <?php _e( 'No commas, thousands separators or currency symbols. Ex. 1234.56', 'wordcamporg' ); ?>
+                       </p>
+               </div>
+       </li>
+
+       <li>
+               <label for="_wcbsi_invoice_message">
+                       <?php _e( 'Message displayed on invoice:', 'wordcamporg' ); ?>
+               </label>
+
+               <textarea rows="2" cols="38" id="_wcbsi_invoice_message" name="_wcbsi_invoice_message" maxlength="75"><?php
+                       echo esc_html( $invoice_message );
+               ?></textarea>
+       </li>
+
+</ul>
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewssponsorinvoicemetaboxstatusphp"></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/sponsor-invoice/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/sponsor-invoice/metabox-status.php                                (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-invoice/metabox-status.php  2016-01-16 00:21:14 UTC (rev 2301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,75 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace WordCamp\Budgets\Sponsor_Invoices;
+defined( 'WPINC' ) or die();
+
+?>
+
+<div id="submitpost" class="wcbsi submitbox">
+       <div id="minor-publishing">
+               <?php if ( in_array( $post->post_status, array( 'auto-draft', 'draft' ), true ) ) : ?>
+                       <div id="minor-publishing-actions">
+                               <div id="save-action">
+                                       <?php submit_button( __( 'Save Draft' ), 'secondary', 'wcbsi-save-draft', false ); ?>
+                               </div>
+                       </div>
+               <?php endif; ?>
+
+               <div id="misc-publishing-actions">
+                       <div class="misc-pub-section misc-pub-post-status">
+                               <label for="post_status"><?php _e( 'Status:' ) ?></label>
+
+                               <span id="post-status-display">
+                                       <?php if ( in_array( $post->post_status, array( 'auto-draft', 'draft' ), true ) ) : ?>
+                                               <?php _e( 'Draft', 'wordcamporg' ); ?>
+                                       <?php elseif ( 'wcbsi_submitted' == $post->post_status ) : ?>
+                                               <?php _e( 'Submitted', 'wordcamporg' ); ?>
+                                       <?php elseif ( 'wcbsi_approved' == $post->post_status ) : ?>
+                                               <?php _e( 'Approved', 'wordcamporg' ); ?>
+                                       <?php elseif ( 'wcbsi_paid' == $post->post_status ) : ?>
+                                               <?php _e( 'Paid', 'wordcamporg' ); ?>
+                                       <?php endif; ?>
+                               </span>
+                       </div> <!-- .misc-pub-section -->
+
+                       <div class="clear"></div>
+               </div> <!-- #misc-publishing-actions -->
+
+               <div class="clear"></div>
+       </div> <!-- #minor-publishing -->
+
+
+       <div id="major-publishing-actions">
+               <?php if ( $current_user_can_edit_request ) : ?>
+
+                       <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 echo $delete_text; ?>
+                                       </a>
+                               <?php endif; ?>
+                       </div>
+
+                       <div id="publishing-action">
+                               <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr( __( 'Send Invoice', 'wordcamporg' ) ) ?>" />
+                               <?php submit_button(
+                                       __( 'Send Invoice', 'wordcamporg' ),
+                                       'primary button-large',
+                                       'send-invoice',
+                                       false,
+                                       array( 'accesskey' => 'p' )
+                               ); ?>
+                       </div>
+
+                       <div class="clear"></div>
+
+               <?php else : ?>
+
+                       <p>
+                               <?php _e( "Invoices can't be edited after they've been submitted.", 'wordcamporg' ); ?>
+                       </p>
+
+               <?php endif; ?>
+       </div> <!-- #major-publishing-actions -->
+
+</div> <!-- .submitbox -->
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewssponsorinvoicetemplaterequiredfieldsincompletephp"></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/sponsor-invoice/template-required-fields-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/sponsor-invoice/template-required-fields-incomplete.php                           (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-invoice/template-required-fields-incomplete.php     2016-01-16 00:21:14 UTC (rev 2301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,22 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace WordCamp\Budgets\Sponsor_Invoices;
+defined( 'WPINC' ) or die();
+
+?>
+
+<script type="text/html" id="tmpl-wcbsi-required-fields-incomplete">
+
+       <div class="wcbsi-inline-notice notice notice-warning">
+               <p>
+                       <?php echo sprintf(
+                               __(
+                                       'Warning: Sponsor contact information is not complete. Please save your invoice as a draft, then <a href="%s">fill out all sponsor contact information</a>, and then return here to send the invoice.',
+                                       'wordcamporg'
+                               ),
+                               '{{data.editUrl}}'
+                       ); ?>
+               </p>
+       </div>
+
+</script>
</ins></span></pre></div>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsviewssponsorinvoicetemplatesponsorinformationphp"></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/sponsor-invoice/template-sponsor-information.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/sponsor-invoice/template-sponsor-information.php                          (rev 0)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-invoice/template-sponsor-information.php    2016-01-16 00:21:14 UTC (rev 2301)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,48 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+<?php
+
+namespace WordCamp\Budgets\Sponsor_Invoices;
+defined( 'WPINC' ) or die();
+
+?>
+
+<script type="text/html" id="tmpl-wcbsi-sponsor-information">
+
+       <div id="wcbsi-billing-information">
+               <div id="wcbsi-billing-contact">
+                       <h4><?php _e( 'Billing Contact', 'wordcamporg' ); ?></h4>
+
+                       <p>
+                               {{data.firstName}} {{data.lastName}}<br />
+                               {{data.companyName}}<br />
+                               {{data.emailAddress}}<br />
+                               {{data.phoneNumber}}
+                       </p>
+
+                       <p>
+                               <?php _e( 'Tax Resale Number:', 'wordcamporg' ); ?> {{data.taxResaleNumber}}
+                       </p>
+               </div>
+
+               <div id="wcbsi-billing-address">
+                       <h4><?php _e( 'Address', 'wordcamporg' ); ?></h4>
+
+                       <address>
+                               {{data.streetAddress1}}<br />
+
+                               <# if ( data.streetAddress2 ) { #>
+                                       {{data.streetAddress2}}<br />
+                               <# } #>
+
+                               {{data.city}}, {{data.state}} {{data.zipCode}}<br />
+                               {{data.country}}
+                       </address>
+               </div>
+       </div>
+
+       <p>
+               <a href="{{data.editUrl}}" target="_blank">
+                       <?php _e( 'Edit sponsor contact information', 'wordcamporg' ); ?>
+               </a>
+       </p>
+
+</script>
</ins></span></pre>
</div>
</div>

</body>
</html>