[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 /** 3 * @package admin 4 * @copyright Copyright 2003-2006 Zen Cart Development Team 5 * @copyright Portions Copyright 2003 osCommerce 6 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 7 * @version $Id: customers.php 4280 2006-08-26 03:32:55Z drbyte $ 8 */ 9 10 require ('includes/application_top.php'); 11 12 require (DIR_WS_CLASSES . 'currencies.php'); 13 $currencies = new currencies(); 14 15 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 16 $customers_id = zen_db_prepare_input($_GET['cID']); 17 18 $error = false; 19 $processed = false; 20 21 if (zen_not_null($action)) { 22 switch ($action) { 23 case 'status': 24 if ($_GET['current'] == CUSTOMERS_APPROVAL_AUTHORIZATION) { 25 $sql = "update " . TABLE_CUSTOMERS . " set customers_authorization=0 where customers_id='" . (int)$customers_id . "'"; 26 $custinfo = $db->Execute("select customers_email_address, customers_firstname, customers_lastname 27 from " . TABLE_CUSTOMERS . " 28 where customers_id = '" . (int)$customers_id . "'"); 29 if ((int)CUSTOMERS_APPROVAL_AUTHORIZATION > 0 && (int)$_GET['current'] > 0 && $custinfo->RecordCount() > 0) { 30 $message = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE; 31 $html_msg['EMAIL_MESSAGE_HTML'] = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE ; 32 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'); 33 } 34 } else { 35 $sql = "update " . TABLE_CUSTOMERS . " set customers_authorization='" . CUSTOMERS_APPROVAL_AUTHORIZATION . "' where customers_id='" . (int)$customers_id . "'"; 36 } 37 $db->Execute($sql); 38 $action = ''; 39 zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . (int)$customers_id . '&page=' . $_GET['page'], 'NONSSL')); 40 break; 41 case 'update': 42 $customers_firstname = zen_db_prepare_input($_POST['customers_firstname']); 43 $customers_lastname = zen_db_prepare_input($_POST['customers_lastname']); 44 $customers_email_address = zen_db_prepare_input($_POST['customers_email_address']); 45 $customers_telephone = zen_db_prepare_input($_POST['customers_telephone']); 46 $customers_fax = zen_db_prepare_input($_POST['customers_fax']); 47 $customers_newsletter = zen_db_prepare_input($_POST['customers_newsletter']); 48 $customers_group_pricing = (int)zen_db_prepare_input($_POST['customers_group_pricing']); 49 $customers_email_format = zen_db_prepare_input($_POST['customers_email_format']); 50 $customers_gender = zen_db_prepare_input($_POST['customers_gender']); 51 $customers_dob = (empty($_POST['customers_dob']) ? zen_db_prepare_input('0001-01-01 00:00:00') : zen_db_prepare_input($_POST['customers_dob'])); 52 53 $customers_authorization = zen_db_prepare_input($_POST['customers_authorization']); 54 $customers_referral= zen_db_prepare_input($_POST['customers_referral']); 55 56 if (CUSTOMERS_APPROVAL_AUTHORIZATION == 2 and $customers_authorization == 1) { 57 $customers_authorization = 2; 58 $messageStack->add_session(ERROR_CUSTOMER_APPROVAL_CORRECTION2, 'caution'); 59 } 60 61 if (CUSTOMERS_APPROVAL_AUTHORIZATION == 1 and $customers_authorization == 2) { 62 $customers_authorization = 1; 63 $messageStack->add_session(ERROR_CUSTOMER_APPROVAL_CORRECTION1, 'caution'); 64 } 65 66 $default_address_id = zen_db_prepare_input($_POST['default_address_id']); 67 $entry_street_address = zen_db_prepare_input($_POST['entry_street_address']); 68 $entry_suburb = zen_db_prepare_input($_POST['entry_suburb']); 69 $entry_postcode = zen_db_prepare_input($_POST['entry_postcode']); 70 $entry_city = zen_db_prepare_input($_POST['entry_city']); 71 $entry_country_id = zen_db_prepare_input($_POST['entry_country_id']); 72 73 $entry_company = zen_db_prepare_input($_POST['entry_company']); 74 $entry_state = zen_db_prepare_input($_POST['entry_state']); 75 if (isset($_POST['entry_zone_id'])) $entry_zone_id = zen_db_prepare_input($_POST['entry_zone_id']); 76 77 if (strlen($customers_firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) { 78 $error = true; 79 $entry_firstname_error = true; 80 } else { 81 $entry_firstname_error = false; 82 } 83 84 if (strlen($customers_lastname) < ENTRY_LAST_NAME_MIN_LENGTH) { 85 $error = true; 86 $entry_lastname_error = true; 87 } else { 88 $entry_lastname_error = false; 89 } 90 91 if (ACCOUNT_DOB == 'true') { 92 if (ENTRY_DOB_MIN_LENGTH >0) { 93 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))) { 94 $entry_date_of_birth_error = false; 95 } else { 96 $error = true; 97 $entry_date_of_birth_error = true; 98 } 99 } else { 100 $customers_dob = '0001-01-01 00:00:00'; 101 } 102 } 103 104 if (strlen($customers_email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { 105 $error = true; 106 $entry_email_address_error = true; 107 } else { 108 $entry_email_address_error = false; 109 } 110 111 if (!zen_validate_email($customers_email_address)) { 112 $error = true; 113 $entry_email_address_check_error = true; 114 } else { 115 $entry_email_address_check_error = false; 116 } 117 118 if (strlen($entry_street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) { 119 $error = true; 120 $entry_street_address_error = true; 121 } else { 122 $entry_street_address_error = false; 123 } 124 125 if (strlen($entry_postcode) < ENTRY_POSTCODE_MIN_LENGTH) { 126 $error = true; 127 $entry_post_code_error = true; 128 } else { 129 $entry_post_code_error = false; 130 } 131 132 if (strlen($entry_city) < ENTRY_CITY_MIN_LENGTH) { 133 $error = true; 134 $entry_city_error = true; 135 } else { 136 $entry_city_error = false; 137 } 138 139 if ($entry_country_id == false) { 140 $error = true; 141 $entry_country_error = true; 142 } else { 143 $entry_country_error = false; 144 } 145 146 if (ACCOUNT_STATE == 'true') { 147 if ($entry_country_error == true) { 148 $entry_state_error = true; 149 } else { 150 $zone_id = 0; 151 $entry_state_error = false; 152 $check_value = $db->Execute("select count(*) as total 153 from " . TABLE_ZONES . " 154 where zone_country_id = '" . (int)$entry_country_id . "'"); 155 156 $entry_state_has_zones = ($check_value->fields['total'] > 0); 157 if ($entry_state_has_zones == true) { 158 $zone_query = $db->Execute("select zone_id 159 from " . TABLE_ZONES . " 160 where zone_country_id = '" . (int)$entry_country_id . "' 161 and zone_name = '" . zen_db_input($entry_state) . "'"); 162 163 if ($zone_query->RecordCount() > 0) { 164 $entry_zone_id = $zone_query->fields['zone_id']; 165 } else { 166 $error = true; 167 $entry_state_error = true; 168 } 169 } else { 170 if ($entry_state == false) { 171 $error = true; 172 $entry_state_error = true; 173 } 174 } 175 } 176 } 177 178 if (strlen($customers_telephone) < ENTRY_TELEPHONE_MIN_LENGTH) { 179 $error = true; 180 $entry_telephone_error = true; 181 } else { 182 $entry_telephone_error = false; 183 } 184 185 $check_email = $db->Execute("select customers_email_address 186 from " . TABLE_CUSTOMERS . " 187 where customers_email_address = '" . zen_db_input($customers_email_address) . "' 188 and customers_id != '" . (int)$customers_id . "'"); 189 190 if ($check_email->RecordCount() > 0) { 191 $error = true; 192 $entry_email_address_exists = true; 193 } else { 194 $entry_email_address_exists = false; 195 } 196 197 if ($error == false) { 198 199 $sql_data_array = array('customers_firstname' => $customers_firstname, 200 'customers_lastname' => $customers_lastname, 201 'customers_email_address' => $customers_email_address, 202 'customers_telephone' => $customers_telephone, 203 'customers_fax' => $customers_fax, 204 'customers_group_pricing' => $customers_group_pricing, 205 'customers_newsletter' => $customers_newsletter, 206 'customers_email_format' => $customers_email_format, 207 'customers_authorization' => $customers_authorization, 208 'customers_referral' => $customers_referral 209 ); 210 211 if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $customers_gender; 212 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)); 213 214 zen_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "'"); 215 216 $db->Execute("update " . TABLE_CUSTOMERS_INFO . " 217 set customers_info_date_account_last_modified = now() 218 where customers_info_id = '" . (int)$customers_id . "'"); 219 220 if ($entry_zone_id > 0) $entry_state = ''; 221 222 $sql_data_array = array('entry_firstname' => $customers_firstname, 223 'entry_lastname' => $customers_lastname, 224 'entry_street_address' => $entry_street_address, 225 'entry_postcode' => $entry_postcode, 226 'entry_city' => $entry_city, 227 'entry_country_id' => $entry_country_id); 228 229 if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $entry_company; 230 if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $entry_suburb; 231 232 if (ACCOUNT_STATE == 'true') { 233 if ($entry_zone_id > 0) { 234 $sql_data_array['entry_zone_id'] = $entry_zone_id; 235 $sql_data_array['entry_state'] = ''; 236 } else { 237 $sql_data_array['entry_zone_id'] = '0'; 238 $sql_data_array['entry_state'] = $entry_state; 239 } 240 } 241 242 zen_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$default_address_id . "'"); 243 244 zen_redirect(zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')) . 'cID=' . $customers_id, 'NONSSL')); 245 246 } else if ($error == true) { 247 $cInfo = new objectInfo($_POST); 248 $processed = true; 249 } 250 251 break; 252 case 'deleteconfirm': 253 // demo active test 254 if (zen_admin_demo()) { 255 $_GET['action']= ''; 256 $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); 257 zen_redirect(zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')), 'NONSSL')); 258 } 259 260 if (isset($_POST['delete_reviews']) && ($_POST['delete_reviews'] == 'on')) { 261 $reviews = $db->Execute("select reviews_id 262 from " . TABLE_REVIEWS . " 263 where customers_id = '" . (int)$customers_id . "'"); 264 while (!$reviews->EOF) { 265 $db->Execute("delete from " . TABLE_REVIEWS_DESCRIPTION . " 266 where reviews_id = '" . (int)$reviews->fields['reviews_id'] . "'"); 267 $reviews->MoveNext(); 268 } 269 270 $db->Execute("delete from " . TABLE_REVIEWS . " 271 where customers_id = '" . (int)$customers_id . "'"); 272 } else { 273 $db->Execute("update " . TABLE_REVIEWS . " 274 set customers_id = null 275 where customers_id = '" . (int)$customers_id . "'"); 276 } 277 278 $db->Execute("delete from " . TABLE_ADDRESS_BOOK . " 279 where customers_id = '" . (int)$customers_id . "'"); 280 281 $db->Execute("delete from " . TABLE_CUSTOMERS . " 282 where customers_id = '" . (int)$customers_id . "'"); 283 284 $db->Execute("delete from " . TABLE_CUSTOMERS_INFO . " 285 where customers_info_id = '" . (int)$customers_id . "'"); 286 287 $db->Execute("delete from " . TABLE_CUSTOMERS_BASKET . " 288 where customers_id = '" . (int)$customers_id . "'"); 289 290 $db->Execute("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " 291 where customers_id = '" . (int)$customers_id . "'"); 292 293 $db->Execute("delete from " . TABLE_WHOS_ONLINE . " 294 where customer_id = '" . (int)$customers_id . "'"); 295 296 297 zen_redirect(zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')), 'NONSSL')); 298 break; 299 default: 300 $customers = $db->Execute("select c.customers_id, c.customers_gender, c.customers_firstname, 301 c.customers_lastname, c.customers_dob, c.customers_email_address, 302 a.entry_company, a.entry_street_address, a.entry_suburb, 303 a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, 304 a.entry_country_id, c.customers_telephone, c.customers_fax, 305 c.customers_newsletter, c.customers_default_address_id, 306 c.customers_email_format, c.customers_group_pricing, 307 c.customers_authorization, c.customers_referral 308 from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a 309 on c.customers_default_address_id = a.address_book_id 310 where a.customers_id = c.customers_id 311 and c.customers_id = '" . (int)$customers_id . "'"); 312 313 $cInfo = new objectInfo($customers->fields); 314 } 315 } 316 ?> 317 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 318 <html <?php echo HTML_PARAMS; ?>> 319 <head> 320 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 321 <title><?php echo TITLE; ?></title> 322 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 323 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 324 <script language="javascript" src="includes/menu.js"></script> 325 <script language="javascript" src="includes/general.js"></script> 326 <?php 327 if ($action == 'edit' || $action == 'update') { 328 ?> 329 <script language="javascript"><!-- 330 331 function check_form() { 332 var error = 0; 333 var error_message = "<?php echo JS_ERROR; ?>"; 334 335 var customers_firstname = document.customers.customers_firstname.value; 336 var customers_lastname = document.customers.customers_lastname.value; 337 <?php if (ACCOUNT_COMPANY == 'true') echo 'var entry_company = document.customers.entry_company.value;' . "\n"; ?> 338 <?php if (ACCOUNT_DOB == 'true') echo 'var customers_dob = document.customers.customers_dob.value;' . "\n"; ?> 339 var customers_email_address = document.customers.customers_email_address.value; 340 var entry_street_address = document.customers.entry_street_address.value; 341 var entry_postcode = document.customers.entry_postcode.value; 342 var entry_city = document.customers.entry_city.value; 343 var customers_telephone = document.customers.customers_telephone.value; 344 345 <?php if (ACCOUNT_GENDER == 'true') { ?> 346 if (document.customers.customers_gender[0].checked || document.customers.customers_gender[1].checked) { 347 } else { 348 error_message = error_message + "<?php echo JS_GENDER; ?>"; 349 error = 1; 350 } 351 <?php } ?> 352 353 if (customers_firstname == "" || customers_firstname.length < <?php echo ENTRY_FIRST_NAME_MIN_LENGTH; ?>) { 354 error_message = error_message + "<?php echo JS_FIRST_NAME; ?>"; 355 error = 1; 356 } 357 358 if (customers_lastname == "" || customers_lastname.length < <?php echo ENTRY_LAST_NAME_MIN_LENGTH; ?>) { 359 error_message = error_message + "<?php echo JS_LAST_NAME; ?>"; 360 error = 1; 361 } 362 363 <?php if (ACCOUNT_DOB == 'true' && ENTRY_DOB_MIN_LENGTH !='') { ?> 364 if (customers_dob == "" || customers_dob.length < <?php echo ENTRY_DOB_MIN_LENGTH; ?>) { 365 error_message = error_message + "<?php echo JS_DOB; ?>"; 366 error = 1; 367 } 368 <?php } ?> 369 370 if (customers_email_address == "" || customers_email_address.length < <?php echo ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>) { 371 error_message = error_message + "<?php echo JS_EMAIL_ADDRESS; ?>"; 372 error = 1; 373 } 374 375 if (entry_street_address == "" || entry_street_address.length < <?php echo ENTRY_STREET_ADDRESS_MIN_LENGTH; ?>) { 376 error_message = error_message + "<?php echo JS_ADDRESS; ?>"; 377 error = 1; 378 } 379 380 if (entry_postcode == "" || entry_postcode.length < <?php echo ENTRY_POSTCODE_MIN_LENGTH; ?>) { 381 error_message = error_message + "<?php echo JS_POST_CODE; ?>"; 382 error = 1; 383 } 384 385 if (entry_city == "" || entry_city.length < <?php echo ENTRY_CITY_MIN_LENGTH; ?>) { 386 error_message = error_message + "<?php echo JS_CITY; ?>"; 387 error = 1; 388 } 389 390 <?php 391 if (ACCOUNT_STATE == 'true') { 392 ?> 393 if (document.customers.elements['entry_state'].type != "hidden") { 394 if (document.customers.entry_state.value == '' || document.customers.entry_state.value.length < <?php echo ENTRY_STATE_MIN_LENGTH; ?> ) { 395 error_message = error_message + "<?php echo JS_STATE; ?>"; 396 error = 1; 397 } 398 } 399 <?php 400 } 401 ?> 402 403 if (document.customers.elements['entry_country_id'].type != "hidden") { 404 if (document.customers.entry_country_id.value == 0) { 405 error_message = error_message + "<?php echo JS_COUNTRY; ?>"; 406 error = 1; 407 } 408 } 409 410 if (customers_telephone == "" || customers_telephone.length < <?php echo ENTRY_TELEPHONE_MIN_LENGTH; ?>) { 411 error_message = error_message + "<?php echo JS_TELEPHONE; ?>"; 412 error = 1; 413 } 414 415 if (error == 1) { 416 alert(error_message); 417 return false; 418 } else { 419 return true; 420 } 421 } 422 //--></script> 423 <?php 424 } 425 ?> 426 <script type="text/javascript"> 427 <!-- 428 function init() 429 { 430 cssjsmenu('navbar'); 431 if (document.getElementById) 432 { 433 var kill = document.getElementById('hoverJS'); 434 kill.disabled = true; 435 } 436 } 437 // --> 438 </script> 439 </head> 440 <body onLoad="init()"> 441 <!-- header //--> 442 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 443 <!-- header_eof //--> 444 445 <!-- body //--> 446 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 447 <tr> 448 <!-- body_text //--> 449 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 450 <?php 451 if ($action == 'edit' || $action == 'update') { 452 $newsletter_array = array(array('id' => '1', 'text' => ENTRY_NEWSLETTER_YES), 453 array('id' => '0', 'text' => ENTRY_NEWSLETTER_NO)); 454 ?> 455 <tr> 456 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 457 <tr> 458 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 459 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 460 </tr> 461 </table></td> 462 </tr> 463 <tr> 464 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 465 </tr> 466 <tr><?php echo zen_draw_form('customers', FILENAME_CUSTOMERS, zen_get_all_get_params(array('action')) . 'action=update', 'post', 'onsubmit="return check_form(customers);"', true) . zen_draw_hidden_field('default_address_id', $cInfo->customers_default_address_id); 467 echo zen_hide_session_id(); ?> 468 <td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td> 469 </tr> 470 <tr> 471 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 472 <?php 473 if (ACCOUNT_GENDER == 'true') { 474 ?> 475 <tr> 476 <td class="main"><?php echo ENTRY_GENDER; ?></td> 477 <td class="main"> 478 <?php 479 if ($error == true && $entry_gender_error == true) { 480 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 . ' ' . ENTRY_GENDER_ERROR; 481 } else { 482 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; 483 } 484 ?></td> 485 </tr> 486 <?php 487 } 488 ?> 489 490 <?php 491 $customers_authorization_array = array(array('id' => '0', 'text' => CUSTOMERS_AUTHORIZATION_0), 492 array('id' => '1', 'text' => CUSTOMERS_AUTHORIZATION_1), 493 array('id' => '2', 'text' => CUSTOMERS_AUTHORIZATION_2), 494 array('id' => '3', 'text' => CUSTOMERS_AUTHORIZATION_3) 495 ); 496 // array('id' => '3', 'text' => CUSTOMERS_AUTHORIZATION_3) 497 498 ?> 499 <tr> 500 <td class="main"><?php echo CUSTOMERS_AUTHORIZATION; ?></td> 501 <td class="main"> 502 <?php echo zen_draw_pull_down_menu('customers_authorization', $customers_authorization_array, $cInfo->customers_authorization); ?> 503 </td> 504 </tr> 505 506 <tr> 507 <td class="main"><?php echo ENTRY_FIRST_NAME; ?></td> 508 <td class="main"> 509 <?php 510 if ($error == true) { 511 if ($entry_firstname_error == true) { 512 echo zen_draw_input_field('customers_firstname', $cInfo->customers_firstname, zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', 50)) . ' ' . ENTRY_FIRST_NAME_ERROR; 513 } else { 514 echo $cInfo->customers_firstname . zen_draw_hidden_field('customers_firstname'); 515 } 516 } else { 517 echo zen_draw_input_field('customers_firstname', $cInfo->customers_firstname, zen_set_field_length(TABLE_CUSTOMERS, 'customers_firstname', 50), true); 518 } 519 ?></td> 520 </tr> 521 <tr> 522 <td class="main"><?php echo ENTRY_LAST_NAME; ?></td> 523 <td class="main"> 524 <?php 525 if ($error == true) { 526 if ($entry_lastname_error == true) { 527 echo zen_draw_input_field('customers_lastname', $cInfo->customers_lastname, zen_set_field_length(TABLE_CUSTOMERS, 'customers_lastname', 50)) . ' ' . ENTRY_LAST_NAME_ERROR; 528 } else { 529 echo $cInfo->customers_lastname . zen_draw_hidden_field('customers_lastname'); 530 } 531 } else { 532 echo zen_draw_input_field('customers_lastname', $cInfo->customers_lastname, zen_set_field_length(TABLE_CUSTOMERS, 'customers_lastname', 50), true); 533 } 534 ?></td> 535 </tr> 536 <?php 537 if (ACCOUNT_DOB == 'true') { 538 ?> 539 <tr> 540 <td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td> 541 <td class="main"> 542 543 <?php 544 if ($error == true) { 545 if ($entry_date_of_birth_error == true) { 546 echo zen_draw_input_field('customers_dob', ($cInfo->customers_dob == '0001-01-01 00:00:00' ? '' : zen_date_short($cInfo->customers_dob)), 'maxlength="10"') . ' ' . ENTRY_DATE_OF_BIRTH_ERROR; 547 } else { 548 echo $cInfo->customers_dob . ($customers_dob == '0001-01-01 00:00:00' ? 'N/A' : zen_draw_hidden_field('customers_dob')); 549 } 550 } else { 551 echo zen_draw_input_field('customers_dob', ($customers_dob == '0001-01-01 00:00:00' ? '' : zen_date_short($cInfo->customers_dob)), 'maxlength="10"', true); 552 } 553 ?></td> 554 </tr> 555 <?php 556 } 557 ?> 558 <tr> 559 <td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td> 560 <td class="main"> 561 <?php 562 if ($error == true) { 563 if ($entry_email_address_error == true) { 564 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; 565 } elseif ($entry_email_address_check_error == true) { 566 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; 567 } elseif ($entry_email_address_exists == true) { 568 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; 569 } else { 570 echo $customers_email_address . zen_draw_hidden_field('customers_email_address'); 571 } 572 } else { 573 echo zen_draw_input_field('customers_email_address', $cInfo->customers_email_address, zen_set_field_length(TABLE_CUSTOMERS, 'customers_email_address', 50), true); 574 } 575 ?></td> 576 </tr> 577 </table></td> 578 </tr> 579 <?php 580 if (ACCOUNT_COMPANY == 'true') { 581 ?> 582 <tr> 583 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 584 </tr> 585 <tr> 586 <td class="formAreaTitle"><?php echo CATEGORY_COMPANY; ?></td> 587 </tr> 588 <tr> 589 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 590 <tr> 591 <td class="main"><?php echo ENTRY_COMPANY; ?></td> 592 <td class="main"> 593 <?php 594 if ($error == true) { 595 if ($entry_company_error == true) { 596 echo zen_draw_input_field('entry_company', $cInfo->entry_company, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_company', 50)) . ' ' . ENTRY_COMPANY_ERROR; 597 } else { 598 echo $cInfo->entry_company . zen_draw_hidden_field('entry_company'); 599 } 600 } else { 601 echo zen_draw_input_field('entry_company', $cInfo->entry_company, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_company', 50)); 602 } 603 ?></td> 604 </tr> 605 </table></td> 606 </tr> 607 <?php 608 } 609 ?> 610 <tr> 611 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 612 </tr> 613 <tr> 614 <td class="formAreaTitle"><?php echo CATEGORY_ADDRESS; ?></td> 615 </tr> 616 <tr> 617 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 618 <tr> 619 <td class="main"><?php echo ENTRY_STREET_ADDRESS; ?></td> 620 <td class="main"> 621 <?php 622 if ($error == true) { 623 if ($entry_street_address_error == true) { 624 echo zen_draw_input_field('entry_street_address', $cInfo->entry_street_address, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_street_address', 50)) . ' ' . ENTRY_STREET_ADDRESS_ERROR; 625 } else { 626 echo $cInfo->entry_street_address . zen_draw_hidden_field('entry_street_address'); 627 } 628 } else { 629 echo zen_draw_input_field('entry_street_address', $cInfo->entry_street_address, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_street_address', 50), true); 630 } 631 ?></td> 632 </tr> 633 <?php 634 if (ACCOUNT_SUBURB == 'true') { 635 ?> 636 <tr> 637 <td class="main"><?php echo ENTRY_SUBURB; ?></td> 638 <td class="main"> 639 <?php 640 if ($error == true) { 641 if ($entry_suburb_error == true) { 642 echo zen_draw_input_field('suburb', $cInfo->entry_suburb, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_suburb', 50)) . ' ' . ENTRY_SUBURB_ERROR; 643 } else { 644 echo $cInfo->entry_suburb . zen_draw_hidden_field('entry_suburb'); 645 } 646 } else { 647 echo zen_draw_input_field('entry_suburb', $cInfo->entry_suburb, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_suburb', 50)); 648 } 649 ?></td> 650 </tr> 651 <?php 652 } 653 ?> 654 <tr> 655 <td class="main"><?php echo ENTRY_POST_CODE; ?></td> 656 <td class="main"> 657 <?php 658 if ($error == true) { 659 if ($entry_post_code_error == true) { 660 echo zen_draw_input_field('entry_postcode', $cInfo->entry_postcode, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', 10)) . ' ' . ENTRY_POST_CODE_ERROR; 661 } else { 662 echo $cInfo->entry_postcode . zen_draw_hidden_field('entry_postcode'); 663 } 664 } else { 665 echo zen_draw_input_field('entry_postcode', $cInfo->entry_postcode, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_postcode', 10), true); 666 } 667 ?></td> 668 </tr> 669 <tr> 670 <td class="main"><?php echo ENTRY_CITY; ?></td> 671 <td class="main"> 672 <?php 673 if ($error == true) { 674 if ($entry_city_error == true) { 675 echo zen_draw_input_field('entry_city', $cInfo->entry_city, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_city', 50)) . ' ' . ENTRY_CITY_ERROR; 676 } else { 677 echo $cInfo->entry_city . zen_draw_hidden_field('entry_city'); 678 } 679 } else { 680 echo zen_draw_input_field('entry_city', $cInfo->entry_city, zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_city', 50), true); 681 } 682 ?></td> 683 </tr> 684 <?php 685 if (ACCOUNT_STATE == 'true') { 686 ?> 687 <tr> 688 <td class="main"><?php echo ENTRY_STATE; ?></td> 689 <td class="main"> 690 <?php 691 $entry_state = zen_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state); 692 if ($error == true) { 693 if ($entry_state_error == true) { 694 if ($entry_state_has_zones == true) { 695 $zones_array = array(); 696 $zones_values = $db->Execute("select zone_name 697 from " . TABLE_ZONES . " 698 where zone_country_id = '" . zen_db_input($cInfo->entry_country_id) . "' 699 order by zone_name"); 700 701 while (!$zones_values->EOF) { 702 $zones_array[] = array('id' => $zones_values->fields['zone_name'], 'text' => $zones_values->fields['zone_name']); 703 $zones_values->MoveNext(); 704 } 705 echo zen_draw_pull_down_menu('entry_state', $zones_array) . ' ' . ENTRY_STATE_ERROR; 706 } else { 707 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; 708 } 709 } else { 710 echo $entry_state . zen_draw_hidden_field('entry_zone_id') . zen_draw_hidden_field('entry_state'); 711 } 712 } else { 713 echo zen_draw_input_field('entry_state', zen_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)); 714 } 715 716 ?></td> 717 </tr> 718 <?php 719 } 720 ?> 721 <tr> 722 <td class="main"><?php echo ENTRY_COUNTRY; ?></td> 723 <td class="main"> 724 <?php 725 if ($error == true) { 726 if ($entry_country_error == true) { 727 echo zen_draw_pull_down_menu('entry_country_id', zen_get_countries(), $cInfo->entry_country_id) . ' ' . ENTRY_COUNTRY_ERROR; 728 } else { 729 echo zen_get_country_name($cInfo->entry_country_id) . zen_draw_hidden_field('entry_country_id'); 730 } 731 } else { 732 echo zen_draw_pull_down_menu('entry_country_id', zen_get_countries(), $cInfo->entry_country_id); 733 } 734 ?></td> 735 </tr> 736 </table></td> 737 </tr> 738 <tr> 739 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 740 </tr> 741 <tr> 742 <td class="formAreaTitle"><?php echo CATEGORY_CONTACT; ?></td> 743 </tr> 744 <tr> 745 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 746 <tr> 747 <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td> 748 <td class="main"> 749 <?php 750 if ($error == true) { 751 if ($entry_telephone_error == true) { 752 echo zen_draw_input_field('customers_telephone', $cInfo->customers_telephone, zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', 15)) . ' ' . ENTRY_TELEPHONE_NUMBER_ERROR; 753 } else { 754 echo $cInfo->customers_telephone . zen_draw_hidden_field('customers_telephone'); 755 } 756 } else { 757 echo zen_draw_input_field('customers_telephone', $cInfo->customers_telephone, zen_set_field_length(TABLE_CUSTOMERS, 'customers_telephone', 15), true); 758 } 759 ?></td> 760 </tr> 761 <tr> 762 <td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td> 763 <td class="main"> 764 <?php 765 if ($processed == true) { 766 echo $cInfo->customers_fax . zen_draw_hidden_field('customers_fax'); 767 } else { 768 echo zen_draw_input_field('customers_fax', $cInfo->customers_fax, zen_set_field_length(TABLE_CUSTOMERS, 'customers_fax', 15)); 769 } 770 ?></td> 771 </tr> 772 </table></td> 773 </tr> 774 <tr> 775 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 776 </tr> 777 <tr> 778 <td class="formAreaTitle"><?php echo CATEGORY_OPTIONS; ?></td> 779 </tr> 780 <tr> 781 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 782 783 <tr> 784 <td class="main"><?php echo ENTRY_EMAIL_PREFERENCE; ?></td> 785 <td class="main"> 786 <?php 787 if ($processed == true) { 788 if ($cInfo->customers_email_format) { 789 echo $customers_email_format . zen_draw_hidden_field('customers_email_format'); 790 } 791 } else { 792 $email_pref_text = ($cInfo->customers_email_format == 'TEXT') ? true : false; 793 $email_pref_html = !$email_pref_text; 794 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 ; 795 } 796 ?></td> 797 </tr> 798 <tr> 799 <td class="main"><?php echo ENTRY_NEWSLETTER; ?></td> 800 <td class="main"> 801 <?php 802 if ($processed == true) { 803 if ($cInfo->customers_newsletter == '1') { 804 echo ENTRY_NEWSLETTER_YES; 805 } else { 806 echo ENTRY_NEWSLETTER_NO; 807 } 808 echo zen_draw_hidden_field('customers_newsletter'); 809 } else { 810 echo zen_draw_pull_down_menu('customers_newsletter', $newsletter_array, (($cInfo->customers_newsletter == '1') ? '1' : '0')); 811 } 812 ?></td> 813 </tr> 814 <tr> 815 <td class="main"><?php echo ENTRY_PRICING_GROUP; ?></td> 816 <td class="main"> 817 <?php 818 if ($processed == true) { 819 if ($cInfo->customers_group_pricing) { 820 $group_query = $db->Execute("select group_name, group_percentage from " . TABLE_GROUP_PRICING . " where group_id = '" . $cInfo->customers_group_pricing . "'"); 821 echo $group_query->fields['group_name'].' '.$group_query->fields['group_percentage'].'%'; 822 } else { 823 echo ENTRY_NONE; 824 } 825 echo zen_draw_hidden_field('customers_group_pricing', $cInfo->customers_group_pricing); 826 } else { 827 $group_array_query = $db->execute("select group_id, group_name, group_percentage from " . TABLE_GROUP_PRICING); 828 $group_array[] = array('id'=>0, 'text'=>TEXT_NONE); 829 while (!$group_array_query->EOF) { 830 $group_array[] = array('id'=>$group_array_query->fields['group_id'], 'text'=>$group_array_query->fields['group_name'].' '.$group_array_query->fields['group_percentage'].'%'); 831 $group_array_query->MoveNext(); 832 } 833 echo zen_draw_pull_down_menu('customers_group_pricing', $group_array, $cInfo->customers_group_pricing); 834 } 835 ?></td> 836 </tr> 837 838 <tr> 839 <td class="main"><?php echo CUSTOMERS_REFERRAL; ?></td> 840 <td class="main"> 841 <?php echo zen_draw_input_field('customers_referral', $cInfo->customers_referral, zen_set_field_length(TABLE_CUSTOMERS, 'customers_referral', 15)); ?> 842 </td> 843 </tr> 844 </table></td> 845 </tr> 846 847 <tr> 848 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 849 </tr> 850 <tr> 851 <td align="right" class="main"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('action')), 'NONSSL') .'">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td> 852 </tr></form> 853 <?php 854 } else { 855 ?> 856 <tr> 857 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 858 <tr><?php echo zen_draw_form('search', FILENAME_CUSTOMERS, '', 'get', '', true); ?> 859 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 860 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 861 <td class="smallText" align="right"> 862 <?php 863 // show reset search 864 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 865 echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a> '; 866 } 867 echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id(); 868 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 869 $keywords = zen_db_input(zen_db_prepare_input($_GET['search'])); 870 echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords; 871 } 872 ?> 873 </td> 874 </form></tr> 875 </table></td> 876 </tr> 877 <tr> 878 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 879 <tr> 880 <?php 881 // Sort Listing 882 switch ($_GET['list_order']) { 883 case "id-asc": 884 $disp_order = "ci.customers_info_date_account_created"; 885 break; 886 case "firstname": 887 $disp_order = "c.customers_firstname"; 888 break; 889 case "firstname-desc": 890 $disp_order = "c.customers_firstname DESC"; 891 break; 892 case "group-asc": 893 $disp_order = "c.customers_group_pricing"; 894 break; 895 case "group-desc": 896 $disp_order = "c.customers_group_pricing DESC"; 897 break; 898 case "lastname": 899 $disp_order = "c.customers_lastname, c.customers_firstname"; 900 break; 901 case "lastname-desc": 902 $disp_order = "c.customers_lastname DESC, c.customers_firstname"; 903 break; 904 case "company": 905 $disp_order = "a.entry_company"; 906 break; 907 case "company-desc": 908 $disp_order = "a.entry_company DESC"; 909 break; 910 case "login-asc": 911 $disp_order = "ci.customers_info_date_of_last_logon"; 912 break; 913 case "login-desc": 914 $disp_order = "ci.customers_info_date_of_last_logon DESC"; 915 break; 916 case "approval-asc": 917 $disp_order = "c.customers_authorization"; 918 break; 919 case "approval-desc": 920 $disp_order = "c.customers_authorization DESC"; 921 break; 922 default: 923 $disp_order = "ci.customers_info_date_account_created DESC"; 924 } 925 ?> 926 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 927 <tr class="dataTableHeadingRow"> 928 <td class="dataTableHeadingContent" align="center" valign="top"> 929 <?php echo TABLE_HEADING_ID; ?> 930 </td> 931 <td class="dataTableHeadingContent" align="left"> 932 <?php echo (($_GET['list_order']=='lastname' or $_GET['list_order']=='lastname-desc') ? '<span class="SortOrderHeader">' . TABLE_HEADING_LASTNAME . '</span>' : TABLE_HEADING_LASTNAME); ?><br> 933 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=lastname', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='lastname' ? '<span class="SortOrderHeader">Asc</span>' : '<span class="SortOrderHeaderLink">Asc</b>'); ?></a> 934 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=lastname-desc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='lastname-desc' ? '<span class="SortOrderHeader">Desc</span>' : '<span class="SortOrderHeaderLink">Desc</b>'); ?></a> 935 </td> 936 <td class="dataTableHeadingContent" align="left"> 937 <?php echo (($_GET['list_order']=='firstname' or $_GET['list_order']=='firstname-desc') ? '<span class="SortOrderHeader">' . TABLE_HEADING_FIRSTNAME . '</span>' : TABLE_HEADING_FIRSTNAME); ?><br> 938 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=firstname', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='firstname' ? '<span class="SortOrderHeader">Asc</span>' : '<span class="SortOrderHeaderLink">Asc</b>'); ?></a> 939 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=firstname-desc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='firstname-desc' ? '<span class="SortOrderHeader">Desc</span>' : '<span class="SortOrderHeaderLink">Desc</span>'); ?></a> 940 </td> 941 <td class="dataTableHeadingContent" align="left"> 942 <?php echo (($_GET['list_order']=='company' or $_GET['list_order']=='company-desc') ? '<span class="SortOrderHeader">' . TABLE_HEADING_COMPANY . '</span>' : TABLE_HEADING_COMPANY); ?><br> 943 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=company', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='company' ? '<span class="SortOrderHeader">Asc</span>' : '<span class="SortOrderHeaderLink">Asc</b>'); ?></a> 944 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=company-desc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='company-desc' ? '<span class="SortOrderHeader">Desc</span>' : '<span class="SortOrderHeaderLink">Desc</b>'); ?></a> 945 </td> 946 <td class="dataTableHeadingContent" align="left"> 947 <?php echo (($_GET['list_order']=='id-asc' or $_GET['list_order']=='id-desc') ? '<span class="SortOrderHeader">' . TABLE_HEADING_ACCOUNT_CREATED . '</span>' : TABLE_HEADING_ACCOUNT_CREATED); ?><br> 948 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=id-asc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='id-asc' ? '<span class="SortOrderHeader">Asc</span>' : '<span class="SortOrderHeaderLink">Asc</b>'); ?></a> 949 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=id-desc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='id-desc' ? '<span class="SortOrderHeader">Desc</span>' : '<span class="SortOrderHeaderLink">Desc</b>'); ?></a> 950 </td> 951 952 <td class="dataTableHeadingContent" align="left"> 953 <?php echo (($_GET['list_order']=='login-asc' or $_GET['list_order']=='login-desc') ? '<span class="SortOrderHeader">' . TABLE_HEADING_LOGIN . '</span>' : TABLE_HEADING_LOGIN); ?><br> 954 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=login-asc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='login-asc' ? '<span class="SortOrderHeader">Asc</span>' : '<span class="SortOrderHeaderLink">Asc</b>'); ?></a> 955 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=login-desc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='login-desc' ? '<span class="SortOrderHeader">Desc</span>' : '<span class="SortOrderHeaderLink">Desc</b>'); ?></a> 956 </td> 957 958 <td class="dataTableHeadingContent" align="left"> 959 <?php echo (($_GET['list_order']=='group-asc' or $_GET['list_order']=='group-desc') ? '<span class="SortOrderHeader">' . TABLE_HEADING_PRICING_GROUP . '</span>' : TABLE_HEADING_PRICING_GROUP); ?><br> 960 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=group-asc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='group-asc' ? '<span class="SortOrderHeader">Asc</span>' : '<span class="SortOrderHeaderLink">Asc</b>'); ?></a> 961 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=group-desc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='group-desc' ? '<span class="SortOrderHeader">Desc</span>' : '<span class="SortOrderHeaderLink">Desc</b>'); ?></a> 962 </td> 963 964 <td class="dataTableHeadingContent" align="center"> 965 <?php echo (($_GET['list_order']=='approval-asc' or $_GET['list_order']=='approval-desc') ? '<span class="SortOrderHeader">' . TABLE_HEADING_AUTHORIZATION_APPROVAL . '</span>' : TABLE_HEADING_AUTHORIZATION_APPROVAL); ?><br> 966 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=approval-asc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='approval-asc' ? '<span class="SortOrderHeader">Asc</span>' : '<span class="SortOrderHeaderLink">Asc</b>'); ?></a> 967 <a href="<?php echo zen_href_link(basename($PHP_SELF) . '?list_order=approval-desc', '', 'NONSSL'); ?>"><?php echo ($_GET['list_order']=='approval-desc' ? '<span class="SortOrderHeader">Desc</span>' : '<span class="SortOrderHeaderLink">Desc</b>'); ?></a> 968 </td> 969 970 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 971 </tr> 972 <?php 973 $search = ''; 974 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 975 $keywords = zen_db_input(zen_db_prepare_input($_GET['search'])); 976 // $search = "where c.customers_lastname like '%" . $keywords . "%' or c.customers_firstname like '%" . $keywords . "%' or c.customers_email_address like '%" . $keywords . "%'"; 977 $search = "where c.customers_lastname like '%" . $keywords . "%' or c.customers_firstname like '%" . $keywords . "%' or c.customers_email_address like '%" . $keywords . "%' or c.customers_telephone rlike '" . $keywords . "' or a.entry_company rlike '" . $keywords . "' or a.entry_street_address rlike '" . $keywords . "' or a.entry_city rlike '" . $keywords . "' or a.entry_postcode rlike '" . $keywords . "'"; 978 } 979 $new_fields=', c.customers_telephone, a.entry_company, a.entry_street_address, a.entry_city, a.entry_postcode, c.customers_authorization, c.customers_referral'; 980 $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 . " 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 " . $search . " order by $disp_order"; 981 982 // Split Page 983 // reset page when page is unknown 984 if (($_GET['page'] == '' or $_GET['page'] == '1') and $_GET['cID'] != '') { 985 $check_page = $db->Execute($customers_query_raw); 986 $check_count=1; 987 if ($check_page->RecordCount() > MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER) { 988 while (!$check_page->EOF) { 989 if ($check_page->fields['customers_id'] == $_GET['cID']) { 990 break; 991 } 992 $check_count++; 993 $check_page->MoveNext(); 994 } 995 $_GET['page'] = round((($check_count/MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER)+(fmod_round($check_count,MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER) !=0 ? .5 : 0)),0); 996 // zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $_GET['cID'] . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''), 'NONSSL')); 997 } else { 998 $_GET['page'] = 1; 999 } 1000 } 1001 1002 $customers_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER, $customers_query_raw, $customers_query_numrows); 1003 $customers = $db->Execute($customers_query_raw); 1004 while (!$customers->EOF) { 1005 $info = $db->Execute("select customers_info_date_account_created as date_account_created, 1006 customers_info_date_account_last_modified as date_account_last_modified, 1007 customers_info_date_of_last_logon as date_last_logon, 1008 customers_info_number_of_logons as number_of_logons 1009 from " . TABLE_CUSTOMERS_INFO . " 1010 where customers_info_id = '" . $customers->fields['customers_id'] . "'"); 1011 1012 if ((!isset($_GET['cID']) || (isset($_GET['cID']) && ($_GET['cID'] == $customers->fields['customers_id']))) && !isset($cInfo)) { 1013 $country = $db->Execute("select countries_name 1014 from " . TABLE_COUNTRIES . " 1015 where countries_id = '" . (int)$customers->fields['entry_country_id'] . "'"); 1016 1017 $reviews = $db->Execute("select count(*) as number_of_reviews 1018 from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers->fields['customers_id'] . "'"); 1019 1020 $customer_info = array_merge($country->fields, $info->fields, $reviews->fields); 1021 1022 $cInfo_array = array_merge($customers->fields, $customer_info); 1023 $cInfo = new objectInfo($cInfo_array); 1024 } 1025 1026 $group_query = $db->Execute("select group_name, group_percentage from " . TABLE_GROUP_PRICING . " where 1027 group_id = '" . $customers->fields['customers_group_pricing'] . "'"); 1028 1029 if ($group_query->RecordCount() < 1) { 1030 $group_name_entry = TEXT_NONE; 1031 } else { 1032 $group_name_entry = $group_query->fields['group_name']; 1033 } 1034 1035 if (isset($cInfo) && is_object($cInfo) && ($customers->fields['customers_id'] == $cInfo->customers_id)) { 1036 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=edit', 'NONSSL') . '\'">' . "\n"; 1037 } else { 1038 echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID')) . 'cID=' . $customers->fields['customers_id'], 'NONSSL') . '\'">' . "\n"; 1039 } 1040 ?> 1041 <td class="dataTableContent" align="right"><?php echo $customers->fields['customers_id']; ?></td> 1042 <td class="dataTableContent"><?php echo $customers->fields['customers_lastname']; ?></td> 1043 <td class="dataTableContent"><?php echo $customers->fields['customers_firstname']; ?></td> 1044 <td class="dataTableContent"><?php echo $customers->fields['entry_company']; ?></td> 1045 <td class="dataTableContent"><?php echo zen_date_short($info->fields['date_account_created']); ?></td> 1046 <td class="dataTableContent"><?php echo zen_date_short($customers->fields['customers_info_date_of_last_logon']); ?></td> 1047 <td class="dataTableContent"><?php echo $group_name_entry; ?></td> 1048 <td class="dataTableContent" align="center"><?php echo ($customers->fields['customers_authorization'] == 0 ? '<a href="' . zen_href_link(FILENAME_CUSTOMERS, 'action=status¤t=' . $customers->fields['customers_authorization'] . '&cID=' . $customers->fields['customers_id'] . ($_GET['page'] > 0 ? '&page=' . $_GET['page'] : ''), 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_green_on.gif', IMAGE_ICON_STATUS_ON) . '</a>' : '<a href="' . zen_href_link(FILENAME_CUSTOMERS, 'action=status¤t=' . $customers->fields['customers_authorization'] . '&cID=' . $customers->fields['customers_id'] . ($_GET['page'] > 0 ? '&page=' . $_GET['page'] : ''), 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', IMAGE_ICON_STATUS_OFF) . '</a>'); ?></td> 1049 <td class="dataTableContent" align="right"><?php if (isset($cInfo) && is_object($cInfo) && ($customers->fields['customers_id'] == $cInfo->customers_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID')) . 'cID=' . $customers->fields['customers_id'] . ($_GET['page'] > 0 ? '&page=' . $_GET['page'] : ''), 'NONSSL') . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> 1050 </tr> 1051 <?php 1052 $customers->MoveNext(); 1053 } 1054 ?> 1055 <tr> 1056 <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 1057 <tr> 1058 <td class="smallText" valign="top"><?php echo $customers_split->display_count($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_CUSTOMER, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td> 1059 <td class="smallText" align="right"><?php echo $customers_split->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'))); ?></td> 1060 </tr> 1061 <?php 1062 if (isset($_GET['search']) && zen_not_null($_GET['search'])) { 1063 ?> 1064 <tr> 1065 <td align="right" colspan="2"><?php echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, '', 'NONSSL') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td> 1066 </tr> 1067 <?php 1068 } 1069 ?> 1070 </table></td> 1071 </tr> 1072 </table></td> 1073 <?php 1074 $heading = array(); 1075 $contents = array(); 1076 1077 switch ($action) { 1078 case 'confirm': 1079 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_CUSTOMER . '</b>'); 1080 1081 $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)); 1082 $contents[] = array('text' => TEXT_DELETE_INTRO . '<br><br><b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>'); 1083 if (isset($cInfo->number_of_reviews) && ($cInfo->number_of_reviews) > 0) $contents[] = array('text' => '<br />' . zen_draw_checkbox_field('delete_reviews', 'on', true) . ' ' . sprintf(TEXT_DELETE_REVIEWS, $cInfo->number_of_reviews)); 1084 $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id, 'NONSSL') . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 1085 break; 1086 default: 1087 if (isset($cInfo) && is_object($cInfo)) { 1088 $customers_orders = $db->Execute("select orders_id, date_purchased, order_total, currency, currency_value from " . TABLE_ORDERS . " where customers_id='" . $cInfo->customers_id . "' order by date_purchased desc"); 1089 1090 $heading[] = array('text' => '<b>' . TABLE_HEADING_ID . $cInfo->customers_id . ' ' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>'); 1091 1092 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_CUSTOMERS, zen_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=confirm', 'NONSSL') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a><br />' . ($customers_orders->RecordCount() != 0 ? '<a href="' . zen_href_link(FILENAME_ORDERS, 'cID=' . $cInfo->customers_id, 'NONSSL') . '">' . zen_image_button('button_orders.gif', IMAGE_ORDERS) . '</a>' : '') . ' <a href="' . zen_href_link(FILENAME_MAIL, 'origin=customers.php&mode=NONSSL&selected_box=tools&customer=' . $cInfo->customers_email_address.'&cID=' . $cInfo->customers_id, 'NONSSL') . '">' . zen_image_button('button_email.gif', IMAGE_EMAIL) . '</a>'); 1093 $contents[] = array('text' => '<br />' . TEXT_DATE_ACCOUNT_CREATED . ' ' . zen_date_short($cInfo->date_account_created)); 1094 $contents[] = array('text' => '<br />' . TEXT_DATE_ACCOUNT_LAST_MODIFIED . ' ' . zen_date_short($cInfo->date_account_last_modified)); 1095 $contents[] = array('text' => '<br />' . TEXT_INFO_DATE_LAST_LOGON . ' ' . zen_date_short($cInfo->date_last_logon)); 1096 $contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_LOGONS . ' ' . $cInfo->number_of_logons); 1097 $contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_ORDERS . ' ' . $customers_orders->RecordCount()); 1098 if ($customers_orders->RecordCount() != 0) { 1099 $contents[] = array('text' => TEXT_INFO_LAST_ORDER . ' ' . zen_date_short($customers_orders->fields['date_purchased']) . '<br />' . TEXT_INFO_ORDERS_TOTAL . ' ' . $currencies->format($customers_orders->fields['order_total'], true, $customers_orders->fields['currency'], $customers_orders->fields['currency_value'])); 1100 } 1101 $contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY . ' ' . $cInfo->countries_name); 1102 $contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_REVIEWS . ' ' . $cInfo->number_of_reviews); 1103 $contents[] = array('text' => '<br />' . CUSTOMERS_REFERRAL . ' ' . $cInfo->customers_referral); 1104 } 1105 break; 1106 } 1107 1108 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 1109 echo ' <td width="25%" valign="top">' . "\n"; 1110 1111 $box = new box; 1112 echo $box->infoBox($heading, $contents); 1113 1114 echo ' </td>' . "\n"; 1115 } 1116 ?> 1117 </tr> 1118 </table></td> 1119 </tr> 1120 <?php 1121 } 1122 ?> 1123 </table></td> 1124 <!-- body_text_eof //--> 1125 </tr> 1126 </table> 1127 <!-- body_eof //--> 1128 1129 <!-- footer //--> 1130 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 1131 <!-- footer_eof //--> 1132 <br> 1133 </body> 1134 </html> 1135 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |