From: Steve Sutton Date: Tue, 27 Feb 2018 19:59:30 +0000 (-0500) Subject: Add reservation url for member import X-Git-Tag: v2.10.25^2~6 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=024850c0ed8839c781d68acdbc5e3a8040983204;p=WP-Plugins%2Fglm-member-db.git Add reservation url for member import Adding the member reservation url for the member import. --- diff --git a/models/admin/management/import/members.php b/models/admin/management/import/members.php index 8c496271..502cdc29 100644 --- a/models/admin/management/import/members.php +++ b/models/admin/management/import/members.php @@ -198,6 +198,29 @@ if (!$failure) { } } +// 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 '
$membAccomm: ' . print_r( $membAccomm, true ) . '
'; +// exit; + // Read in all credit card types if (!$failure) { $sql = " @@ -832,36 +855,37 @@ if (!$failure) { $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 @@ -888,6 +912,7 @@ if (!$failure) { '%s', // phone '%s', // toll_free '%s', // url + '%s', // reservation url '%s', // email '%s', // logo '%d', // email