}
}
+// Read in member/reservation url data
+// accommodation table
+if (!$failure) {
+ $sql = "
+ SELECT member_id,reservation_url
+ FROM $dbSchema.member_accommodations
+ WHERE reservation_url != ''
+ AND reservation_url IS NOT NULL";
+ $res = pg_query($db, $sql);
+ $rows = pg_num_rows($res);
+ if ($rows > 0) {
+ $tmp = pg_fetch_all($res);
+ $membAccomm = array();
+
+ // Reproccess into array grouped by member with the main index
+ foreach ( $tmp as $x ) {
+ $membAccomm[$x['member_id']] = $x['reservation_url'];
+ }
+ }
+}
+// echo '<pre>$membAccomm: ' . print_r( $membAccomm, true ) . '</pre>';
+// exit;
+
// Read in all credit card types
if (!$failure) {
$sql = "
$res = $this->wpdb->insert(
GLM_MEMBERS_PLUGIN_DB_PREFIX.'member_info',
array(
- 'member' => $membID,
- 'member_name' => $val['member_name'],
- 'status' => $this->config['status_numb']['Active'],
- 'reference_name' => 'Imported Member Information',
- 'descr' => preg_replace('%[\n\r]%', '', $val['description']),
- 'short_descr' => $short_descr,
- 'addr1' => $val['street'],
- 'addr2' => '',
- 'city' => ( (isset($city[$val['city_id']]['new_id']) && $city[$val['city_id']]['new_id']) ? $city[$val['city_id']]['new_id']: 0 ),
- 'state' => $state[$val['state_id']]['state_abb'],
- 'country' => 'US',
- 'zip' => $val['zip'],
-
- 'mailing_addr1' => $val['mailing_address'],
- 'mailing_city' => $mailingCityId,
- 'mailing_state' => ( (isset($state[$val['mailing_state_id']]['state_abb']) && $val['mailing_state_id']) ? $state[$val['mailing_state_id']]['state_abb']: ''),
- 'mailing_zip' => $val['mailing_zip'],
-
- 'lat' => $val['lat'],
- 'lon' => $val['lon'],
- 'region' => (isset($region[$val['region']]) ? $region[$val['region']]['new_id'] : 0),
- 'phone' => $val['phone'],
- 'toll_free' => $val['toll_free'],
- 'url' => ((strlen($val['url']) > 255) ? substr($val['url'], 0, 250) : $val['url']),
- 'email' => $val['member_contact_email'],
- 'logo' => '',
- 'cc_type' => $ccBits,
- 'notes' => '',
- 'create_time' => $val['create_date'],
- 'modify_time' => $val['last_update']
+ 'member' => $membID,
+ 'member_name' => $val['member_name'],
+ 'status' => $this->config['status_numb']['Active'],
+ 'reference_name' => 'Imported Member Information',
+ 'descr' => preg_replace('%[\n\r]%', '', $val['description']),
+ 'short_descr' => $short_descr,
+ 'addr1' => $val['street'],
+ 'addr2' => '',
+ 'city' => ( (isset($city[$val['city_id']]['new_id']) && $city[$val['city_id']]['new_id']) ? $city[$val['city_id']]['new_id']: 0 ),
+ 'state' => $state[$val['state_id']]['state_abb'],
+ 'country' => 'US',
+ 'zip' => $val['zip'],
+
+ 'mailing_addr1' => $val['mailing_address'],
+ 'mailing_city' => $mailingCityId,
+ 'mailing_state' => ( (isset($state[$val['mailing_state_id']]['state_abb']) && $val['mailing_state_id']) ? $state[$val['mailing_state_id']]['state_abb']: ''),
+ 'mailing_zip' => $val['mailing_zip'],
+
+ 'lat' => $val['lat'],
+ 'lon' => $val['lon'],
+ 'region' => (isset($region[$val['region']]) ? $region[$val['region']]['new_id'] : 0),
+ 'phone' => $val['phone'],
+ 'toll_free' => $val['toll_free'],
+ 'url' => ((strlen($val['url']) > 255) ? substr($val['url'], 0, 250) : $val['url']),
+ 'reservation_url' => ((isset($membAccomm[$val['member_id']]) && $membAccomm[$val['member_id']] ) ? $membAccomm[$val['member_id']]: ''),
+ 'email' => $val['member_contact_email'],
+ 'logo' => '',
+ 'cc_type' => $ccBits,
+ 'notes' => '',
+ 'create_time' => $val['create_date'],
+ 'modify_time' => $val['last_update']
),
array(
'%d', // member id
'%s', // phone
'%s', // toll_free
'%s', // url
+ '%s', // reservation url
'%s', // email
'%s', // logo
'%d', // email