Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

153
 
184
 
184
 
customer.php
_> 11 <?php
  22 /*
<> 3 -  $Id: customer.php 153 2005-08-04 12:57:59Z hpdl $
   3+  $Id: customer.php 184 2005-09-07 14:48:20Z hpdl $
44 
  55   osCommerce, Open Source E-Commerce Solutions
  66   http://www.oscommerce.com
     
 !
2222         $country_id,
  2323         $zone_id;
  2424 
<> 25 -// class constructor
  26 -    function osC_Customer() {
  27 -      $this->setIsLoggedOn(false);
   25+/* Private variables */
   26+
   27+    var $_is_logged_on = false,
   28+        $_data = array();
   29+
   30+/* Public methods */
   31+
   32+    function getID() {
   33+      if (isset($this->_data['id']) && is_numeric($this->_data['id'])) {
   34+        return $this->_data['id'];
   35+      }
   36+
   37+      return false;
2838     }
  2939 
<> 30 -// class methods
   40+    function getFirstName() {
   41+      static $first_name = null;
   42+
   43+      if (is_null($first_name)) {
   44+        if (isset($this->_data['first_name'])) {
   45+          $first_name = $this->_data['first_name'];
   46+        }
   47+      }
   48+
   49+      return $first_name;
   50+    }
   51+
   52+    function getLastName() {
   53+      static $last_name = null;
   54+
   55+      if (is_null($last_name)) {
   56+        if (isset($this->_data['last_name'])) {
   57+          $last_name = $this->_data['last_name'];
   58+        }
   59+      }
   60+
   61+      return $last_name;
   62+    }
   63+
   64+    function getName() {
   65+      static $name = '';
   66+
   67+      if (empty($name)) {
   68+        if (isset($this->_data['first_name'])) {
   69+          $name .= $this->_data['first_name'];
   70+        }
   71+
   72+        if (isset($this->_data['last_name'])) {
   73+          if (empty($name) === false) {
   74+            $name .= ' ';
   75+          }
   76+
   77+          $name .= $this->_data['last_name'];
   78+        }
   79+      }
   80+
   81+      return $name;
   82+    }
   83+
   84+    function getGender() {
   85+      static $gender = null;
   86+
   87+      if (is_null($gender)) {
   88+        if (isset($this->_data['gender'])) {
   89+          $gender = $this->_data['gender'];
   90+        }
   91+      }
   92+
   93+      return $gender;
   94+    }
   95+
   96+    function getEmailAddress() {
   97+      static $email_address = null;
   98+
   99+      if (is_null($email_address)) {
   100+        if (isset($this->_data['email_address'])) {
   101+          $email_address = $this->_data['email_address'];
   102+        }
   103+      }
   104+
   105+      return $email_address;
   106+    }
   107+
   108+    function getCountryID() {
   109+      static $country_id = null;
   110+
   111+      if (is_null($country_id)) {
   112+        if (isset($this->_data['country_id'])) {
   113+          $country_id = $this->_data['country_id'];
   114+        }
   115+      }
   116+
   117+      return $country_id;
   118+    }
   119+
   120+    function getZoneID() {
   121+      static $zone_id = null;
   122+
   123+      if (is_null($zone_id)) {
   124+        if (isset($this->_data['zone_id'])) {
   125+          $zone_id = $this->_data['zone_id'];
   126+        }
   127+      }
   128+
   129+      return $zone_id;
   130+    }
   131+
   132+    function getDefaultAddressID() {
   133+      static $id = null;
   134+
   135+      if (is_null($id)) {
   136+        if (isset($this->_data['default_address_id'])) {
   137+          $id = $this->_data['default_address_id'];
   138+        }
   139+      }
   140+
   141+      return $id;
   142+    }
   143+
