[ Index ] |
|
Code source de osCommerce 2.2ms2-060817 |
1 <?php 2 /* 3 $Id: customers.php,v 1.82 2003/06/30 13:54:14 dgw_ Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2003 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 13 require ('includes/application_top.php'); 14 15 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); 16 17 $error = false; 18 $processed = false; 19 20 if (tep_not_null($action)) { 21 switch ($action) { 22 case 'update': 23 $customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']); 24 $customers_firstname = tep_db_prepare_input($HTTP_POST_VARS['customers_firstname']); 25 $customers_lastname = tep_db_prepare_input($HTTP_POST_VARS['customers_lastname']); 26 $customers_email_address = tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']); 27 $customers_telephone = tep_db_prepare_input($HTTP_POST_VARS['customers_telephone']); 28 $customers_fax = tep_db_prepare_input($HTTP_POST_VARS['customers_fax']); 29 $customers_newsletter = tep_db_prepare_input($HTTP_POST_VARS['customers_newsletter']); 30 31 $customers_gender = tep_db_prepare_input($HTTP_POST_VARS['customers_gender']); 32 $customers_dob = tep_db_prepare_input($HTTP_POST_VARS['customers_dob']); 33 34 $default_address_id = tep_db_prepare_input($HTTP_POST_VARS['default_address_id']); 35 $entry_street_address = tep_db_prepare_input($HTTP_POST_VARS['entry_street_address']); 36 $entry_suburb = tep_db_prepare_input($HTTP_POST_VARS['entry_suburb']); 37 $entry_postcode = tep_db_prepare_input($HTTP_POST_VARS['entry_postcode']); 38 $entry_city = tep_db_prepare_input($HTTP_POST_VARS['entry_city']); 39 $entry_country_id = tep_db_prepare_input($HTTP_POST_VARS['entry_country_id']); 40 41 $entry_company = tep_db_prepare_input($HTTP_POST_VARS['entry_company']); 42 $entry_state = tep_db_prepare_input($HTTP_POST_VARS['entry_state']); 43 if (isset($HTTP_POST_VARS['entry_zone_id'])) $entry_zone_id = tep_db_prepare_input($HTTP_POST_VARS['entry_zone_id']); 44 45 if (strlen($customers_firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) { 46 $error = true; 47 $entry_firstname_error = true; 48 } else { 49 $entry_firstname_error = false; 50 } 51 52 if (strlen($customers_lastname) < ENTRY_LAST_NAME_MIN_LENGTH) { 53 $error = true; 54 $entry_lastname_error = true; 55 } else { 56 $entry_lastname_error = false; 57 } 58 59 if (ACCOUNT_DOB == 'true') { 60 if (checkdate(substr(tep_date_raw($customers_dob), 4, 2), substr(tep_date_raw($customers_dob), 6, 2), substr(tep_date_raw($customers_dob), 0, 4))) { 61 $entry_date_of_birth_error = false; 62 } else { 63 $error = true; 64 $entry_date_of_birth_error = true; 65 } 66 } 67 68 if (strlen($customers_email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) { 69 $error = true; 70 $entry_email_address_error = true; 71 } else { 72 $entry_email_address_error = false; 73 } 74 75 if (!tep_validate_email($customers_email_address)) { 76 $error = true; 77 $entry_email_address_check_error = true; 78 } else { 79 $entry_email_address_check_error = false; 80 } 81 82 if (strlen($entry_street_address) < ENTRY_STREET_ADDRESS_MIN_LENGTH) { 83 $error = true; 84 $entry_street_address_error = true; 85 } else { 86 $entry_street_address_error = false; 87 } 88 89 if (strlen($entry_postcode) < ENTRY_POSTCODE_MIN_LENGTH) { 90 $error = true; 91 $entry_post_code_error = true; 92 } else { 93 $entry_post_code_error = false; 94 } 95 96 if (strlen($entry_city) < ENTRY_CITY_MIN_LENGTH) { 97 $error = true; 98 $entry_city_error = true; 99 } else { 100 $entry_city_error = false; 101 } 102 103 if ($entry_country_id == false) { 104 $error = true; 105 $entry_country_error = true; 106 } else { 107 $entry_country_error = false; 108 } 109 110 if (ACCOUNT_STATE == 'true') { 111 if ($entry_country_error == true) { 112 $entry_state_error = true; 113 } else { 114 $zone_id = 0; 115 $entry_state_error = false; 116 $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int)$entry_country_id . "'"); 117 $check_value = tep_db_fetch_array($check_query); 118 $entry_state_has_zones = ($check_value['total'] > 0); 119 if ($entry_state_has_zones == true) { 120 $zone_query = tep_db_query("select zone_id from " . TABLE_ZONES . " where zone_country_id = '" . (int)$entry_country_id . "' and zone_name = '" . tep_db_input($entry_state) . "'"); 121 if (tep_db_num_rows($zone_query) == 1) { 122 $zone_values = tep_db_fetch_array($zone_query); 123 $entry_zone_id = $zone_values['zone_id']; 124 } else { 125 $error = true; 126 $entry_state_error = true; 127 } 128 } else { 129 if ($entry_state == false) { 130 $error = true; 131 $entry_state_error = true; 132 } 133 } 134 } 135 } 136 137 if (strlen($customers_telephone) < ENTRY_TELEPHONE_MIN_LENGTH) { 138 $error = true; 139 $entry_telephone_error = true; 140 } else { 141 $entry_telephone_error = false; 142 } 143 144 $check_email = tep_db_query("select customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($customers_email_address) . "' and customers_id != '" . (int)$customers_id . "'"); 145 if (tep_db_num_rows($check_email)) { 146 $error = true; 147 $entry_email_address_exists = true; 148 } else { 149 $entry_email_address_exists = false; 150 } 151 152 if ($error == false) { 153 154 $sql_data_array = array('customers_firstname' => $customers_firstname, 155 'customers_lastname' => $customers_lastname, 156 'customers_email_address' => $customers_email_address, 157 'customers_telephone' => $customers_telephone, 158 'customers_fax' => $customers_fax, 159 'customers_newsletter' => $customers_newsletter); 160 161 if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $customers_gender; 162 if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($customers_dob); 163 164 tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "'"); 165 166 tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int)$customers_id . "'"); 167 168 if ($entry_zone_id > 0) $entry_state = ''; 169 170 $sql_data_array = array('entry_firstname' => $customers_firstname, 171 'entry_lastname' => $customers_lastname, 172 'entry_street_address' => $entry_street_address, 173 'entry_postcode' => $entry_postcode, 174 'entry_city' => $entry_city, 175 'entry_country_id' => $entry_country_id); 176 177 if (ACCOUNT_COMPANY == 'true') $sql_data_array['entry_company'] = $entry_company; 178 if (ACCOUNT_SUBURB == 'true') $sql_data_array['entry_suburb'] = $entry_suburb; 179 180 if (ACCOUNT_STATE == 'true') { 181 if ($entry_zone_id > 0) { 182 $sql_data_array['entry_zone_id'] = $entry_zone_id; 183 $sql_data_array['entry_state'] = ''; 184 } else { 185 $sql_data_array['entry_zone_id'] = '0'; 186 $sql_data_array['entry_state'] = $entry_state; 187 } 188 } 189 190 tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$default_address_id . "'"); 191 192 tep_redirect(tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $customers_id)); 193 194 } else if ($error == true) { 195 $cInfo = new objectInfo($HTTP_POST_VARS); 196 $processed = true; 197 } 198 199 break; 200 case 'deleteconfirm': 201 $customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']); 202 203 if (isset($HTTP_POST_VARS['delete_reviews']) && ($HTTP_POST_VARS['delete_reviews'] == 'on')) { 204 $reviews_query = tep_db_query("select reviews_id from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers_id . "'"); 205 while ($reviews = tep_db_fetch_array($reviews_query)) { 206 tep_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . (int)$reviews['reviews_id'] . "'"); 207 } 208 209 tep_db_query("delete from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers_id . "'"); 210 } else { 211 tep_db_query("update " . TABLE_REVIEWS . " set customers_id = null where customers_id = '" . (int)$customers_id . "'"); 212 } 213 214 tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "'"); 215 tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'"); 216 tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customers_id . "'"); 217 tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customers_id . "'"); 218 tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customers_id . "'"); 219 tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . (int)$customers_id . "'"); 220 221 tep_redirect(tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')))); 222 break; 223 default: 224 $customers_query = tep_db_query("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 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)$HTTP_GET_VARS['cID'] . "'"); 225 $customers = tep_db_fetch_array($customers_query); 226 $cInfo = new objectInfo($customers); 227 } 228 } 229 ?> 230 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 231 <html <?php echo HTML_PARAMS; ?>> 232 <head> 233 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 234 <title><?php echo TITLE; ?></title> 235 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 236 <script language="javascript" src="includes/general.js"></script> 237 <?php 238 if ($action == 'edit' || $action == 'update') { 239 ?> 240 <script language="javascript"><!-- 241 242 function check_form() { 243 var error = 0; 244 var error_message = "<?php echo JS_ERROR; ?>"; 245 246 var customers_firstname = document.customers.customers_firstname.value; 247 var customers_lastname = document.customers.customers_lastname.value; 248 <?php if (ACCOUNT_COMPANY == 'true') echo 'var entry_company = document.customers.entry_company.value;' . "\n"; ?> 249 <?php if (ACCOUNT_DOB == 'true') echo 'var customers_dob = document.customers.customers_dob.value;' . "\n"; ?> 250 var customers_email_address = document.customers.customers_email_address.value; 251 var entry_street_address = document.customers.entry_street_address.value; 252 var entry_postcode = document.customers.entry_postcode.value; 253 var entry_city = document.customers.entry_city.value; 254 var customers_telephone = document.customers.customers_telephone.value; 255 256 <?php if (ACCOUNT_GENDER == 'true') { ?> 257 if (document.customers.customers_gender[0].checked || document.customers.customers_gender[1].checked) { 258 } else { 259 error_message = error_message + "<?php echo JS_GENDER; ?>"; 260 error = 1; 261 } 262 <?php } ?> 263 264 if (customers_firstname == "" || customers_firstname.length < <?php echo ENTRY_FIRST_NAME_MIN_LENGTH; ?>) { 265 error_message = error_message + "<?php echo JS_FIRST_NAME; ?>"; 266 error = 1; 267 } 268 269 if (customers_lastname == "" || customers_lastname.length < <?php echo ENTRY_LAST_NAME_MIN_LENGTH; ?>) { 270 error_message = error_message + "<?php echo JS_LAST_NAME; ?>"; 271 error = 1; 272 } 273 274 <?php if (ACCOUNT_DOB == 'true') { ?> 275 if (customers_dob == "" || customers_dob.length < <?php echo ENTRY_DOB_MIN_LENGTH; ?>) { 276 error_message = error_message + "<?php echo JS_DOB; ?>"; 277 error = 1; 278 } 279 <?php } ?> 280 281 if (customers_email_address == "" || customers_email_address.length < <?php echo ENTRY_EMAIL_ADDRESS_MIN_LENGTH; ?>) { 282 error_message = error_message + "<?php echo JS_EMAIL_ADDRESS; ?>"; 283 error = 1; 284 } 285 286 if (entry_street_address == "" || entry_street_address.length < <?php echo ENTRY_STREET_ADDRESS_MIN_LENGTH; ?>) { 287 error_message = error_message + "<?php echo JS_ADDRESS; ?>"; 288 error = 1; 289 } 290 291 if (entry_postcode == "" || entry_postcode.length < <?php echo ENTRY_POSTCODE_MIN_LENGTH; ?>) { 292 error_message = error_message + "<?php echo JS_POST_CODE; ?>"; 293 error = 1; 294 } 295 296 if (entry_city == "" || entry_city.length < <?php echo ENTRY_CITY_MIN_LENGTH; ?>) { 297 error_message = error_message + "<?php echo JS_CITY; ?>"; 298 error = 1; 299 } 300 301 <?php 302 if (ACCOUNT_STATE == 'true') { 303 ?> 304 if (document.customers.elements['entry_state'].type != "hidden") { 305 if (document.customers.entry_state.value == '' || document.customers.entry_state.value.length < <?php echo ENTRY_STATE_MIN_LENGTH; ?> ) { 306 error_message = error_message + "<?php echo JS_STATE; ?>"; 307 error = 1; 308 } 309 } 310 <?php 311 } 312 ?> 313 314 if (document.customers.elements['entry_country_id'].type != "hidden") { 315 if (document.customers.entry_country_id.value == 0) { 316 error_message = error_message + "<?php echo JS_COUNTRY; ?>"; 317 error = 1; 318 } 319 } 320 321 if (customers_telephone == "" || customers_telephone.length < <?php echo ENTRY_TELEPHONE_MIN_LENGTH; ?>) { 322 error_message = error_message + "<?php echo JS_TELEPHONE; ?>"; 323 error = 1; 324 } 325 326 if (error == 1) { 327 alert(error_message); 328 return false; 329 } else { 330 return true; 331 } 332 } 333 //--></script> 334 <?php 335 } 336 ?> 337 </head> 338 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();"> 339 <!-- header //--> 340 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 341 <!-- header_eof //--> 342 343 <!-- body //--> 344 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 345 <tr> 346 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> 347 <!-- left_navigation //--> 348 <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> 349 <!-- left_navigation_eof //--> 350 </table></td> 351 <!-- body_text //--> 352 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 353 <?php 354 if ($action == 'edit' || $action == 'update') { 355 $newsletter_array = array(array('id' => '1', 'text' => ENTRY_NEWSLETTER_YES), 356 array('id' => '0', 'text' => ENTRY_NEWSLETTER_NO)); 357 ?> 358 <tr> 359 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 360 <tr> 361 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 362 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 363 </tr> 364 </table></td> 365 </tr> 366 <tr> 367 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 368 </tr> 369 <tr><?php echo tep_draw_form('customers', FILENAME_CUSTOMERS, tep_get_all_get_params(array('action')) . 'action=update', 'post', 'onSubmit="return check_form();"') . tep_draw_hidden_field('default_address_id', $cInfo->customers_default_address_id); ?> 370 <td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td> 371 </tr> 372 <tr> 373 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 374 <?php 375 if (ACCOUNT_GENDER == 'true') { 376 ?> 377 <tr> 378 <td class="main"><?php echo ENTRY_GENDER; ?></td> 379 <td class="main"> 380 <?php 381 if ($error == true) { 382 if ($entry_gender_error == true) { 383 echo tep_draw_radio_field('customers_gender', 'm', false, $cInfo->customers_gender) . ' ' . MALE . ' ' . tep_draw_radio_field('customers_gender', 'f', false, $cInfo->customers_gender) . ' ' . FEMALE . ' ' . ENTRY_GENDER_ERROR; 384 } else { 385 echo ($cInfo->customers_gender == 'm') ? MALE : FEMALE; 386 echo tep_draw_hidden_field('customers_gender'); 387 } 388 } else { 389 echo tep_draw_radio_field('customers_gender', 'm', false, $cInfo->customers_gender) . ' ' . MALE . ' ' . tep_draw_radio_field('customers_gender', 'f', false, $cInfo->customers_gender) . ' ' . FEMALE; 390 } 391 ?></td> 392 </tr> 393 <?php 394 } 395 ?> 396 <tr> 397 <td class="main"><?php echo ENTRY_FIRST_NAME; ?></td> 398 <td class="main"> 399 <?php 400 if ($error == true) { 401 if ($entry_firstname_error == true) { 402 echo tep_draw_input_field('customers_firstname', $cInfo->customers_firstname, 'maxlength="32"') . ' ' . ENTRY_FIRST_NAME_ERROR; 403 } else { 404 echo $cInfo->customers_firstname . tep_draw_hidden_field('customers_firstname'); 405 } 406 } else { 407 echo tep_draw_input_field('customers_firstname', $cInfo->customers_firstname, 'maxlength="32"', true); 408 } 409 ?></td> 410 </tr> 411 <tr> 412 <td class="main"><?php echo ENTRY_LAST_NAME; ?></td> 413 <td class="main"> 414 <?php 415 if ($error == true) { 416 if ($entry_lastname_error == true) { 417 echo tep_draw_input_field('customers_lastname', $cInfo->customers_lastname, 'maxlength="32"') . ' ' . ENTRY_LAST_NAME_ERROR; 418 } else { 419 echo $cInfo->customers_lastname . tep_draw_hidden_field('customers_lastname'); 420 } 421 } else { 422 echo tep_draw_input_field('customers_lastname', $cInfo->customers_lastname, 'maxlength="32"', true); 423 } 424 ?></td> 425 </tr> 426 <?php 427 if (ACCOUNT_DOB == 'true') { 428 ?> 429 <tr> 430 <td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td> 431 <td class="main"> 432 433 <?php 434 if ($error == true) { 435 if ($entry_date_of_birth_error == true) { 436 echo tep_draw_input_field('customers_dob', tep_date_short($cInfo->customers_dob), 'maxlength="10"') . ' ' . ENTRY_DATE_OF_BIRTH_ERROR; 437 } else { 438 echo $cInfo->customers_dob . tep_draw_hidden_field('customers_dob'); 439 } 440 } else { 441 echo tep_draw_input_field('customers_dob', tep_date_short($cInfo->customers_dob), 'maxlength="10"', true); 442 } 443 ?></td> 444 </tr> 445 <?php 446 } 447 ?> 448 <tr> 449 <td class="main"><?php echo ENTRY_EMAIL_ADDRESS; ?></td> 450 <td class="main"> 451 <?php 452 if ($error == true) { 453 if ($entry_email_address_error == true) { 454 echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"') . ' ' . ENTRY_EMAIL_ADDRESS_ERROR; 455 } elseif ($entry_email_address_check_error == true) { 456 echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"') . ' ' . ENTRY_EMAIL_ADDRESS_CHECK_ERROR; 457 } elseif ($entry_email_address_exists == true) { 458 echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"') . ' ' . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS; 459 } else { 460 echo $customers_email_address . tep_draw_hidden_field('customers_email_address'); 461 } 462 } else { 463 echo tep_draw_input_field('customers_email_address', $cInfo->customers_email_address, 'maxlength="96"', true); 464 } 465 ?></td> 466 </tr> 467 </table></td> 468 </tr> 469 <?php 470 if (ACCOUNT_COMPANY == 'true') { 471 ?> 472 <tr> 473 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 474 </tr> 475 <tr> 476 <td class="formAreaTitle"><?php echo CATEGORY_COMPANY; ?></td> 477 </tr> 478 <tr> 479 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 480 <tr> 481 <td class="main"><?php echo ENTRY_COMPANY; ?></td> 482 <td class="main"> 483 <?php 484 if ($error == true) { 485 if ($entry_company_error == true) { 486 echo tep_draw_input_field('entry_company', $cInfo->entry_company, 'maxlength="32"') . ' ' . ENTRY_COMPANY_ERROR; 487 } else { 488 echo $cInfo->entry_company . tep_draw_hidden_field('entry_company'); 489 } 490 } else { 491 echo tep_draw_input_field('entry_company', $cInfo->entry_company, 'maxlength="32"'); 492 } 493 ?></td> 494 </tr> 495 </table></td> 496 </tr> 497 <?php 498 } 499 ?> 500 <tr> 501 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 502 </tr> 503 <tr> 504 <td class="formAreaTitle"><?php echo CATEGORY_ADDRESS; ?></td> 505 </tr> 506 <tr> 507 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 508 <tr> 509 <td class="main"><?php echo ENTRY_STREET_ADDRESS; ?></td> 510 <td class="main"> 511 <?php 512 if ($error == true) { 513 if ($entry_street_address_error == true) { 514 echo tep_draw_input_field('entry_street_address', $cInfo->entry_street_address, 'maxlength="64"') . ' ' . ENTRY_STREET_ADDRESS_ERROR; 515 } else { 516 echo $cInfo->entry_street_address . tep_draw_hidden_field('entry_street_address'); 517 } 518 } else { 519 echo tep_draw_input_field('entry_street_address', $cInfo->entry_street_address, 'maxlength="64"', true); 520 } 521 ?></td> 522 </tr> 523 <?php 524 if (ACCOUNT_SUBURB == 'true') { 525 ?> 526 <tr> 527 <td class="main"><?php echo ENTRY_SUBURB; ?></td> 528 <td class="main"> 529 <?php 530 if ($error == true) { 531 if ($entry_suburb_error == true) { 532 echo tep_draw_input_field('suburb', $cInfo->entry_suburb, 'maxlength="32"') . ' ' . ENTRY_SUBURB_ERROR; 533 } else { 534 echo $cInfo->entry_suburb . tep_draw_hidden_field('entry_suburb'); 535 } 536 } else { 537 echo tep_draw_input_field('entry_suburb', $cInfo->entry_suburb, 'maxlength="32"'); 538 } 539 ?></td> 540 </tr> 541 <?php 542 } 543 ?> 544 <tr> 545 <td class="main"><?php echo ENTRY_POST_CODE; ?></td> 546 <td class="main"> 547 <?php 548 if ($error == true) { 549 if ($entry_post_code_error == true) { 550 echo tep_draw_input_field('entry_postcode', $cInfo->entry_postcode, 'maxlength="8"') . ' ' . ENTRY_POST_CODE_ERROR; 551 } else { 552 echo $cInfo->entry_postcode . tep_draw_hidden_field('entry_postcode'); 553 } 554 } else { 555 echo tep_draw_input_field('entry_postcode', $cInfo->entry_postcode, 'maxlength="8"', true); 556 } 557 ?></td> 558 </tr> 559 <tr> 560 <td class="main"><?php echo ENTRY_CITY; ?></td> 561 <td class="main"> 562 <?php 563 if ($error == true) { 564 if ($entry_city_error == true) { 565 echo tep_draw_input_field('entry_city', $cInfo->entry_city, 'maxlength="32"') . ' ' . ENTRY_CITY_ERROR; 566 } else { 567 echo $cInfo->entry_city . tep_draw_hidden_field('entry_city'); 568 } 569 } else { 570 echo tep_draw_input_field('entry_city', $cInfo->entry_city, 'maxlength="32"', true); 571 } 572 ?></td> 573 </tr> 574 <?php 575 if (ACCOUNT_STATE == 'true') { 576 ?> 577 <tr> 578 <td class="main"><?php echo ENTRY_STATE; ?></td> 579 <td class="main"> 580 <?php 581 $entry_state = tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state); 582 if ($error == true) { 583 if ($entry_state_error == true) { 584 if ($entry_state_has_zones == true) { 585 $zones_array = array(); 586 $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($cInfo->entry_country_id) . "' order by zone_name"); 587 while ($zones_values = tep_db_fetch_array($zones_query)) { 588 $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']); 589 } 590 echo tep_draw_pull_down_menu('entry_state', $zones_array) . ' ' . ENTRY_STATE_ERROR; 591 } else { 592 echo tep_draw_input_field('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)) . ' ' . ENTRY_STATE_ERROR; 593 } 594 } else { 595 echo $entry_state . tep_draw_hidden_field('entry_zone_id') . tep_draw_hidden_field('entry_state'); 596 } 597 } else { 598 echo tep_draw_input_field('entry_state', tep_get_zone_name($cInfo->entry_country_id, $cInfo->entry_zone_id, $cInfo->entry_state)); 599 } 600 601 ?></td> 602 </tr> 603 <?php 604 } 605 ?> 606 <tr> 607 <td class="main"><?php echo ENTRY_COUNTRY; ?></td> 608 <td class="main"> 609 <?php 610 if ($error == true) { 611 if ($entry_country_error == true) { 612 echo tep_draw_pull_down_menu('entry_country_id', tep_get_countries(), $cInfo->entry_country_id) . ' ' . ENTRY_COUNTRY_ERROR; 613 } else { 614 echo tep_get_country_name($cInfo->entry_country_id) . tep_draw_hidden_field('entry_country_id'); 615 } 616 } else { 617 echo tep_draw_pull_down_menu('entry_country_id', tep_get_countries(), $cInfo->entry_country_id); 618 } 619 ?></td> 620 </tr> 621 </table></td> 622 </tr> 623 <tr> 624 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 625 </tr> 626 <tr> 627 <td class="formAreaTitle"><?php echo CATEGORY_CONTACT; ?></td> 628 </tr> 629 <tr> 630 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 631 <tr> 632 <td class="main"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td> 633 <td class="main"> 634 <?php 635 if ($error == true) { 636 if ($entry_telephone_error == true) { 637 echo tep_draw_input_field('customers_telephone', $cInfo->customers_telephone, 'maxlength="32"') . ' ' . ENTRY_TELEPHONE_NUMBER_ERROR; 638 } else { 639 echo $cInfo->customers_telephone . tep_draw_hidden_field('customers_telephone'); 640 } 641 } else { 642 echo tep_draw_input_field('customers_telephone', $cInfo->customers_telephone, 'maxlength="32"', true); 643 } 644 ?></td> 645 </tr> 646 <tr> 647 <td class="main"><?php echo ENTRY_FAX_NUMBER; ?></td> 648 <td class="main"> 649 <?php 650 if ($processed == true) { 651 echo $cInfo->customers_fax . tep_draw_hidden_field('customers_fax'); 652 } else { 653 echo tep_draw_input_field('customers_fax', $cInfo->customers_fax, 'maxlength="32"'); 654 } 655 ?></td> 656 </tr> 657 </table></td> 658 </tr> 659 <tr> 660 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 661 </tr> 662 <tr> 663 <td class="formAreaTitle"><?php echo CATEGORY_OPTIONS; ?></td> 664 </tr> 665 <tr> 666 <td class="formArea"><table border="0" cellspacing="2" cellpadding="2"> 667 <tr> 668 <td class="main"><?php echo ENTRY_NEWSLETTER; ?></td> 669 <td class="main"> 670 <?php 671 if ($processed == true) { 672 if ($cInfo->customers_newsletter == '1') { 673 echo ENTRY_NEWSLETTER_YES; 674 } else { 675 echo ENTRY_NEWSLETTER_NO; 676 } 677 echo tep_draw_hidden_field('customers_newsletter'); 678 } else { 679 echo tep_draw_pull_down_menu('customers_newsletter', $newsletter_array, (($cInfo->customers_newsletter == '1') ? '1' : '0')); 680 } 681 ?></td> 682 </tr> 683 </table></td> 684 </tr> 685 <tr> 686 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> 687 </tr> 688 <tr> 689 <td align="right" class="main"><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE) . ' <a href="' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('action'))) .'">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td> 690 </tr></form> 691 <?php 692 } else { 693 ?> 694 <tr> 695 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 696 <tr><?php echo tep_draw_form('search', FILENAME_CUSTOMERS, '', 'get'); ?> 697 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 698 <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td> 699 <td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search'); ?></td> 700 </form></tr> 701 </table></td> 702 </tr> 703 <tr> 704 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 705 <tr> 706 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 707 <tr class="dataTableHeadingRow"> 708 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LASTNAME; ?></td> 709 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_FIRSTNAME; ?></td> 710 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACCOUNT_CREATED; ?></td> 711 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 712 </tr> 713 <?php 714 $search = ''; 715 if (isset($HTTP_GET_VARS['search']) && tep_not_null($HTTP_GET_VARS['search'])) { 716 $keywords = tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['search'])); 717 $search = "where c.customers_lastname like '%" . $keywords . "%' or c.customers_firstname like '%" . $keywords . "%' or c.customers_email_address like '%" . $keywords . "%'"; 718 } 719 $customers_query_raw = "select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, a.entry_country_id from " . TABLE_CUSTOMERS . " c 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 c.customers_lastname, c.customers_firstname"; 720 $customers_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $customers_query_raw, $customers_query_numrows); 721 $customers_query = tep_db_query($customers_query_raw); 722 while ($customers = tep_db_fetch_array($customers_query)) { 723 $info_query = tep_db_query("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['customers_id'] . "'"); 724 $info = tep_db_fetch_array($info_query); 725 726 if ((!isset($HTTP_GET_VARS['cID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $customers['customers_id']))) && !isset($cInfo)) { 727 $country_query = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . (int)$customers['entry_country_id'] . "'"); 728 $country = tep_db_fetch_array($country_query); 729 730 $reviews_query = tep_db_query("select count(*) as number_of_reviews from " . TABLE_REVIEWS . " where customers_id = '" . (int)$customers['customers_id'] . "'"); 731 $reviews = tep_db_fetch_array($reviews_query); 732 733 $customer_info = array_merge($country, $info, $reviews); 734 735 $cInfo_array = array_merge($customers, $customer_info); 736 $cInfo = new objectInfo($cInfo_array); 737 } 738 739 if (isset($cInfo) && is_object($cInfo) && ($customers['customers_id'] == $cInfo->customers_id)) { 740 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=edit') . '\'">' . "\n"; 741 } else { 742 echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID')) . 'cID=' . $customers['customers_id']) . '\'">' . "\n"; 743 } 744 ?> 745 <td class="dataTableContent"><?php echo $customers['customers_lastname']; ?></td> 746 <td class="dataTableContent"><?php echo $customers['customers_firstname']; ?></td> 747 <td class="dataTableContent" align="right"><?php echo tep_date_short($info['date_account_created']); ?></td> 748 <td class="dataTableContent" align="right"><?php if (isset($cInfo) && is_object($cInfo) && ($customers['customers_id'] == $cInfo->customers_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID')) . 'cID=' . $customers['customers_id']) . '">' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> </td> 749 </tr> 750 <?php 751 } 752 ?> 753 <tr> 754 <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 755 <tr> 756 <td class="smallText" valign="top"><?php echo $customers_split->display_count($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $HTTP_GET_VARS['page'], TEXT_DISPLAY_NUMBER_OF_CUSTOMERS); ?></td> 757 <td class="smallText" align="right"><?php echo $customers_split->display_links($customers_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $HTTP_GET_VARS['page'], tep_get_all_get_params(array('page', 'info', 'x', 'y', 'cID'))); ?></td> 758 </tr> 759 <?php 760 if (isset($HTTP_GET_VARS['search']) && tep_not_null($HTTP_GET_VARS['search'])) { 761 ?> 762 <tr> 763 <td align="right" colspan="2"><?php echo '<a href="' . tep_href_link(FILENAME_CUSTOMERS) . '">' . tep_image_button('button_reset.gif', IMAGE_RESET) . '</a>'; ?></td> 764 </tr> 765 <?php 766 } 767 ?> 768 </table></td> 769 </tr> 770 </table></td> 771 <?php 772 $heading = array(); 773 $contents = array(); 774 775 switch ($action) { 776 case 'confirm': 777 $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_CUSTOMER . '</b>'); 778 779 $contents = array('form' => tep_draw_form('customers', FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=deleteconfirm')); 780 $contents[] = array('text' => TEXT_DELETE_INTRO . '<br><br><b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>'); 781 if (isset($cInfo->number_of_reviews) && ($cInfo->number_of_reviews) > 0) $contents[] = array('text' => '<br>' . tep_draw_checkbox_field('delete_reviews', 'on', true) . ' ' . sprintf(TEXT_DELETE_REVIEWS, $cInfo->number_of_reviews)); 782 $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 783 break; 784 default: 785 if (isset($cInfo) && is_object($cInfo)) { 786 $heading[] = array('text' => '<b>' . $cInfo->customers_firstname . ' ' . $cInfo->customers_lastname . '</b>'); 787 788 $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=edit') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action')) . 'cID=' . $cInfo->customers_id . '&action=confirm') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_ORDERS, 'cID=' . $cInfo->customers_id) . '">' . tep_image_button('button_orders.gif', IMAGE_ORDERS) . '</a> <a href="' . tep_href_link(FILENAME_MAIL, 'selected_box=tools&customer=' . $cInfo->customers_email_address) . '">' . tep_image_button('button_email.gif', IMAGE_EMAIL) . '</a>'); 789 $contents[] = array('text' => '<br>' . TEXT_DATE_ACCOUNT_CREATED . ' ' . tep_date_short($cInfo->date_account_created)); 790 $contents[] = array('text' => '<br>' . TEXT_DATE_ACCOUNT_LAST_MODIFIED . ' ' . tep_date_short($cInfo->date_account_last_modified)); 791 $contents[] = array('text' => '<br>' . TEXT_INFO_DATE_LAST_LOGON . ' ' . tep_date_short($cInfo->date_last_logon)); 792 $contents[] = array('text' => '<br>' . TEXT_INFO_NUMBER_OF_LOGONS . ' ' . $cInfo->number_of_logons); 793 $contents[] = array('text' => '<br>' . TEXT_INFO_COUNTRY . ' ' . $cInfo->countries_name); 794 $contents[] = array('text' => '<br>' . TEXT_INFO_NUMBER_OF_REVIEWS . ' ' . $cInfo->number_of_reviews); 795 } 796 break; 797 } 798 799 if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) { 800 echo ' <td width="25%" valign="top">' . "\n"; 801 802 $box = new box; 803 echo $box->infoBox($heading, $contents); 804 805 echo ' </td>' . "\n"; 806 } 807 ?> 808 </tr> 809 </table></td> 810 </tr> 811 <?php 812 } 813 ?> 814 </table></td> 815 <!-- body_text_eof //--> 816 </tr> 817 </table> 818 <!-- body_eof //--> 819 820 <!-- footer //--> 821 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 822 <!-- footer_eof //--> 823 <br> 824 </body> 825 </html> 826 <?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 19:48:25 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |