  |
38 | 38 | | return false; |
| |
39 | 39 | | } |
| |
40 | 40 | | |
  |
| 41 | + | function saveEntry($data) { |
| |
| 42 | + | global $osC_Database, $osC_Customer; |
| |
| 43 | + | |
| |
| 44 | + | $Qcustomer = $osC_Database->query('update :table_customers set customers_gender = :customers_gender, customers_firstname = :customers_firstname, customers_lastname = :customers_lastname, customers_email_address = :customers_email_address, customers_dob = :customers_dob where customers_id = :customers_id'); |
| |
| 45 | + | $Qcustomer->bindTable(':table_customers', TABLE_CUSTOMERS); |
| |
| 46 | + | $Qcustomer->bindValue(':customers_gender', ((ACCOUNT_GENDER > -1) && isset($data['gender']) && (($data['gender'] == 'm') || ($data['gender'] == 'f'))) ? $data['gender'] : ''); |
| |
| 47 | + | $Qcustomer->bindValue(':customers_firstname', $data['firstname']); |
| |
| 48 | + | $Qcustomer->bindValue(':customers_lastname', $data['lastname']); |
| |
| 49 | + | $Qcustomer->bindValue(':customers_email_address', $data['email_address']); |
| |
| 50 | + | $Qcustomer->bindValue(':customers_dob', (ACCOUNT_DATE_OF_BIRTH > -1) ? date('Ymd', $data['dob']) : ''); |
| |
| 51 | + | $Qcustomer->bindInt(':customers_id', $osC_Customer->id); |
| |
| 52 | + | $Qcustomer->execute(); |
| |
| 53 | + | |
| |
| 54 | + | if ($Qcustomer->affectedRows() === 1) { |
| |
| 55 | + | $Qupdate = $osC_Database->query('update :table_customers_info set customers_info_date_account_last_modified = now() where customers_info_id = :customers_info_id'); |
| |
| 56 | + | $Qupdate->bindTable(':table_customers_info', TABLE_CUSTOMERS_INFO); |
| |
| 57 | + | $Qupdate->bindInt(':customers_info_id', $osC_Customer->id); |
| |
| 58 | + | $Qupdate->execute(); |
| |
| 59 | + | |
| |
| 60 | + | return true; |
| |
| 61 | + | } |
| |
| 62 | + | |
| |
| 63 | + | return false; |
| |
| 64 | + | } |
| |
| 65 | + | |
|
41 | 66 | | function checkEntry($email_address) { |
| |
42 | 67 | | global $osC_Database; |
| |
43 | 68 | | |
| |
|
|
 |
… |
|
75 | 100 | | |
| |
76 | 101 | | return false; |
| |
77 | 102 | | } |
  |
| 103 | + | |
| |
| 104 | + | function checkDuplicateEntry($email_address) { |
| |
| 105 | + | global $osC_Database, $osC_Customer; |
| |
| 106 | + | |
| |
| 107 | + | $Qcheck = $osC_Database->query('select customers_id from :table_customers where customers_email_address = :customers_email_address and customers_id != :customers_id limit 1'); |
| |
| 108 | + | $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS); |
| |
| 109 | + | $Qcheck->bindValue(':customers_email_address', $email_address); |
| |
| 110 | + | $Qcheck->bindInt(':customers_id', $osC_Customer->id); |
| |
| 111 | + | $Qcheck->execute(); |
| |
| 112 | + | |
| |
| 113 | + | if ($Qcheck->numberOfRows() === 1) { |
| |
| 114 | + | return true; |
| |
| 115 | + | } |
| |
| 116 | + | |
| |
| 117 | + | return false; |
| |
| 118 | + | } |
  |
78 | 119 | | } |
| |
79 | 120 | | ?> |