[-] FO : Fix bug #PSCFI-6864 #PSCFV-6516 Issue with deleted address blocking order process

This commit is contained in:
gRoussac
2013-01-31 19:06:19 +01:00
parent d586489556
commit 68673f92d1
3 changed files with 46 additions and 49 deletions
+1 -1
View File
@@ -2837,8 +2837,8 @@ class CartCore extends ObjectModel
$invoice = new Address((int)$this->id_address_invoice);
// New layout system with personalization fields
$formatted_addresses['delivery'] = AddressFormat::getFormattedLayoutData($delivery);
$formatted_addresses['invoice'] = AddressFormat::getFormattedLayoutData($invoice);
$formatted_addresses['delivery'] = AddressFormat::getFormattedLayoutData($delivery);
$total_tax = $this->getOrderTotal() - $this->getOrderTotal(false);
+4 -3
View File
@@ -412,16 +412,17 @@ class CustomerCore extends ObjectModel
*/
public static function customerHasAddress($id_customer, $id_address)
{
if (!array_key_exists($id_customer, self::$_customerHasAddress))
$key = (int)$id_customer.'-'.(int)$id_address;
if (!array_key_exists($id_address, self::$_customerHasAddress))
{
self::$_customerHasAddress[$id_customer] = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
self::$_customerHasAddress[$key] = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `id_address`
FROM `'._DB_PREFIX_.'address`
WHERE `id_customer` = '.(int)$id_customer.'
AND `id_address` = '.(int)$id_address.'
AND `deleted` = 0');
}
return self::$_customerHasAddress[$id_customer];
return self::$_customerHasAddress[$key];
}
public static function resetAddressCache($id_customer)
+41 -45
View File
@@ -35,18 +35,13 @@ function updateAddressesDisplay(first_view)
{
// update content of delivery address
updateAddressDisplay('delivery');
var txtInvoiceTitle = "";
try{
var adrs_titles = getAddressesTitles();
txtInvoiceTitle = adrs_titles.invoice;
}
catch (e)
{
}
{}
// update content of invoice address
//if addresses have to be equals...
if ($('input[type=checkbox]#addressesAreEquals:checked').length === 1 && ($('#multishipping_mode_checkbox:checked').length === 0))
@@ -68,7 +63,6 @@ function updateAddressesDisplay(first_view)
$('ul#address_invoice li.address_title').html(txtInvoiceTitle);
}
}
if(!first_view)
{
if (orderProcess === 'order')
@@ -82,15 +76,15 @@ function updateAddressDisplay(addressType)
if (formatedAddressFieldsValuesList.length <= 0)
return false;
var idAddress = $('#id_address_' + addressType + '').val();
buildAddressBlock(idAddress, addressType, $('#address_'+ addressType));
var idAddress = parseInt($('#id_address_' + addressType + '').val());
buildAddressBlock(idAddress, addressType, $('#address_' + addressType));
// change update link
var link = $('ul#address_' + addressType + ' li.address_update a').attr('href');
var expression = /id_address=\d+/;
if (link)
{
link = link.replace(expression, 'id_address='+idAddress);
link = link.replace(expression, 'id_address=' + idAddress);
$('ul#address_' + addressType + ' li.address_update a').attr('href', link);
}
resizeAddressesBox();
@@ -98,41 +92,43 @@ function updateAddressDisplay(addressType)
function updateAddresses()
{
var idAddress_delivery = $('#id_address_delivery').val();
var idAddress_invoice = $('input[type=checkbox]#addressesAreEquals:checked').length === 1 ? idAddress_delivery : $('#id_address_invoice').val();
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: baseUri + '?rand=' + new Date().getTime(),
async: true,
cache: false,
dataType : "json",
data: {
processAddress: true,
step: 2,
ajax: 'true',
controller: 'order',
'multi-shipping': $('#id_address_delivery:hidden').length,
id_address_delivery: idAddress_delivery,
id_address_invoice: idAddress_invoice,
token: static_token
},
success: function(jsonData)
{
if (jsonData.hasError)
var idAddress_delivery = parseInt($('#id_address_delivery').val());
var idAddress_invoice = $('input[type=checkbox]#addressesAreEquals:checked').length === 1 ? idAddress_delivery : parseInt($('#id_address_invoice').val());
if(isNaN(idAddress_delivery) == false && isNaN(idAddress_invoice) == false)
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
url: baseUri + '?rand=' + new Date().getTime(),
async: true,
cache: false,
dataType : "json",
data: {
processAddress: true,
step: 2,
ajax: 'true',
controller: 'order',
'multi-shipping': $('#id_address_delivery:hidden').length,
id_address_delivery: idAddress_delivery,
id_address_invoice: idAddress_invoice,
token: static_token
},
success: function(jsonData)
{
var errors = '';
for(var error in jsonData.errors)
//IE6 bug fix
if(error !== 'indexOf')
errors += jsonData.errors[error] + "\n";
alert(errors);
if (jsonData.hasError)
{
var errors = '';
for(var error in jsonData.errors)
//IE6 bug fix
if(error !== 'indexOf')
errors += jsonData.errors[error] + "\n";
alert(errors);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
if (textStatus !== 'abort')
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
if (textStatus !== 'abort')
alert("TECHNICAL ERROR: unable to save adresses \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
}
});
});
resizeAddressesBox();
}
}