[-] FO : Fix bug #PSCFI-6864 #PSCFV-6516 Issue with deleted address blocking order process
This commit is contained in:
1 parent
d586489556
commit
68673f92d1
3 files changed
+45
-48
No files matched your search
+1
-1
@@ -2837,8 +2837,8 @@ class CartCore extends ObjectModel
|
|||||||
$invoice = new Address((int)$this->id_address_invoice);
|
$invoice = new Address((int)$this->id_address_invoice);
|
||||||
|
|
||||||
// New layout system with personalization fields
|
// New layout system with personalization fields
|
||||||
$formatted_addresses['invoice'] = AddressFormat::getFormattedLayoutData($invoice);
|
|
||||||
$formatted_addresses['delivery'] = AddressFormat::getFormattedLayoutData($delivery);
|
$formatted_addresses['delivery'] = AddressFormat::getFormattedLayoutData($delivery);
|
||||||
|
$formatted_addresses['invoice'] = AddressFormat::getFormattedLayoutData($invoice);
|
||||||
|
|
||||||
$total_tax = $this->getOrderTotal() - $this->getOrderTotal(false);
|
$total_tax = $this->getOrderTotal() - $this->getOrderTotal(false);
|
||||||
|
|
||||||
|
|||||||
@@ -412,16 +412,17 @@ class CustomerCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function customerHasAddress($id_customer, $id_address)
|
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`
|
SELECT `id_address`
|
||||||
FROM `'._DB_PREFIX_.'address`
|
FROM `'._DB_PREFIX_.'address`
|
||||||
WHERE `id_customer` = '.(int)$id_customer.'
|
WHERE `id_customer` = '.(int)$id_customer.'
|
||||||
AND `id_address` = '.(int)$id_address.'
|
AND `id_address` = '.(int)$id_address.'
|
||||||
AND `deleted` = 0');
|
AND `deleted` = 0');
|
||||||
}
|
}
|
||||||
return self::$_customerHasAddress[$id_customer];
|
return self::$_customerHasAddress[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function resetAddressCache($id_customer)
|
public static function resetAddressCache($id_customer)
|
||||||
|
|||||||
@@ -35,18 +35,13 @@ function updateAddressesDisplay(first_view)
|
|||||||
{
|
{
|
||||||
// update content of delivery address
|
// update content of delivery address
|
||||||
updateAddressDisplay('delivery');
|
updateAddressDisplay('delivery');
|
||||||
|
|
||||||
var txtInvoiceTitle = "";
|
var txtInvoiceTitle = "";
|
||||||
|
|
||||||
try{
|
try{
|
||||||
var adrs_titles = getAddressesTitles();
|
var adrs_titles = getAddressesTitles();
|
||||||
txtInvoiceTitle = adrs_titles.invoice;
|
txtInvoiceTitle = adrs_titles.invoice;
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// update content of invoice address
|
// update content of invoice address
|
||||||
//if addresses have to be equals...
|
//if addresses have to be equals...
|
||||||
if ($('input[type=checkbox]#addressesAreEquals:checked').length === 1 && ($('#multishipping_mode_checkbox:checked').length === 0))
|
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);
|
$('ul#address_invoice li.address_title').html(txtInvoiceTitle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!first_view)
|
if(!first_view)
|
||||||
{
|
{
|
||||||
if (orderProcess === 'order')
|
if (orderProcess === 'order')
|
||||||
@@ -82,15 +76,15 @@ function updateAddressDisplay(addressType)
|
|||||||
if (formatedAddressFieldsValuesList.length <= 0)
|
if (formatedAddressFieldsValuesList.length <= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var idAddress = $('#id_address_' + addressType + '').val();
|
var idAddress = parseInt($('#id_address_' + addressType + '').val());
|
||||||
buildAddressBlock(idAddress, addressType, $('#address_'+ addressType));
|
buildAddressBlock(idAddress, addressType, $('#address_' + addressType));
|
||||||
|
|
||||||
// change update link
|
// change update link
|
||||||
var link = $('ul#address_' + addressType + ' li.address_update a').attr('href');
|
var link = $('ul#address_' + addressType + ' li.address_update a').attr('href');
|
||||||
var expression = /id_address=\d+/;
|
var expression = /id_address=\d+/;
|
||||||
if (link)
|
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);
|
$('ul#address_' + addressType + ' li.address_update a').attr('href', link);
|
||||||
}
|
}
|
||||||
resizeAddressesBox();
|
resizeAddressesBox();
|
||||||
@@ -98,41 +92,43 @@ function updateAddressDisplay(addressType)
|
|||||||
|
|
||||||
function updateAddresses()
|
function updateAddresses()
|
||||||
{
|
{
|
||||||
var idAddress_delivery = $('#id_address_delivery').val();
|
var idAddress_delivery = parseInt($('#id_address_delivery').val());
|
||||||
var idAddress_invoice = $('input[type=checkbox]#addressesAreEquals:checked').length === 1 ? idAddress_delivery : $('#id_address_invoice').val();
|
var idAddress_invoice = $('input[type=checkbox]#addressesAreEquals:checked').length === 1 ? idAddress_delivery : parseInt($('#id_address_invoice').val());
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
if(isNaN(idAddress_delivery) == false && isNaN(idAddress_invoice) == false)
|
||||||
headers: { "cache-control": "no-cache" },
|
$.ajax({
|
||||||
url: baseUri + '?rand=' + new Date().getTime(),
|
type: 'POST',
|
||||||
async: true,
|
headers: { "cache-control": "no-cache" },
|
||||||
cache: false,
|
url: baseUri + '?rand=' + new Date().getTime(),
|
||||||
dataType : "json",
|
async: true,
|
||||||
data: {
|
cache: false,
|
||||||
processAddress: true,
|
dataType : "json",
|
||||||
step: 2,
|
data: {
|
||||||
ajax: 'true',
|
processAddress: true,
|
||||||
controller: 'order',
|
step: 2,
|
||||||
'multi-shipping': $('#id_address_delivery:hidden').length,
|
ajax: 'true',
|
||||||
id_address_delivery: idAddress_delivery,
|
controller: 'order',
|
||||||
id_address_invoice: idAddress_invoice,
|
'multi-shipping': $('#id_address_delivery:hidden').length,
|
||||||
token: static_token
|
id_address_delivery: idAddress_delivery,
|
||||||
},
|
id_address_invoice: idAddress_invoice,
|
||||||
success: function(jsonData)
|
token: static_token
|
||||||
{
|
},
|
||||||
if (jsonData.hasError)
|
success: function(jsonData)
|
||||||
{
|
{
|
||||||
var errors = '';
|
if (jsonData.hasError)
|
||||||
for(var error in jsonData.errors)
|
{
|
||||||
//IE6 bug fix
|
var errors = '';
|
||||||
if(error !== 'indexOf')
|
for(var error in jsonData.errors)
|
||||||
errors += jsonData.errors[error] + "\n";
|
//IE6 bug fix
|
||||||
alert(errors);
|
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();
|
resizeAddressesBox();
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user