$regSettings = $this->updateEntry( $id );
// Check if we were successful
- if ($regSettings['status']) {
+ if ( $regSettings['status'] ) {
$settingsUpdated = true;
- $regSettings = $this->editEntry( $id );
+ $regSettings = $this->editEntry( $id );
} else {
$settingsUpdateError = true;
$option2 = '';
}
switch ( $option2 ) {
- case 'verify':
+ case 'import':
require_once GLM_MEMBERS_BILLING_PLUGIN_PATH.'/models/admin/management/importBillingData.php';
// die('here');
break;
// For billing support functions
require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH . '/billingSupport.php';
$BillingSupport = new GlmBillingSupport( $this->wpdb, $this->config );
+
+$limit = 10;
// Connect to their live database.
$dbh = new PDO(
'pgsql: host=ds5 dbname=uptravel user=postgres',
)
);
-$dbh->setAttribute(
- PDO::ATTR_ERRMODE,
- PDO::ERRMODE_EXCEPTION
-);
+$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
if ( isset( $_REQUEST['start'] ) && $start = filter_var( $_REQUEST['start'], FILTER_VALIDATE_INT ) ) {
} else {
FROM members.billing
$sqlWhere
ORDER BY transaction_date,transaction_time
- LIMIT 10
+ LIMIT $limit
OFFSET $start";
$statsSql = "SELECT count(*)
}
}
-$numberProcessed = $start + 10;
+$numberProcessed = $start + $limit;
)
);
-$dbh->setAttribute(
- PDO::ATTR_ERRMODE,
- PDO::ERRMODE_EXCEPTION
-);
+$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
if ( isset( $_REQUEST['start'] ) && $start = filter_var( $_REQUEST['start'], FILTER_VALIDATE_INT ) ) {
} else {
$query = "
SELECT id,name
FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members
- WHERE id in ( SELECT DISTINCT ref_dest
- FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts )
+ WHERE id in (
+ SELECT DISTINCT ref_dest
+ FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts )
+ AND old_member_id IN ( 17484, 4799, 17035, 6040, 5442, 5434, 18660 )
LIMIT 20 OFFSET 0";
$results = $this->wpdb->get_results( $query, ARRAY_A );
-$importResults .= '<pre>$results: ' . print_r( $results, true ) . '</pre>';
+// $importResults .= '<pre>$results: ' . print_r( $results, true ) . '</pre>';
foreach ( $results as $row ) {
- $account_id = $BillingSupport->getAccountByRefDest( $row['id'] );
- echo '<pre>$account_id: ' . print_r( $account_id, true ) . '</pre>';
+ // Get balance due
+ $account = $BillingSupport->getAccountByRefDest( $row['id'] );
+ if ( !$account ) {
+ $importResults .= '<p>No account</p>';
+ } else {
+ $importResults .= '<p>Account: ' . $account['id'] . '</p>';
+ }
+ $balanceDue = $BillingSupport->getBalanceDueByAccount( $account['id'] );
+ $importResults .= '<pre>$balanceDue: ' . print_r( $balanceDue, true ) . '</pre>';
+ // $importResults .= '<pre>$account_id: ' . print_r( $account_id, true ) . '</pre>';
}