<!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>[2713] sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/wordcamp-budgets-dashboard.php: WordCamp Budgets: Move wire exports to vendor/reimbursement files.</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/2713">2713</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/2713","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-03-08 17:21:37 +0000 (Tue, 08 Mar 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: Move wire exports to vendor/reimbursement files.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsnetworkincludeswordcampbudgetsdashboardphp">sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/wordcamp-budgets-dashboard.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgpublic_htmlwpcontentpluginswordcamppaymentsnetworkincludeswordcampbudgetsdashboardphp"></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-network/includes/wordcamp-budgets-dashboard.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-network/includes/wordcamp-budgets-dashboard.php 2016-03-08 17:06:18 UTC (rev 2712)
+++ sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network/includes/wordcamp-budgets-dashboard.php   2016-03-08 17:21:37 UTC (rev 2713)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -387,226 +387,16 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function _generate_payment_report_jpm_wires( $args ) {
</span><span class="cx" style="display: block; padding: 0 10px">        $args = wp_parse_args( $args, array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                'request_indexes' => array(),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         'data' => array(),
</ins><span class="cx" style="display: block; padding: 0 10px">                 'status' => '',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                'post_type' => '',
</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">-        ob_start();
-       $report = fopen( 'php://output', 'w' );
-
-       // JPM Header
-       fputcsv( $report, array( 'HEADER', gmdate( 'YmdHis' ), '1' ) );
-
-       $total = 0;
-       $count = 0;
-
-       foreach ( $args['request_indexes'] as $index ) {
-               switch_to_blog( $index->blog_id );
-               $post = get_post( $index->post_id );
-
-               if ( $args['status'] && $post->post_status != $args['status'] ) {
-                       restore_current_blog();
-                       continue;
-               }
-
-               // Only wires here.
-               if ( get_post_meta( $post->ID, '_camppayments_payment_method', true ) != 'Wire' ) {
-                       restore_current_blog();
-                       continue;
-               }
-
-               $amount = round( floatval( get_post_meta( $post->ID, '_camppayments_payment_amount', true ) ), 2);
-               $total += $amount;
-               $count += 1;
-
-               // If account starts with two letters, it's most likely an IBAN
-               $account = get_post_meta( $post->ID, '_camppayments_beneficiary_account_number', true );
-               $account = \WCP_Encryption::maybe_decrypt( $account );
-               $account = preg_replace( '#\s#','', $account );
-               $account_type = preg_match( '#^[a-z]{2}#i', $account ) ? 'IBAN' : 'ACCT';
-
-               $row = array(
-                       '1-input-type' => 'P',
-                       '2-payment-method' => 'WIRES',
-                       '3-debit-bank-id' => apply_filters( 'wcb_payment_req_bank_id', '' ), // external file
-                       '4-account-number' => apply_filters( 'wcb_payment_req_bank_number', '' ), // external file
-                       '5-bank-to-bank' => 'N',
-                       '6-txn-currency' => get_post_meta( $post->ID, '_camppayments_currency', true ),
-                       '7-txn-amount' => number_format( $amount, 2, '.', '' ),
-                       '8-equiv-amount' => '',
-                       '9-clearing' => '',
-                       '10-ben-residence' => '',
-                       '11-rate-type' => '',
-                       '12-blank' => '',
-                       '13-value-date' => '',
-
-                       '14-id-type' => $account_type,
-                       '15-id-value' => $account,
-                       '16-ben-name' => substr( \WCP_Encryption::maybe_decrypt(
-                               get_post_meta( $post->ID, '_camppayments_beneficiary_name', true ) ), 0, 35 ),
-                       '17-address-1' => substr( \WCP_Encryption::maybe_decrypt(
-                               get_post_meta( $post->ID, '_camppayments_beneficiary_street_address', true ) ), 0, 35 ),
-                       '18-address-2' => '',
-                       '19-city-state-zip' => substr( sprintf( '%s %s %s',
-                                       \WCP_Encryption::maybe_decrypt( get_post_meta( $post->ID, '_camppayments_beneficiary_city', true ) ),
-                                       \WCP_Encryption::maybe_decrypt( get_post_meta( $post->ID, '_camppayments_beneficiary_state', true ) ),
-                                       \WCP_Encryption::maybe_decrypt( get_post_meta( $post->ID, '_camppayments_beneficiary_zip_code', true ) )
-                               ), 0, 32 ),
-                       '20-blank' => '',
-                       '21-country' => \WCP_Encryption::maybe_decrypt(
-                               get_post_meta( $post->ID, '_camppayments_beneficiary_country_iso3166', true ) ),
-                       '22-blank' => '',
-                       '23-blank' => '',
-
-                       '24-id-type' => 'SWIFT',
-                       '25-id-value' => get_post_meta( $post->ID, '_camppayments_bank_bic', true ),
-                       '26-ben-bank-name' => substr( get_post_meta( $post->ID, '_camppayments_bank_name', true ), 0, 35 ),
-                       '27-ben-bank-address-1' => substr( get_post_meta( $post->ID, '_camppayments_bank_street_address', true ), 0, 35 ),
-                       '28-ben-bank-address-2' => '',
-                       '29-ben-bank-address-3' => substr( sprintf( '%s %s %s',
-                                       get_post_meta( $post->ID, '_camppayments_bank_city', true ),
-                                       get_post_meta( $post->ID, '_camppayments_bank_state', true ),
-                                       get_post_meta( $post->ID, '_camppayments_bank_zip_code', true )
-                                ), 0, 35 ),
-                       '30-ben-bank-country' => get_post_meta( $post->ID, '_camppayments_bank_country_iso3166', true ),
-                       '31-supl-id-type' => '',
-                       '32-supl-id-value' => '',
-
-                       '33-blank' => '',
-                       '34-blank' => '',
-                       '35-blank' => '',
-                       '36-blank' => '',
-                       '37-blank' => '',
-                       '38-blank' => '',
-                       '39-blank' => '',
-
-                       // Filled out later if not empty.
-                       '40-id-type' => '',
-                       '41-id-value' => '',
-                       '42-interm-bank-name' => '',
-                       '43-interm-bank-address-1' => '',
-                       '44-interm-bank-address-2' => '',
-                       '45-interm-bank-address-3' => '',
-                       '46-interm-bank-country' => '',
-                       '47-supl-id-type' => '',
-                       '48-supl-id-value' => '',
-
-                       '49-id-type' => '',
-                       '50-id-value' => '',
-                       '51-party-name' => '',
-                       '52-party-address-1' => '',
-                       '53-party-address-2' => '',
-                       '54-party-address-3' => '',
-                       '55-party-country' => '',
-
-                       '56-blank' => '',
-                       '57-blank' => '',
-                       '58-blank' => '',
-                       '59-blank' => '',
-                       '60-blank' => '',
-                       '61-blank' => '',
-                       '62-blank' => '',
-                       '63-blank' => '',
-                       '64-blank' => '',
-                       '65-blank' => '',
-                       '66-blank' => '',
-                       '67-blank' => '',
-                       '68-blank' => '',
-                       '69-blank' => '',
-                       '70-blank' => '',
-                       '71-blank' => '',
-                       '72-blank' => '',
-                       '73-blank' => '',
-
-                       '74-ref-text' => substr( get_post_meta( $post->ID, '_camppayments_invoice_number', true ), 0, 16 ),
-                       '75-internal-ref' => '',
-                       '76-on-behalf-of' => '',
-
-                       '77-detial-1' => '',
-                       '78-detial-2' => '',
-                       '79-detial-3' => '',
-                       '80-detail-4' => '',
-
-                       '81-blank' => '',
-                       '82-blank' => '',
-                       '83-blank' => '',
-                       '84-blank' => '',
-                       '85-blank' => '',
-                       '86-blank' => '',
-                       '87-blank' => '',
-                       '88-blank' => '',
-
-                       '89-reporting-code' => '',
-                       '90-country' => '',
-                       '91-inst-1' => '',
-                       '92-inst-2' => '',
-                       '93-inst-3' => '',
-                       '94-inst-code-1' => '',
-                       '95-inst-text-1' => '',
-                       '96-inst-code-2' => '',
-                       '97-inst-text-2' => '',
-                       '98-inst-code-3' => '',
-                       '99-inst-text-3' => '',
-
-                       '100-stor-code-1' => '',
-                       '101-stor-line-2' => '', // Hmm?
-                       '102-stor-code-2' => '',
-                       '103-stor-line-2' => '',
-                       '104-stor-code-3' => '',
-                       '105-stor-line-3' => '',
-                       '106-stor-code-4' => '',
-                       '107-stor-line-4' => '',
-                       '108-stor-code-5' => '',
-                       '109-stor-line-5' => '',
-                       '110-stor-code-6' => '',
-                       '111-stor-line-6' => '',
-
-                       '112-priority' => '',
-                       '113-blank' => '',
-                       '114-charges' => '',
-                       '115-blank' => '',
-                       '116-details' => '',
-                       '117-note' => substr( sprintf( 'wcb-%d-%d', $index->blog_id, $index->post_id ), 0, 70 ),
-               );
-
-               // If an intermediary bank is given.
-               $interm_swift = get_post_meta( $post->ID, '_camppayments_interm_bank_swift', true );
-               if ( ! empty( $iterm_swift ) ) {
-                       $row['40-id-type'] = 'SWIFT';
-                       $row['41-id-value'] = $interm_swift;
-
-                       $row['42-interm-bank-name'] = substr( get_post_meta( $post->ID, '_camppayments_interm_bank_name', true ), 0, 35 );
-                       $row['43-interm-bank-address-1'] = substr( get_post_meta( $post->ID, '_camppayments_interm_bank_street_address', true ), 0, 35 );
-
-                       $row['44-interm-bank-address-2'] = '';
-                       $row['45-interm-bank-address-3'] = substr( sprintf( '%s %s %s',
-                               get_post_meta( $post->ID, '_camppayments_interm_bank_city', true ),
-                               get_post_meta( $post->ID, '_camppayments_interm_bank_state', true ),
-                               get_post_meta( $post->ID, '_camppayments_interm_bank_zip_code', true )
-                       ), 0, 32 );
-
-                       $row['46-interm-bank-country'] = get_post_meta( $post->ID, '_camppayments_interm_bank_country_iso3166', true );
-
-                       $row['47-supl-id-type'] = 'ACCT';
-                       $row['48-supl-id-value'] = get_post_meta( $post->ID, '_camppayments_interm_bank_account', true );
-               }
-
-               // Use for debugging.
-               // print_r( $row );
-
-               fputcsv( $report, array_values( $row ) );
-               restore_current_blog();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $args['post_type'] == 'wcp_payment_request' ) {
+               return \WCP_Payment_Request::_generate_payment_report_jpm_wires( $args );
+       } elseif ( $args['post_type'] == 'wcb_reimbursement' ) {
+               return \WordCamp\Budgets\Reimbursement_Requests\_generate_payment_report_jpm_wires( $args );
</ins><span class="cx" style="display: block; padding: 0 10px">         }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
-       // JPM Trailer
-       fputcsv( $report, array( 'TRAILER', $count, $total ) );
-
-       fclose( $report );
-       $results = ob_get_clean();
-
-       // JPM chokes on accents and non-latin characters.
-       $results = remove_accents( $results );
-       return $results;
</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>
</div>

</body>
</html>