From: Steve Sutton Date: Tue, 4 Jun 2019 12:51:18 +0000 (-0400) Subject: Updates on uptravel account import X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=1a888d8b72af78d7c260fb5d952ee8c338d8faee;p=WP-Plugins%2Fglm-member-db-billing.git Updates on uptravel account import Need all accounts. --- diff --git a/models/admin/management/billing.php b/models/admin/management/billing.php index 7066bd4..ffe12c1 100644 --- a/models/admin/management/billing.php +++ b/models/admin/management/billing.php @@ -117,6 +117,7 @@ class GlmMembersAdmin_management_billing extends GlmDataBillingManagement $importResults = false; $totalImports = false; $numberProcessed = false; + $totalMembers = false; // echo '
Config: ' . print_r( $this->config, true ) . '
'; // General settings are always stored in a record with ID=1. @@ -273,6 +274,7 @@ class GlmMembersAdmin_management_billing extends GlmDataBillingManagement 'totalImports' => $totalImports, 'numberProcessed' => $numberProcessed, 'start' => ( isset( $start ) ? $start : false ), + 'totalMembers' => $totalMembers, ); // Return status, suggested view, and data to controller diff --git a/models/admin/management/importAccounts.php b/models/admin/management/importAccounts.php index 862eaeb..b9709d7 100644 --- a/models/admin/management/importAccounts.php +++ b/models/admin/management/importAccounts.php @@ -134,7 +134,7 @@ LEFT OUTER JOIN members.member_account MA ON ( MA.member_id = M.member_id ) LEFT OUTER JOIN members.payment_types PT ON ( MA.payment_type = PT.id ) WHERE PT.name != '' AND PT.name IS NOT NULL - AND M.member_id IN ( SELECT DISTINCT member_id FROM members.billing where transaction_date >= '01/01/2018' ) + -- AND M.member_id IN ( SELECT DISTINCT member_id FROM members.billing where transaction_date >= '01/01/2017' ) "; // Get total number of members. @@ -144,7 +144,6 @@ SELECT count(M.member_id) as total "; $totalStmt = $dbh->query( $sql ); $totalMembers = $totalStmt->fetchColumn(); -$importResults .= 'Total Members: ' . $totalMembers . "
"; // return false; @@ -155,10 +154,9 @@ SELECT M.member_id,M.billing_contact,M.account_number, M.mailing_address,M.mailing_city_id,M.mailing_state_id,M.mailing_zip, M.street,M.city_id,M.state_id,M.zip,M.region $fromWhere -ORDER BY M.member_id"; - -//LIMIT 10 -//OFFSET $start"; +ORDER BY M.member_id +LIMIT 10 +OFFSET $start"; $stmt = $dbh->query( $sql ); $members = $stmt->fetchAll(); $numberMembers = count( $members ); @@ -169,9 +167,12 @@ $importResults .= 'Total Members this round: ' . count( $members ) . "
"; if ( $start === 0 ) { // Clear the invoices,line_items and transactions + // $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts" ); // $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoices" ); // $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "line_items" ); // $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "transactions" ); + // $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "payments" ); + // $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "invoice_payments" ); } $getState = $dbh->prepare( @@ -205,7 +206,7 @@ function getCountyId( $wpdb, $county_name ) foreach ( $members as $member ) { - $importResults .= '
$member: ' . print_r( $member, true ) . '
'; + // $importResults .= '
$member: ' . print_r( $member, true ) . '
'; // Get the new id of member (old_member_id). $newMemberId = $this->wpdb->get_var( @@ -216,7 +217,7 @@ foreach ( $members as $member ) { $member['member_id'] ) ); - $importResults .= '
$newMemberId: ' . print_r( $newMemberId, true ) . '
'; + // $importResults .= '
$newMemberId: ' . print_r( $newMemberId, true ) . '
'; if ( $newMemberId ) { @@ -300,7 +301,7 @@ foreach ( $members as $member ) { '%s', // billing_county ); - $importResults .= '
$accountData: ' . print_r( $accountData, true ) . '
'; + // $importResults .= '
$accountData: ' . print_r( $accountData, true ) . '
'; // Check if member has an account. $accountId = $this->wpdb->get_var( @@ -311,7 +312,7 @@ foreach ( $members as $member ) { $newMemberId ) ); - $importResults .= '
$accountId: ' . print_r( $accountId, true ) . '
'; + // $importResults .= '
$accountId: ' . print_r( $accountId, true ) . '
'; // If not create one. if ( !$accountId ) { @@ -325,13 +326,13 @@ foreach ( $members as $member ) { } else { // Else update account. - $this->wpdb->update( - GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'accounts', - $accountData, - array( 'id' => $accountId ), - $accountDataFormat, - array( '%d' ) - ); + // $this->wpdb->update( + // GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . 'accounts', + // $accountData, + // array( 'id' => $accountId ), + // $accountDataFormat, + // array( '%d' ) + // ); } diff --git a/views/admin/management/importAccounts.html b/views/admin/management/importAccounts.html index 2f584b1..e0475c1 100644 --- a/views/admin/management/importAccounts.html +++ b/views/admin/management/importAccounts.html @@ -21,20 +21,20 @@ {/if} +Total Accounts: {$totalMembers}
Number processed: {$numberProcessed} -{* +{* auto load next *} {if $numberProcessed < $totalMembers} {/if} -*} {include file='admin/management/footer.html'}