Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix foreign key constraint

  • Loading branch information...
commit 31e392c5080a79ec191bf9e28adf02432e464308 1 parent ddc8fc7
@haraldpdl haraldpdl authored
View
8 osCommerce/OM/Core/Site/Admin/Application/Customers/SQL/MySQL/Standard/SaveAddress.php
@@ -44,7 +44,13 @@ public static function execute($data) {
$Qab->bindValue(':entry_city', $data['city']);
$Qab->bindValue(':entry_state', $data['state']);
$Qab->bindInt(':entry_country_id', $data['country_id']);
- $Qab->bindInt(':entry_zone_id', $data['zone_id']);
+
+ if ( is_numeric($data['zone_id']) ) {
+ $Qab->bindInt(':entry_zone_id', $data['zone_id']);
+ } else {
+ $Qab->bindNull(':entry_zone_id');
+ }
+
$Qab->bindValue(':entry_telephone', $data['telephone']);
$Qab->bindValue(':entry_fax', $data['fax']);
$Qab->execute();
View
14 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/SQL/MySQL/Standard/EntrySave.php
@@ -22,8 +22,18 @@ public static function execute($data) {
$Qentry->bindInt(':geo_zone_id', $data['group_id']);
}
- $Qentry->bindInt(':zone_country_id', $data['country_id']);
- $Qentry->bindInt(':zone_id', $data['zone_id']);
+ if ( is_numeric($data['country_id']) ) {
+ $Qentry->bindInt(':zone_country_id', $data['country_id']);
+ } else {
+ $Qentry->bindNull(':zone_country_id');
+ }
+
+ if ( is_numeric($data['zone_id']) ) {
+ $Qentry->bindInt(':zone_id', $data['zone_id']);
+ } else {
+ $Qentry->bindNull(':zone_id');
+ }
+
$Qentry->execute();
return ( ($Qentry->rowCount() === 1) || !$Qentry->isError() );
View
4 osCommerce/OM/Core/Site/Admin/Application/ZoneGroups/pages/entries.php
@@ -91,12 +91,12 @@ function feedDataTable(data) {
var record = data.entries[r];
var countryName = record.countries_name;
- if ( parseInt(record.zone_country_id) < 1 ) {
+ if ( isNaN(parseInt(record.zone_country_id)) || parseInt(record.zone_country_id) < 1 ) {
countryName = allCountries;
}
var zoneName = record.zone_name;
- if ( parseInt(record.zone_id) < 1 ) {
+ if ( isNaN(parseInt(record.zone_id)) || parseInt(record.zone_id) < 1 ) {
zoneName = allZones;
}
View
8 osCommerce/OM/Core/Site/Shop/AddressBook.php
@@ -136,7 +136,13 @@ public static function saveEntry($data, $id = '') {
$Qab->bindValue(':entry_city', $data['city']);
$Qab->bindValue(':entry_state', (ACCOUNT_STATE > -1) ? ((isset($data['zone_id']) && ($data['zone_id'] > 0)) ? '' : $data['state']) : '');
$Qab->bindInt(':entry_country_id', $data['country']);
- $Qab->bindInt(':entry_zone_id', (ACCOUNT_STATE > -1) ? ((isset($data['zone_id']) && ($data['zone_id'] > 0)) ? $data['zone_id'] : 0) : '');
+
+ if ( isset($data['zone_id']) && is_numeric($data['zone_id']) ) {
+ $Qab->bindInt(':entry_zone_id', $data['zone_id']);
+ } else {
+ $Qab->bindNull(':entry_zone_id');
+ }
+
$Qab->bindValue(':entry_telephone', (ACCOUNT_TELEPHONE > -1) ? $data['telephone'] : '');
$Qab->bindValue(':entry_fax', (ACCOUNT_FAX > -1) ? $data['fax'] : '');
$Qab->execute();
Please sign in to comment.
Something went wrong with that request. Please try again.