31144     function setCustomerData($customer_id = -1) {
  32145       if (is_numeric($customer_id) && ($customer_id > 0)) {
  33146         global $osC_Database;
     
 !
48161 
  49162           if (is_numeric($Qcustomer->value('customers_default_address_id')) && ($Qcustomer->value('customers_default_address_id') > 0)) {
  50163             $Qab = $osC_Database->query('select entry_country_id, entry_zone_id from :table_address_book where address_book_id = :address_book_id and customers_id = :customers_id');
<> 51 -            $Qab->bindRaw(':table_address_book', TABLE_ADDRESS_BOOK);
   164+            $Qab->bindTable(':table_address_book', TABLE_ADDRESS_BOOK);
52165             $Qab->bindInt(':address_book_id', $Qcustomer->value('customers_default_address_id'));
  53166             $Qab->bindInt(':customers_id', $customer_id);
  54167             $Qab->execute();
     
 !
69182 
  70183     function setIsLoggedOn($state) {
  71184       if ($state === true) {
<> 72 -        $this->is_logged_on = true;
   185+        $this->_is_logged_on = true;
73186       } else {
<> 74 -        $this->is_logged_on = false;
   187+        $this->_is_logged_on = false;
75188       }
  76189     }
  77190 
  78191     function isLoggedOn() {
<> 79 -      if ($this->is_logged_on === true) {
   192+      if ($this->_is_logged_on === true) {
80193         return true;
  81194       }
  82195 
     
 !
89202 
  90203     function setID($id) {
  91204       $this->id = $id;
<>  205+
   206+      if (is_numeric($id) && ($id > 0)) {
   207+        $this->_data['id'] = $id;
   208+      } else {
   209+        $this->_data['id'] = false;
   210+      }
92211     }
  93212 
  94213     function setDefaultAddressID($id) {
  95214       $this->default_address_id = $id;
<>  215+
   216+      if (is_numeric($id) && ($id > 0)) {
   217+        $this->_data['default_address_id'] = $id;
   218+      } else {
   219+        $this->_data['default_address_id'] = false;
   220+      }
96221     }
  97222 
  98223     function hasDefaultAddress() {
<> 99 -      if (is_numeric($this->default_address_id) && ($this->default_address_id > 0)) {
   224+      if (isset($this->_data['default_address_id']) && is_numeric($this->_data['default_address_id'])) {
100225         return true;
<> 101 -      } else {
  102 -        return false;
103226       }
<>  227+
   228+      return false;
104229     }
  105230 
  106231     function setGender($gender) {
  107232       $this->gender = $gender;
<>  233+
   234+      if ( (strtolower($gender) == 'm') || (strtolower($gender) == 'f') ) {
   235+        $this->_data['gender'] = strtolower($gender);
   236+      } else {
   237+        $this->_data['gender'] = false;
   238+      }
108239     }
  109240 
<> 110 -    function setFirstName($firstname) {
  111 -      $this->first_name = $firstname;
   241+    function setFirstName($first_name) {
   242+      $this->first_name = $first_name;
   243+
   244+      $this->_data['first_name'] = $first_name;
112245     }
  113246 
<> 114 -    function setLastName($lastname) {
  115 -      $this->last_name = $lastname;
   247+    function setLastName($last_name) {
   248+      $this->last_name = $last_name;
   249+
   250+      $this->_data['last_name'] = $last_name;
116251     }
  117252 
  118253     function setFullName($fullname = '') {
     
 !
125260 
  126261     function setEmailAddress($email_address) {
  127262       $this->email_address = $email_address;
<>  263+
   264+      $this->_data['email_address'] = $email_address;
128265     }
  129266 
  130267     function setCountryID($id) {
  131268       $this->country_id = $id;
<>  269+
   270+      $this->_data['country_id'] = $id;
132271     }
  133272 
  134273     function setZoneID($id) {
  135274       $this->zone_id = $id;
<>  275+
   276+      $this->_data['zone_id'] = $id;
<_ 136277     }
  137278   }
  138279 ?>