[-] 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
+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();
}
}