bindVars($addresses_query, ':customersID', $_GET['cID'], 'integer'); $addresses = $db->Execute($addresses_query); $addressArray = array(); while (!$addresses->EOF) { $format_id = zen_get_address_format_id($addresses->fields['country_id']); $addressArray[] = array('firstname'=>$addresses->fields['firstname'], 'lastname'=>$addresses->fields['lastname'], 'address_book_id'=>$addresses->fields['address_book_id'], 'format_id'=>$format_id, 'address'=>$addresses->fields); $addresses->MoveNext(); } ?>

'); ?>

0 ? '&page=' . $_GET['page'] : ''), 'NONSSL') . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''; ?>
Execute("select customers_email_address, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'"); if ((int)CUSTOMERS_APPROVAL_AUTHORIZATION > 0 && (int)$_GET['current'] > 0 && $custinfo->RecordCount() > 0) { $message = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE; $html_msg['EMAIL_MESSAGE_HTML'] = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE ; zen_mail($custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], $custinfo->fields['customers_email_address'], EMAIL_CUSTOMER_STATUS_CHANGE_SUBJECT , $message, STORE_NAME, EMAIL_FROM, $html_msg, 'default'); } } else { $sql = "update " . TABLE_CUSTOMERS . " set customers_authorization='" . CUSTOMERS_APPROVAL_AUTHORIZATION . "' where customers_id='" . (int)$customers_id . "'"; } $db->Execute($sql); $action = ''; zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . (int)$customers_id . '&page=' . $_GET['page'], 'NONSSL')); break; case 'update': $customers_firstname = zen_db_prepare_input($_POST['customers_firstname']); $customers_lastname = zen_db_prepare_input($_POST['customers_lastname']); $customers_email_address = zen_db_prepare_input($_POST['customers_email_address']); $customers_telephone = zen_db_prepare_input($_POST['customers_telephone']); $customers_fax = zen_db_prepare_input($_POST['customers_fax']); $customers_newsletter = zen_db_prepare_input($_POST['customers_newsletter']); $customers_group_pricing = (int)zen_db_prepare_input($_POST['customers_group_pricing']); $customers_email_format = zen_db_prepare_input($_POST['customers_email_format']); $customers_gender = zen_db_prepare_input($_POST['customers_gender']); $customers_dob = (empty($_POST['customers_dob']) ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_db_prepare_input($_POST['customers_dob'])); $customers_authorization = zen_db_prepare_input($_POST['customers_authorization']); $customers_referral= zen_db_prepare_input($_POST['customers_referral']); if (CUSTOMERS_APPROVAL_AUTHORIZATION == 2 and $customers_authorization == 1) { $customers_authorization = 2; $messageStack->add_session(ERROR_CUSTOMER_APPROVAL_CORRECTION2, 'caution'); } if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 and $customers_authorization == 2) { $customers_authorization = 1; $messageStack->add_session(ERROR_CUSTOMER_APPROVAL_CORRECTION1, 'caution'); } $default_address_id = zen_db_prepare_input($_POST['default_address_id']); $entry_street_address = zen_db_prepare_input($_POST['entry_street_address']); $entry_suburb = zen_db_prepare_input($_POST['entry_suburb']); $entry_postcode = zen_db_prepare_input($_POST['entry_postcode']); $entry_city = zen_db_prepare_input($_POST['entry_city']); $entry_country_id = zen_db_prepare_input($_POST['entry_country_id']); $entry_company = zen_db_prepare_input($_POST['entry_company']); $entry_state = zen_db_prepare_input($_POST['entry_state']); if (isset($_POST['entry_zone_id'])) $entry_zone_id = zen_db_prepare_input($_POST['entry_zone_id']); if (strlen($customers_firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) { $error = true; $entry_firstname_error = true; } else { $entry_firstname_error = false; } if (strlen($customers_lastname) < ENTRY_LAST_NAME_MIN_LENGTH) { $error = true; $entry_lastname_error = true; } else { $entry_lastname_error = false; } if (ACCOUNT_DOB == 'true') { if (ENTRY_DOB_MIN_LENGTH >0) { if (checkdate(substr(zen_date_raw($customers_dob), 4, 2), substr(zen_date_raw($customers_dob), 6, 2), substr(zen_date_raw($customers_dob), 0, 4))) { $entry_date_of_birth_error = false; } else { $error = true; $entry_date_of_birth_error = true; } } else { $customers_dob = '0001-01-01 00:00:00'; } } if (strlen($customers_email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { $error = true; $entry_email_address_error = true; } else { $entry_email_address_error = false; } if (!zen_validate_email($customers_email_address)) { $error = true; $entry_email_address_check_error = true; } else { $entry_email_address_check_error = false; } if (strlen($entry_street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) { $error = true; $entry_street_address_error = true; } else { $entry_street_address_error = false; } if (strlen($entry_postcode) < ENTRY_POSTCODE_MIN_LENGTH) { $error = true; $entry_post_code_error = true; } else { $entry_post_code_error = false; } if (strlen($entry_city) < ENTRY_CITY_MIN_LENGTH) { $error = true; $entry_city_error = true; } else { $entry_city_error = false; } if ($entry_country_id == false) { $error = true; $entry_country_error = true; } else { $entry_country_error = false; } if (ACCOUNT_STATE == 'true') { if ($entry_country_error == true) { $entry_state_error = true; } else { $zone_id = 0; $entry_state_error = false; $check_value = $db->Execute("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$entry_country_id . "'"); $entry_state_has_zones = ($check_value->fields['total'] > 0); if ($entry_state_has_zones == true) { $zone_query = $db->Execute("select zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$entry_country_id . "' and zone_name = '" . zen_db_input($entry_state) . "'"); if ($zone_query->RecordCount() > 0) { $entry_zone_id = $zone_query->fields['zone_id']; } else { $error = true; $entry_state_error = true; } } else { if ($entry_state == false) { $error = true; $entry_state_error = true; } } } } if (strlen($customers_telephone) < ENTRY_TELEPHONE_MIN_LENGTH) { $error = true; $entry_telephone_error = true; } else { $entry_telephone_error = false; } $check_email = $db->Execute("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . zen_db_input($customers_email_address) . "' and customers_id != '" . (int)$customers_id . "'"); if ($check_email->RecordCount() > 0) { $error = true; $entry_email_address_exists = true; } else { $entry_email_address_exists = false; } if ($error == false) { $sql_data_array = array('customers_firstname' => $customers_firstname, 'customers_lastname' => $customers_lastname, 'customers_email_address' => $customers_email_address, 'customers_telephone' => $customers_telephone, 'customers_fax' => $customers_fax, 'customers_group_pricing' => $customers_group_pricing, 'customers_newsletter' => $customers_newsletter, 'customers_email_format' => $customers_email_format, 'customers_authorization' => $customers_authorization, 'customers_referral' => $customers_referral ); if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $customers_gender; if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = ($customers_dob == '0001-01-01 00:00:00' ? '0001-01-01 00:00:00' : zen_date_raw($customers_dob)); zen_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "'"); $db->Execute("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int)$customers_id . "'"); if ($entry_zone_id > 0) $entry_state = ''; $sql_data_array = array('entry_firstname' => $customers_firstname, 'entry_lastname' => $customers_lastname, 'entry_street_address' => $entry_street_address, 'entry_postcode' => $entry_postcode, 'entry_city' => $entry_city, 'entry_country_id' => $entry_country_id); if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $entry_company; if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $entry_suburb; if (ACCOUNT_STATE == 'true') { if ($entry_zone_id > 0) { $sql_data_array['entry_zone_id'] = $entry_zone_id; $sql_data_array['entry_state'] = ''; } else { $sql_data_array['entry_zone_id'] = '0'; $sql_data_array['entry_state'] = $entry_state; } } zen_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$default_address_id . "'"); zen_redirect(zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')) . 'cID=' . $customers_id, 'NONSSL')); } else if ($error == true) { $cInfo = new objectInfo($_POST); $processed = true; } break; case 'deleteconfirm': // demo active test if (zen_admin_demo()) { $_GET['action']= ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')), 'NONSSL')); } if (isset($_POST['delete_reviews']) && ($_POST['delete_reviews'] == 'on')) { $reviews = $db->Execute("select reviews_id from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers_id . "'"); while (!$reviews->EOF) { $db->Execute("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$reviews->fields['reviews_id'] . "'"); $reviews->MoveNext(); } $db->Execute("delete from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers_id . "'"); } else { $db->Execute("update " . TABLE_REVIEWS . " set customers_id = null where customers_id = '" . (int)$customers_id . "'"); } $db->Execute("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "'"); $db->Execute("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'"); $db->Execute("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customers_id . "'"); $db->Execute("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customers_id . "'"); $db->Execute("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customers_id . "'"); $db->Execute("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . (int)$customers_id . "'"); zen_redirect(zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')), 'NONSSL')); break; default: $customers = $db->Execute("select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id, c.customers_email_format, c.customers_group_pricing, c.customers_authorization, c.customers_referral from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . (int)$customers_id . "'"); $cInfo = new objectInfo($customers->fields); } } ?> > <?php echo TITLE; ?>
'1', 'text' => ENTRY_NEWSLETTER_YES), array('id' => '0', 'text' => ENTRY_NEWSLETTER_NO)); ?> customers_default_address_id); echo zen_hide_session_id(); ?>
'0', 'text' => CUSTOMERS_AUTHORIZATION_0), array('id' => '1', 'text' => CUSTOMERS_AUTHORIZATION_1), array('id' => '2', 'text' => CUSTOMERS_AUTHORIZATION_2), array('id' => '3', 'text' => CUSTOMERS_AUTHORIZATION_3), array('id' => '4', 'text' => CUSTOMERS_AUTHORIZATION_4), // banned ); ?>
customers_gender) . '  ' . MALE . '  ' . zen_draw_radio_field('customers_gender', 'f', false, $cInfo->customers_gender) . '  ' . FEMALE . ' ' . ENTRY_GENDER_ERROR; } else { echo zen_draw_radio_field('customers_gender', 'm', false, $cInfo->customers_gender) . '  ' . MALE . '  ' . zen_draw_radio_field('customers_gender', 'f', false, $cInfo->customers_gender) . '  ' . FEMALE; } ?>
customers_authorization); ?>
customers_firstname, zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', 50)) . ' ' . ENTRY_FIRST_NAME_ERROR; } else { echo $cInfo->customers_firstname . zen_draw_hidden_field('customers_firstname'); } } else { echo zen_draw_input_field('customers_firstname', $cInfo->customers_firstname, zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', 50), true); } ?>
customers_lastname, zen_set_field_length(TABLE_CUSTOMERS, 'customers_lastname', 50)) . ' ' . ENTRY_LAST_NAME_ERROR; } else { echo $cInfo->customers_lastname . zen_draw_hidden_field('customers_lastname'); } } else { echo zen_draw_input_field('customers_lastname', $cInfo->customers_lastname, zen_set_field_length(TABLE_CUSTOMERS, 'customers_lastname', 50), true); } ?>
customers_dob == '0001-01-01 00:00:00' ? '' : zen_date_short($cInfo->customers_dob)), 'maxlength="10"') . ' ' . ENTRY_DATE_OF_BIRTH_ERROR; } else { echo $cInfo->customers_dob . ($customers_dob == '0001-01-01 00:00:00' ? 'N/A' : zen_draw_hidden_field('customers_dob')); } } else { echo zen_draw_input_field('customers_dob', ($customers_dob == '0001-01-01 00:00:00' ? '' : zen_date_short($cInfo->customers_dob)), 'maxlength="10"', true); } ?>
customers_email_address, zen_set_field_length(TABLE_CUSTOMERS, 'customers_email_address', 50)) . ' ' . ENTRY_EMAIL_ADDRESS_ERROR; } elseif ($entry_email_address_check_error == true) { echo zen_draw_input_field('customers_email_address', $cInfo->customers_email_address, zen_set_field_length(TABLE_CUSTOMERS, 'customers_email_address', 50)) . ' ' . ENTRY_EMAIL_ADDRESS_CHECK_ERROR; } elseif ($entry_email_address_exists == true) { echo zen_draw_input_field('customers_email_address', $cInfo->customers_email_address, zen_set_field_length(TABLE_CUSTOMERS, 'customers_email_address', 50)) . ' ' . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS; } else { echo $customers_email_address . zen_draw_hidden_field('customers_email_address'); } } else { echo zen_draw_input_field('customers_email_address', $cInfo->customers_email_address, zen_set_field_length(TABLE_CUSTOMERS, 'customers_email_address', 50), true); } ?>
entry_company, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_company', 50)) . ' ' . ENTRY_COMPANY_ERROR; } else { echo $cInfo->entry_company . zen_draw_hidden_field('entry_company'); } } else { echo zen_draw_input_field('entry_company', $cInfo->entry_company, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_company', 50)); } ?>
entry_street_address, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_street_address', 50)) . ' ' . ENTRY_STREET_ADDRESS_ERROR; } else { echo $cInfo->entry_street_address . zen_draw_hidden_field('entry_street_address'); } } else { echo zen_draw_input_field('entry_street_address', $cInfo->entry_street_address, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_street_address', 50), true); } ?>
entry_suburb, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_suburb', 50)) . ' ' . ENTRY_SUBURB_ERROR; } else { echo $cInfo->entry_suburb . zen_draw_hidden_field('entry_suburb'); } } else { echo zen_draw_input_field('entry_suburb', $cInfo->entry_suburb, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_suburb', 50)); } ?>
entry_postcode, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', 10)) . ' ' . ENTRY_POST_CODE_ERROR; } else { echo $cInfo->entry_postcode . zen_draw_hidden_field('entry_postcode'); } } else { echo zen_draw_input_field('entry_postcode', $cInfo->entry_postcode, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', 10), true); } ?>
entry_city, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_city', 50)) . ' ' . ENTRY_CITY_ERROR; } else { echo $cInfo->entry_city . zen_draw_hidden_field('entry_city'); } } else { echo zen_draw_input_field('entry_city', $cInfo->entry_city, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_city', 50), true); } ?>
entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state); if ($error == true) { if ($entry_state_error == true) { if ($entry_state_has_zones == true) { $zones_array = array(); $zones_values = $db->Execute("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . zen_db_input($cInfo->entry_country_id) . "' order by zone_name"); while (!$zones_values->EOF) { $zones_array[] = array('id' => $zones_values->fields['zone_name'], 'text' => $zones_values->fields['zone_name']); $zones_values->MoveNext(); } echo zen_draw_pull_down_menu('entry_state', $zones_array) . ' ' . ENTRY_STATE_ERROR; } else { echo zen_draw_input_field('entry_state', zen_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)) . ' ' . ENTRY_STATE_ERROR; } } else { echo $entry_state . zen_draw_hidden_field('entry_zone_id') . zen_draw_hidden_field('entry_state'); } } else { echo zen_draw_input_field('entry_state', zen_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)); } ?>
entry_country_id) . ' ' . ENTRY_COUNTRY_ERROR; } else { echo zen_get_country_name($cInfo->entry_country_id) . zen_draw_hidden_field('entry_country_id'); } } else { echo zen_draw_pull_down_menu('entry_country_id', zen_get_countries(), $cInfo->entry_country_id); } ?>
customers_telephone, zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', 15)) . ' ' . ENTRY_TELEPHONE_NUMBER_ERROR; } else { echo $cInfo->customers_telephone . zen_draw_hidden_field('customers_telephone'); } } else { echo zen_draw_input_field('customers_telephone', $cInfo->customers_telephone, zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', 15), true); } ?>
customers_fax . zen_draw_hidden_field('customers_fax'); } else { echo zen_draw_input_field('customers_fax', $cInfo->customers_fax, zen_set_field_length(TABLE_CUSTOMERS, 'customers_fax', 15)); } ?>
customers_email_format) { echo $customers_email_format . zen_draw_hidden_field('customers_email_format'); } } else { $email_pref_text = ($cInfo->customers_email_format == 'TEXT') ? true : false; $email_pref_html = !$email_pref_text; echo zen_draw_radio_field('customers_email_format', 'HTML', $email_pref_html) . ' ' . ENTRY_EMAIL_HTML_DISPLAY . '   ' . zen_draw_radio_field('customers_email_format', 'TEXT', $email_pref_text) . ' ' . ENTRY_EMAIL_TEXT_DISPLAY ; } ?>
customers_newsletter == '1') { echo ENTRY_NEWSLETTER_YES; } else { echo ENTRY_NEWSLETTER_NO; } echo zen_draw_hidden_field('customers_newsletter'); } else { echo zen_draw_pull_down_menu('customers_newsletter', $newsletter_array, (($cInfo->customers_newsletter == '1') ? '1' : '0')); } ?>
customers_group_pricing) { $group_query = $db->Execute("select group_name, group_percentage from " . TABLE_GROUP_PRICING . " where group_id = '" . $cInfo->customers_group_pricing . "'"); echo $group_query->fields['group_name'].' '.$group_query->fields['group_percentage'].'%'; } else { echo ENTRY_NONE; } echo zen_draw_hidden_field('customers_group_pricing', $cInfo->customers_group_pricing); } else { $group_array_query = $db->execute("select group_id, group_name, group_percentage from " . TABLE_GROUP_PRICING); $group_array[] = array('id'=>0, 'text'=>TEXT_NONE); while (!$group_array_query->EOF) { $group_array[] = array('id'=>$group_array_query->fields['group_id'], 'text'=>$group_array_query->fields['group_name'].' '.$group_array_query->fields['group_percentage'].'%'); $group_array_query->MoveNext(); } echo zen_draw_pull_down_menu('customers_group_pricing', $group_array, $cInfo->customers_group_pricing); } ?>
customers_referral, zen_set_field_length(TABLE_CUSTOMERS, 'customers_referral', 15)); ?>
' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''; ?>
' . zen_image_button('button_reset.gif', IMAGE_RESET) . '  '; } echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id(); if (isset($_GET['search']) && zen_not_null($_GET['search'])) { $keywords = zen_db_prepare_input($_GET['search']); echo '
' . TEXT_INFO_SEARCH_DETAIL_FILTER . zen_output_string_protected($keywords); } ?>
'' . TEXT_INFO_HEADING_DELETE_CUSTOMER . ''); $contents = array('form' => zen_draw_form('customers', FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=deleteconfirm', 'post', '', true)); $contents[] = array('text' => TEXT_DELETE_INTRO . '

' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . ''); if (isset($cInfo->number_of_reviews) && ($cInfo->number_of_reviews) > 0) $contents[] = array('text' => '
' . zen_draw_checkbox_field('delete_reviews', 'on', true) . ' ' . sprintf(TEXT_DELETE_REVIEWS, $cInfo->number_of_reviews)); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; default: if (isset($cInfo) && is_object($cInfo)) { $customers_orders = $db->Execute("select o.orders_id, o.date_purchased, o.order_total, o.currency, o.currency_value, cgc.amount from " . TABLE_ORDERS . " o left join " . TABLE_COUPON_GV_CUSTOMER . " cgc on o.customers_id = cgc.customer_id where customers_id='" . $cInfo->customers_id . "' order by date_purchased desc"); $heading[] = array('text' => '' . TABLE_HEADING_ID . $cInfo->customers_id . ' ' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . ''); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '
' . ($customers_orders->RecordCount() != 0 ? '' . zen_image_button('button_orders.gif', IMAGE_ORDERS) . '' : '') . ' ' . zen_image_button('button_email.gif', IMAGE_EMAIL) . ''); $contents[] = array('text' => '
' . TEXT_DATE_ACCOUNT_CREATED . ' ' . zen_date_short($cInfo->date_account_created)); $contents[] = array('text' => '
' . TEXT_DATE_ACCOUNT_LAST_MODIFIED . ' ' . zen_date_short($cInfo->date_account_last_modified)); $contents[] = array('text' => '
' . TEXT_INFO_DATE_LAST_LOGON . ' ' . zen_date_short($cInfo->date_last_logon)); $contents[] = array('text' => '
' . TEXT_INFO_NUMBER_OF_LOGONS . ' ' . $cInfo->number_of_logons); $contents[] = array('text' => '
' . TEXT_INFO_GV_AMOUNT . ' ' . $currencies->format($customers_orders->fields['amount'])); $contents[] = array('text' => '
' . TEXT_INFO_NUMBER_OF_ORDERS . ' ' . $customers_orders->RecordCount()); if ($customers_orders->RecordCount() != 0) { $contents[] = array('text' => TEXT_INFO_LAST_ORDER . ' ' . zen_date_short($customers_orders->fields['date_purchased']) . '
' . TEXT_INFO_ORDERS_TOTAL . ' ' . $currencies->format($customers_orders->fields['order_total'], true, $customers_orders->fields['currency'], $customers_orders->fields['currency_value'])); } $contents[] = array('text' => '
' . TEXT_INFO_COUNTRY . ' ' . $cInfo->countries_name); $contents[] = array('text' => '
' . TEXT_INFO_NUMBER_OF_REVIEWS . ' ' . $cInfo->number_of_reviews); $contents[] = array('text' => '
' . CUSTOMERS_REFERRAL . ' ' . $cInfo->customers_referral); } break; } if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { echo ' ' . "\n"; } ?>
bindVars($search, ':keywords:', $keywords, 'regexp'); } $new_fields=', c.customers_telephone, a.entry_company, a.entry_street_address, a.entry_city, a.entry_postcode, c.customers_authorization, c.customers_referral'; $customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_group_pricing, a.entry_country_id, a.entry_company, ci.customers_info_date_of_last_logon, ci.customers_info_date_account_created " . $new_fields . ", cgc.amount from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_INFO . " ci on c.customers_id= ci.customers_info_id left join " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id " . " left join " . TABLE_COUPON_GV_CUSTOMER . " cgc on c.customers_id = cgc.customer_id " . $search . " order by $disp_order"; // Split Page // reset page when page is unknown if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['cID'] != '') { $check_page = $db->Execute($customers_query_raw); $check_count=1; if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER) { while (!$check_page->EOF) { if ($check_page->fields['customers_id'] == $_GET['cID']) { break; } $check_count++; $check_page->MoveNext(); } $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER) !=0 ? .5 : 0)),0); // zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $_GET['cID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''), 'NONSSL')); } else { $_GET['page'] = 1; } } $customers_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER, $customers_query_raw, $customers_query_numrows); $customers = $db->Execute($customers_query_raw); while (!$customers->EOF) { $sql = "select customers_info_date_account_created as date_account_created, customers_info_date_account_last_modified as date_account_last_modified, customers_info_date_of_last_logon as date_last_logon, customers_info_number_of_logons as number_of_logons from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . $customers->fields['customers_id'] . "'"; $info = $db->Execute($sql); // if no record found, create one to keep database in sync if (!isset($info->fields) || !is_array($info->fields)) { $insert_sql = "insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customers->fields['customers_id'] . "', '0', now())"; $db->Execute($insert_sql); $info = $db->Execute($sql); } if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $customers->fields['customers_id']))) && !isset($cInfo)) { $country = $db->Execute("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$customers->fields['entry_country_id'] . "'"); $reviews = $db->Execute("select count(*) as number_of_reviews from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers->fields['customers_id'] . "'"); $customer_info = array_merge($country->fields, $info->fields, $reviews->fields); $cInfo_array = array_merge($customers->fields, $customer_info); $cInfo = new objectInfo($cInfo_array); } $group_query = $db->Execute("select group_name, group_percentage from " . TABLE_GROUP_PRICING . " where group_id = '" . $customers->fields['customers_group_pricing'] . "'"); if ($group_query->RecordCount() < 1) { $group_name_entry = TEXT_NONE; } else { $group_name_entry = $group_query->fields['group_name']; } if (isset($cInfo) && is_object($cInfo) && ($customers->fields['customers_id'] == $cInfo->customers_id)) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } $zc_address_book_count_list = zen_get_customers_address_book($customers->fields['customers_id']); $zc_address_book_count = $zc_address_book_count_list->RecordCount(); ?> MoveNext(); } ?>
' . TABLE_HEADING_LASTNAME . '' : TABLE_HEADING_LASTNAME); ?>
Asc' : 'Asc'); ?>  Desc' : 'Desc'); ?>
' . TABLE_HEADING_FIRSTNAME . '' : TABLE_HEADING_FIRSTNAME); ?>
Asc' : 'Asc'); ?>  Desc' : 'Desc'); ?>
' . TABLE_HEADING_COMPANY . '' : TABLE_HEADING_COMPANY); ?>
Asc' : 'Asc'); ?>  Desc' : 'Desc'); ?>
' . TABLE_HEADING_ACCOUNT_CREATED . '' : TABLE_HEADING_ACCOUNT_CREATED); ?>
Asc' : 'Asc'); ?>  Desc' : 'Desc'); ?>
' . TABLE_HEADING_LOGIN . '' : TABLE_HEADING_LOGIN); ?>
Asc' : 'Asc'); ?>  Desc' : 'Desc'); ?>
' . TABLE_HEADING_PRICING_GROUP . '' : TABLE_HEADING_PRICING_GROUP); ?>
Asc' : 'Asc'); ?>  Desc' : 'Desc'); ?>
' . TABLE_HEADING_GV_AMOUNT . '' : TABLE_HEADING_GV_AMOUNT); ?>
Asc' : 'Asc'); ?>  Desc' : 'Desc'); ?>
' . TABLE_HEADING_AUTHORIZATION_APPROVAL . '' : TABLE_HEADING_AUTHORIZATION_APPROVAL); ?>
Asc' : 'Asc'); ?>  Desc' : 'Desc'); ?>
 
fields['customers_id'] . ($zc_address_book_count == 1 ? TEXT_INFO_ADDRESS_BOOK_COUNT . $zc_address_book_count : '' . TEXT_INFO_ADDRESS_BOOK_COUNT . $zc_address_book_count . ''); ?> fields['customers_lastname']; ?> fields['customers_firstname']; ?> fields['entry_company']; ?> fields['date_account_created']); ?> fields['customers_info_date_of_last_logon']); ?> format($customers->fields['amount']); ?> fields['customers_authorization'] == 4 ? zen_image(DIR_WS_IMAGES . 'icon_red_off.gif', IMAGE_ICON_STATUS_OFF) : ($customers->fields['customers_authorization'] == 0 ? '' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '' : '' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '')); ?> fields['customers_id'] == $cInfo->customers_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?> 
display_count($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?> display_links($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?>
' . zen_image_button('button_reset.gif', IMAGE_RESET) . ''; ?>
' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '