[TEP-COMMIT] [CVS catalog] the new address book pages based on a CSS layout, and a new address_book
hpdl-OfajU3CKLf1/[email protected] 29 Mar 2005 23:33:02 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
<html>
<head>
<style><!--
body {background-color:#ffffff;}
.file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
.pathname {font-family:monospace; float:right;}
.fileheader {margin-bottom:.5em;}
.diff {margin:0;}
.tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
.tasklist ul {margin-top:0;margin-bottom:0;}
tr.alt {background-color:#eeeeee}
#added {background-color:#ddffdd;}
#addedchars {background-color:#99ff99;font-weight:bolder;}
tr.alt #added {background-color:#ccf7cc;}
#removed {background-color:#ffdddd;}
#removedchars {background-color:#ff9999;font-weight:bolder;}
tr.alt #removed {background-color:#f7cccc;}
#info {color:#888888;}
#context {background-color:#eeeeee;}
td {padding-left:.3em;padding-right:.3em;}
tr.head {border-bottom-width:1px;border-bottom-style:solid;}
tr.head td {padding:0;padding-top:.2em;}
.task {background-color:#ffff00;}
.comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
.error {color:red;}
hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>catalog/catalog/includes</tt></b><span id="info"> on MAIN</span></td></tr>
<tr><td><tt>content/pages/<a href="#file1"><span id="added">address_book.php</span></a></tt></td><td align="right" id="added">+101</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/address_book.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt> /<a href="#file2"><span id="added">address_book_delete.php</span></a></tt></td><td align="right" id="added">+76</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/address_book_delete.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td><tt> /<a href="#file3"><span id="added">address_book_process.php</span></a></tt></td><td align="right" id="added">+97</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/address_book_process.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr class="alt"><td><tt>modules/account/<a href="#file4"><span id="added">address_book.php</span></a></tt></td><td align="right" id="added">+242</td><td></td><td nowrap="nowrap" align="right">added <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/account/address_book.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></td></tr>
<tr><td></td><td align="right" id="added">+516</td><td></td><td></td></tr>
</table>
<small id="info">4 added files</small><br />
<pre class="comment">
the new address book pages based on a CSS layout, and a new address_book
account module to handle the related processing logic
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname" id="added"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content">content</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages">pages</a><br /></span>
<div class="fileheader" id="added"><big><b>address_book.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/address_book.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N address_book.php
--- /dev/null Wed Mar 30 01:32:48 2005
+++ /tmp/cvsAAAFWaijy Wed Mar 30 01:32:56 2005
@@ -0,0 +1,101 @@
</small></pre><pre class="diff" id="added">+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2005 osCommerce
+
+ Released under the GNU General Public License
+*/
+?>
+
+<div class="pageHeading">
+ <span class="pageHeadingImage"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_address_book.gif', HEADING_TITLE_ADDRESS_BOOK, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></span>
+
+ <h1><?php echo HEADING_TITLE_ADDRESS_BOOK; ?></h1>
+</div>
+
+<?php
+ if ($messageStack->size('address_book') > 0) {
+ echo $messageStack->output('address_book');
+ }
+?>
+
+<div class="moduleBox">
+ <div class="outsideHeading"><?php echo PRIMARY_ADDRESS_TITLE; ?></div>
+
+ <div class="content">
+ <div style="float: right; padding: 0px 0px 10px 20px;">
+ <?php echo tep_address_label($osC_Customer->id, $osC_Customer->default_address_id, true, ' ', '<br>'); ?>
+ </div>
+
+ <div style="float: right; padding: 0px 0px 10px 20px; text-align: center;">
+ <?php echo '<b>' . PRIMARY_ADDRESS_TITLE . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?>
+ </div>
+
+ <?php echo PRIMARY_ADDRESS_DESCRIPTION; ?>
+ </div>
+</div>
+
+<?php
+ $Qaddresses = $osC_Database->query('select address_book_id, entry_firstname as firstname, entry_lastname as lastname, entry_company as company, entry_street_address as street_address, entry_suburb as suburb, entry_city as city, entry_postcode as postcode, entry_state as state, entry_zone_id as zone_id, entry_country_id as country_id from :table_address_book where customers_id = :customers_id order by firstname, lastname');
+ $Qaddresses->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+ $Qaddresses->bindInt(':customers_id', $osC_Customer->id);
+ $Qaddresses->execute();
+?>
+
+<div class="moduleBox">
+ <div class="outsideHeading"><?php echo ADDRESS_BOOK_TITLE; ?></div>
+
+ <div class="content">
+ <table border="0" width="100%" cellspacing="0" cellpadding="2">
+
+<?php
+ $counter = 0;
+
+ while ($Qaddresses->next()) {
+ $counter++;
+
+ $format_id = tep_get_address_format_id($Qaddresses->valueInt('country_id'));
+?>
+
+ <tr class="moduleRow" onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);">
+ <td>
+ <b><?php echo $Qaddresses->valueProtected('firstname') . ' ' . $Qaddresses->valueProtected('lastname'); ?></b>
+
+<?php
+ if ($Qaddresses->valueInt('address_book_id') == $osC_Customer->default_address_id) {
+ echo '&nbsp;<small><i>' . PRIMARY_ADDRESS . '</i></small>';
+ }
+?>
+
+ </td>
+ <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'address_book=' . $Qaddresses->valueInt('address_book_id') . '&edit', 'SSL') . '">' . tep_image_button('small_edit.gif', SMALL_IMAGE_BUTTON_EDIT) . '</a>&nbsp;<a href="' . tep_href_link(FILENAME_ACCOUNT, 'address_book=' . $Qaddresses->valueInt('address_book_id') . '&delete', 'SSL') . '">' . tep_image_button('small_delete.gif', SMALL_IMAGE_BUTTON_DELETE) . '</a>'; ?></td>
+ </tr>
+ <tr>
+ <td colspan="2" style="padding: 0px 0px 10px 10px;"><?php echo tep_address_format($format_id, $Qaddresses->toArray(), true, ' ', '<br>'); ?></td>
+ </tr>
+
+<?php
+ }
+?>
+
+ </table>
+ </div>
+</div>
+
+<div class="submitFormButtons">
+ <span style="float: right;">
+<?php
+ if ($counter < MAX_ADDRESS_BOOK_ENTRIES) {
+ echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'address_book&new', 'SSL') . '">' . tep_image_button('button_add_address.gif', IMAGE_BUTTON_ADD_ADDRESS) . '</a>';
+ } else {
+ echo sprintf(TEXT_MAXIMUM_ENTRIES, MAX_ADDRESS_BOOK_ENTRIES);
+ }
+?>
+ </span>
+
+ <?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?>
+</div>
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname" id="added"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content">content</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages">pages</a><br /></span>
<div class="fileheader" id="added"><big><b>address_book_delete.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/address_book_delete.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N address_book_delete.php
--- /dev/null Wed Mar 30 01:32:48 2005
+++ /tmp/cvsAAAr2a4jy Wed Mar 30 01:32:57 2005
@@ -0,0 +1,76 @@
</small></pre><pre class="diff" id="added">+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2005 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ if ($_GET['address_book'] == $osC_Customer->default_address_id) {
+ $messageStack->add('address_book', WARNING_PRIMARY_ADDRESS_DELETION, 'warning');
+ } else {
+ $Qcheck = $osC_Database->query('select count(*) as total from :table_address_book where address_book_id = :address_book_id and customers_id = :customers_id');
+ $Qcheck->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+ $Qcheck->bindInt(':address_book_id', $_GET['address_book']);
+ $Qcheck->bindInt(':customers_id', $osC_Customer->id);
+ $Qcheck->execute();
+
+ if ($Qcheck->valueInt('total') < 1) {
+ $messageStack->add('address_book', ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY, 'error');
+ }
+ }
+?>
+
+<div class="pageHeading">
+ <span class="pageHeadingImage"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_address_book.gif', HEADING_TITLE_ADDRESS_BOOK_DELETE_ENTRY, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></span>
+
+ <h1><?php echo HEADING_TITLE_ADDRESS_BOOK_DELETE_ENTRY; ?></h1>
+</div>
+
+<?php
+ if ($messageStack->size('address_book') > 0) {
+ echo $messageStack->output('address_book');
+ }
+
+ if ( ($_GET['address_book'] != $osC_Customer->default_address_id) && ($Qcheck->valueInt('total') === 1) ) {
+?>
+
+<div class="moduleBox">
+ <div class="outsideHeading"><?php echo DELETE_ADDRESS_TITLE; ?></div>
+
+ <div class="content">
+ <div style="float: right; padding: 0px 0px 10px 20px;">
+ <?php echo tep_address_label($osC_Customer->id, $_GET['address_book'], true, ' ', '<br>'); ?>
+ </div>
+
+ <div style="float: right; padding: 0px 0px 10px 20px; text-align: center;">
+ <?php echo '<b>' . SELECTED_ADDRESS . '</b><br>' . tep_image(DIR_WS_IMAGES . 'arrow_south_east.gif'); ?>
+ </div>
+
+ <?php echo DELETE_ADDRESS_DESCRIPTION; ?>
+
+ <div style="clear: both;"></div>
+ </div>
+</div>
+
+<div class="submitFormButtons">
+ <span style="float: right;"><?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'address_book=' . $_GET['address_book'] . '&delete=confirm', 'SSL') . '">' . tep_image_button('button_delete.gif', IMAGE_BUTTON_DELETE) . '</a>'; ?></span>
+
+ <?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'address_book', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?>
+</div>
+
+<?php
+ } else {
+?>
+
+<div class="submitFormButtons">
+ <?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'address_book', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?>
+</div>
+
+<?php
+ }
+?>
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname" id="added"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content">content</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages">pages</a><br /></span>
<div class="fileheader" id="added"><big><b>address_book_process.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/content/pages/address_book_process.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N address_book_process.php
--- /dev/null Wed Mar 30 01:32:48 2005
+++ /tmp/cvsAAAu_aqky Wed Mar 30 01:32:57 2005
@@ -0,0 +1,97 @@
</small></pre><pre class="diff" id="added">+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2005 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ if (isset($_GET['edit'])) {
+ $Qentry = $osC_Database->query('select entry_gender, entry_company, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_zone_id, entry_country_id, entry_telephone, entry_fax from :table_address_book where customers_id = :customers_id and address_book_id = :address_book_id');
+ $Qentry->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+ $Qentry->bindInt(':customers_id', $osC_Customer->id);
+ $Qentry->bindInt(':address_book_id', $_GET['address_book']);
+ $Qentry->execute();
+
+ if ($Qentry->numberOfRows() < 1) {
+ $messageStack->add('address_book', ERROR_NONEXISTING_ADDRESS_BOOK_ENTRY, 'error');
+ }
+
+ $page_heading_title = HEADING_TITLE_ADDRESS_BOOK_EDIT_ENTRY;
+ } else {
+ if (($counter = tep_count_customer_address_book_entries()) >= MAX_ADDRESS_BOOK_ENTRIES) {
+ $messageStack->add('address_book', ERROR_ADDRESS_BOOK_FULL);
+ }
+
+ $page_heading_title = HEADING_TITLE_ADDRESS_BOOK_ADD_ENTRY;
+ }
+
+ require('includes/form_check.js.php');
+?>
+
+<div class="pageHeading">
+ <span class="pageHeadingImage"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_address_book.gif', $page_heading_title, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></span>
+
+ <h1><?php echo $page_heading_title; ?></h1>
+</div>
+
+<?php
+ if ($messageStack->size('address_book') > 0) {
+ echo $messageStack->output('address_book');
+ }
+
+ if ( ($osC_Customer->hasDefaultAddress() === false) || (isset($_GET['new']) && ($counter < MAX_ADDRESS_BOOK_ENTRIES)) || (isset($Qentry) && ($Qentry->numberOfRows() === 1)) ) {
+?>
+
+<form name="address_book" action="<?php echo tep_href_link(FILENAME_ACCOUNT, 'address_book=' . $_GET['address_book'] . '&' . (isset($_GET['edit']) ? 'edit' : 'new') . '=save', 'SSL'); ?>" method="post" onSubmit="return check_form(address_book);">
+
+<div class="moduleBox">
+ <div class="outsideHeading">
+ <span class="inputRequirement" style="float: right;"><?php echo FORM_REQUIRED_INFORMATION; ?></span>
+
+ <?php echo NEW_ADDRESS_TITLE; ?>
+ </div>
+
+ <div class="content">
+
+<?php
+ require('includes/modules/address_book_details.php');
+?>
+
+ </div>
+</div>
+
+<div class="submitFormButtons">
+ <span style="float: right;"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></span>
+
+<?php
+ if (sizeof($navigation->snapshot) > 0) {
+ $back_link = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array($osC_Session->name)), $navigation->snapshot['mode']);
+ } elseif ($osC_Customer->hasDefaultAddress() === false) {
+ $back_link = tep_href_link(FILENAME_ACCOUNT, '', 'SSL');
+ } else {
+ $back_link = tep_href_link(FILENAME_ACCOUNT, 'address_book', 'SSL');
+ }
+
+ echo '<a href="' . $back_link . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>';
+?>
+
+</div>
+
+</form>
+
+<?php
+ } else {
+?>
+
+<div class="submitFormButtons">
+ <?php echo '<a href="' . tep_href_link(FILENAME_ACCOUNT, 'address_book', 'SSL') . '">' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>'; ?>
+</div>
+
+<?php
+ }
+?>
</pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname" id="added"><a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog">catalog</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes">includes</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules">modules</a>/<a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/account">account</a><br /></span>
<div class="fileheader" id="added"><big><b>address_book.php</b></big> <small id="info">added at <a href="http://cvs.oscommerce.com/viewcvs.cgi/catalog/catalog/includes/modules/account/address_book.php?rev=1.1&content-type=text/vnd.viewcvs-markup">1.1</a></small></div>
<pre class="diff"><small id="info">diff -N address_book.php
--- /dev/null Wed Mar 30 01:32:48 2005
+++ /tmp/cvsAAAlkaqly Wed Mar 30 01:32:58 2005
@@ -0,0 +1,242 @@
</small></pre><pre class="diff" id="added">+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2005 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ class osC_Account_Address_book {
+
+/* Public variables */
+
+ var $page_contents = 'address_book.php';
+
+/* Private variables */
+
+ var $_module = 'address_book';
+
+/* Class constructor */
+
+ function osC_Account_Address_book() {
+ global $osC_Services, $breadcrumb, $osC_Customer;
+
+ if ($osC_Services->isStarted('breadcrumb')) {
+ $breadcrumb->add(NAVBAR_TITLE_ADDRESS_BOOK, tep_href_link(FILENAME_ACCOUNT, $this->_module, 'SSL'));
+ }
+
+ if ($osC_Customer->hasDefaultAddress() === false) {
+ $this->page_contents = 'address_book_process.php';
+ } elseif (isset($_GET['new'])) {
+ if ($osC_Services->isStarted('breadcrumb')) {
+ $breadcrumb->add(NAVBAR_TITLE_ADDRESS_BOOK_ADD_ENTRY, tep_href_link(FILENAME_ACCOUNT, $this->_module . '&new', 'SSL'));
+ }
+
+ $this->page_contents = 'address_book_process.php';
+ } elseif (isset($_GET['edit']) && is_numeric($_GET[$this->_module])) {
+ if ($osC_Services->isStarted('breadcrumb')) {
+ $breadcrumb->add(NAVBAR_TITLE_ADDRESS_BOOK_EDIT_ENTRY, tep_href_link(FILENAME_ACCOUNT, $this->_module . '=' . $_GET[$this->_module] . '&edit', 'SSL'));
+ }
+
+ $this->page_contents = 'address_book_process.php';
+ } elseif (isset($_GET['delete']) && is_numeric($_GET[$this->_module])) {
+ if ($osC_Services->isStarted('breadcrumb')) {
+ $breadcrumb->add(NAVBAR_TITLE_ADDRESS_BOOK_DELETE_ENTRY, tep_href_link(FILENAME_ACCOUNT, $this->_module . '=' . $_GET[$this->_module] . '&delete', 'SSL'));
+ }
+
+ $this->page_contents = 'address_book_delete.php';
+ }
+
+ if (isset($_GET['new']) && ($_GET['new'] == 'save')) {
+ if (tep_count_customer_address_book_entries() >= MAX_ADDRESS_BOOK_ENTRIES) {
+ $messageStack->add('address_book', ERROR_ADDRESS_BOOK_FULL);
+
+ $this->page_contents = 'address_book.php';
+ } else {
+ $this->_process();
+ }
+ } elseif (isset($_GET['edit']) && ($_GET['edit'] == 'save')) {
+ $this->_process($_GET[$this->_module]);
+ } elseif (isset($_GET['delete']) && ($_GET['delete'] == 'confirm') && is_numeric($_GET[$this->_module])) {
+ $this->_delete($_GET[$this->_module]);
+ }
+ }
+
+/* Public methods */
+
+ function getPageContentsFile() {
+ return $this->page_contents;
+ }
+
+/* Private methods */
+
+ function _process($id = '') {
+ global $messageStack, $osC_Database, $osC_Customer, $entry_state_has_zones;
+
+ if (ACCOUNT_GENDER > 0) {
+ if (!isset($_POST['gender']) || (($_POST['gender'] != 'm') && ($_POST['gender'] != 'f'))) {
+ $messageStack->add('address_book', ENTRY_GENDER_ERROR);
+ }
+ }
+
+ if (!isset($_POST['firstname']) || (strlen(trim($_POST['firstname'])) < ACCOUNT_FIRST_NAME)) {
+ $messageStack->add('address_book', ENTRY_FIRST_NAME_ERROR);
+ }
+
+ if (!isset($_POST['lastname']) || (strlen(trim($_POST['lastname'])) < ACCOUNT_LAST_NAME)) {
+ $messageStack->add('address_book', ENTRY_LAST_NAME_ERROR);
+ }
+
+ if (ACCOUNT_COMPANY > 0) {
+ if (!isset($_POST['company']) || (strlen(trim($_POST['company'])) < ACCOUNT_COMPANY)) {
+ $messageStack->add('address_book', ENTRY_COMPANY_ERROR);
+ }
+ }
+
+ if (!isset($_POST['street_address']) || (strlen(trim($_POST['street_address'])) < ACCOUNT_STREET_ADDRESS)) {
+ $messageStack->add('address_book', ENTRY_STREET_ADDRESS_ERROR);
+ }
+
+ if (ACCOUNT_SUBURB > 0) {
+ if (!isset($_POST['suburb']) || (strlen(trim($_POST['suburb'])) < ACCOUNT_SUBURB)) {
+ $messageStack->add('address_book', ENTRY_SUBURB_ERROR);
+ }
+ }
+
+ if (!isset($_POST['postcode']) || (strlen(trim($_POST['postcode'])) < ACCOUNT_POST_CODE)) {
+ $messageStack->add('address_book', ENTRY_POST_CODE_ERROR);
+ }
+
+ if (!isset($_POST['city']) || (strlen(trim($_POST['city'])) < ACCOUNT_CITY)) {
+ $messageStack->add('address_book', ENTRY_CITY_ERROR);
+ }
+
+ if (ACCOUNT_STATE > 0) {
+ $zone_id = 0;
+
+ $Qcheck = $osC_Database->query('select zone_id from :table_zones where zone_country_id = :zone_country_id limit 1');
+ $Qcheck->bindTable(':table_zones', TABLE_ZONES);
+ $Qcheck->bindInt(':zone_country_id', $_POST['country']);
+ $Qcheck->execute();
+
+ $entry_state_has_zones = ($Qcheck->numberOfRows() > 0);
+
+ if ($entry_state_has_zones === true) {
+ $Qzone = $osC_Database->query('select zone_id from :table_zones where zone_country_id = :zone_country_id and zone_code like :zone_code');
+ $Qzone->bindTable(':table_zones', TABLE_ZONES);
+ $Qzone->bindInt(':zone_country_id', $_POST['country']);
+ $Qzone->bindValue(':zone_code', trim($_POST['state']));
+ $Qzone->execute();
+
+ if ($Qzone->numberOfRows() === 1) {
+ $zone_id = $Qzone->valueInt('zone_id');
+ } else {
+ $Qzone = $osC_Database->query('select zone_id from :table_zones where zone_country_id = :zone_country_id and zone_name like :zone_name');
+ $Qzone->bindTable(':table_zones', TABLE_ZONES);
+ $Qzone->bindInt(':zone_country_id', $_POST['country']);
+ $Qzone->bindValue(':zone_name', trim($_POST['state']) . '%');
+ $Qzone->execute();
+
+ if ($Qzone->numberOfRows() === 1) {
+ $zone_id = $Qzone->valueInt('zone_id');
+ } else {
+ $messageStack->add('address_book', ENTRY_STATE_ERROR_SELECT);
+ }
+ }
+ } else {
+ if (strlen(trim($_POST['state'])) < ACCOUNT_STATE) {
+ $messageStack->add('address_book', ENTRY_STATE_ERROR);
+ }
+ }
+ }
+
+ if ( (is_numeric($_POST['country']) === false) || ($_POST['country'] < 1) ) {
+ $messageStack->add('address_book', ENTRY_COUNTRY_ERROR);
+ }
+
+ if (ACCOUNT_TELEPHONE > 0) {
+ if (!isset($_POST['telephone']) || (strlen(trim($_POST['telephone'])) < ACCOUNT_TELEPHONE)) {
+ $messageStack->add('address_book', ENTRY_TELEPHONE_NUMBER_ERROR);
+ }
+ }
+
+ if (ACCOUNT_FAX > 0) {
+ if (!isset($_POST['fax']) || (strlen(trim($_POST['fax'])) < ACCOUNT_FAX)) {
+ $messageStack->add('address_book', ENTRY_FAX_NUMBER_ERROR);
+ }
+ }
+
+ if ($messageStack->size('address_book') === 0) {
+ if (is_numeric($id)) {
+ $Qab = $osC_Database->query('update :table_address_book set customers_id = :customers_id, entry_gender = :entry_gender, entry_company = :entry_company, entry_firstname = :entry_firstname, entry_lastname = :entry_lastname, entry_street_address = :entry_street_address, entry_suburb = :entry_suburb, entry_postcode = :entry_postcode, entry_city = :entry_city, entry_state = :entry_state, entry_country_id = :entry_country_id, entry_zone_id = :entry_zone_id, entry_telephone = :entry_telephone, entry_fax = :entry_fax where address_book_id = :address_book_id and customers_id = :customers_id');
+ $Qab->bindInt(':address_book_id', $id);
+ $Qab->bindInt(':customers_id', $osC_Customer->id);
+ } else {
+ $Qab = $osC_Database->query('insert into :table_address_book (customers_id, entry_gender, entry_company, entry_firstname, entry_lastname, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_country_id, entry_zone_id, entry_telephone, entry_fax) values (:customers_id, :entry_gender, :entry_company, :entry_firstname, :entry_lastname, :entry_street_address, :entry_suburb, :entry_postcode, :entry_city, :entry_state, :entry_country_id, :entry_zone_id, :entry_telephone, :entry_fax)');
+ }
+ $Qab->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+ $Qab->bindInt(':customers_id', $osC_Customer->id);
+ $Qab->bindValue(':entry_gender', (((ACCOUNT_GENDER > -1) && isset($_POST['gender']) && (($_POST['gender'] == 'm') || ($_POST['gender'] == 'f'))) ? $_POST['gender'] : ''));
+ $Qab->bindValue(':entry_company', ((ACCOUNT_COMPANY > -1) ? trim($_POST['company']) : ''));
+ $Qab->bindValue(':entry_firstname', trim($_POST['firstname']));
+ $Qab->bindValue(':entry_lastname', trim($_POST['lastname']));
+ $Qab->bindValue(':entry_street_address', trim($_POST['street_address']));
+ $Qab->bindValue(':entry_suburb', ((ACCOUNT_SUBURB > -1) ? trim($_POST['suburb']) : ''));
+ $Qab->bindValue(':entry_postcode', trim($_POST['postcode']));
+ $Qab->bindValue(':entry_city', trim($_POST['city']));
+ $Qab->bindValue(':entry_state', ((ACCOUNT_STATE > -1) ? (($zone_id > 0) ? '' : trim($_POST['state'])) : ''));
+ $Qab->bindInt(':entry_country_id', $_POST['country']);
+ $Qab->bindInt(':entry_zone_id', ((ACCOUNT_STATE > -1) ? (($zone_id > 0) ? $zone_id : 0) : ''));
+ $Qab->bindValue(':entry_telephone', ((ACCOUNT_TELEPHONE > -1) ? trim($_POST['telephone']) : ''));
+ $Qab->bindValue(':entry_fax', ((ACCOUNT_FAX > -1) ? trim($_POST['fax']) : ''));
+ $Qab->execute();
+
+ if ( ($osC_Customer->hasDefaultAddress() === false) || (isset($_POST['primary']) && ($_POST['primary'] == 'on')) ) {
+ if (is_numeric($id) === false) {
+ $id = $osC_Database->nextID();
+ }
+
+ $Qupdate = $osC_Database->query('update :table_customers set customers_default_address_id = :customers_default_address_id where customers_id = :customers_id');
+ $Qupdate->bindTable(':table_customers', TABLE_CUSTOMERS);
+ $Qupdate->bindInt(':customers_default_address_id', $id);
+ $Qupdate->bindInt(':customers_id', $osC_Customer->id);
+ $Qupdate->execute();
+
+ if ($Qupdate->affectedRows() === 1) {
+ $osC_Customer->setCountryID($_POST['country']);
+ $osC_Customer->setZoneID(($zone_id > 0) ? (int)$zone_id : '0');
+ $osC_Customer->setDefaultAddressID($id);
+ }
+ }
+
+ $messageStack->add_session('address_book', SUCCESS_ADDRESS_BOOK_ENTRY_UPDATED, 'success');
+
+ tep_redirect(tep_href_link(FILENAME_ACCOUNT, 'address_book', 'SSL'));
+ }
+ }
+
+ function _delete($id) {
+ global $messageStack, $osC_Database, $osC_Customer;
+
+ if ($id != $osC_Customer->default_address_id) {
+ $Qdelete = $osC_Database->query('delete from :table_address_book where address_book_id = :address_book_id and customers_id = :customers_id');
+ $Qdelete->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
+ $Qdelete->bindInt(':address_book_id', $id);
+ $Qdelete->bindInt(':customers_id', $osC_Customer->id);
+ $Qdelete->execute();
+
+ if ($Qdelete->affectedRows() === 1) {
+ $messageStack->add_session('address_book', SUCCESS_ADDRESS_BOOK_ENTRY_DELETED, 'success');
+ }
+ } else {
+ $messageStack->add_session('address_book', WARNING_PRIMARY_ADDRESS_DELETION, 'warning');
+ }
+
+ tep_redirect(tep_href_link(FILENAME_ACCOUNT, 'address_book', 'SSL'));
+ }
+ }
+?>
</pre></div>
<center><small><a href="http://www.badgers-in-foil.co.uk/projects/cvsspam/" title="commit -> email">CVSspam</a> 0.2.9</small></center>
</body></html>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click