[-] BO : fixed bug #PSCFV-10169 - now you can go backward from step 3 to 2 when no ranges are set

This commit is contained in:
Vincent Augagneur committed 2013-08-22 10:15:55 +02:00
1 parent ba95c9a63a
commit eea79052e0
1 file changed
+7 -7
+7 -7
View File
@@ -105,8 +105,8 @@ function onLeaveStepCallback(obj, context)
{ {
if (context.toStep == nbr_steps) if (context.toStep == nbr_steps)
displaySummary(); displaySummary();
return validateSteps(context.fromStep); // return false to stay on step and true to continue navigation return validateSteps(context.fromStep, context.toStep); // return false to stay on step and true to continue navigation
} }
function displaySummary() function displaySummary()
@@ -192,10 +192,10 @@ function displaySummary()
}); });
} }
function validateSteps(step_number) function validateSteps(fromStep, toStep)
{ {
var is_ok = true; var is_ok = true;
if ((multistore_enable && step_number == 3) || (!multistore_enable && step_number == 2)) if ((multistore_enable && fromStep == 3) || (!multistore_enable && fromStep == 2) && toStep > fromStep)
{ {
if (!$('#is_free_on').attr('checked') && !validateRange(2)) if (!$('#is_free_on').attr('checked') && !validateRange(2))
is_ok = false; is_ok = false;
@@ -204,13 +204,13 @@ function validateSteps(step_number)
$('.wizard_error').remove(); $('.wizard_error').remove();
if (is_ok) if (is_ok)
{ {
form = $('#carrier_wizard #step-'+step_number+' form'); form = $('#carrier_wizard #step-'+fromStep+' form');
$.ajax({ $.ajax({
type:"POST", type:"POST",
url : validate_url, url : validate_url,
async: false, async: false,
dataType: 'json', dataType: 'json',
data : form.serialize()+'&step_number='+step_number+'&action=validate_step&ajax=1', data : form.serialize()+'&step_number='+fromStep+'&action=validate_step&ajax=1',
success : function(datas) success : function(datas)
{ {
if (datas.has_error) if (datas.has_error)
@@ -220,7 +220,7 @@ function validateSteps(step_number)
$('input').focus( function () { $('input').focus( function () {
$(this).removeClass('field_error'); $(this).removeClass('field_error');
}); });
displayError(datas.errors, step_number); displayError(datas.errors, fromStep);
resizeWizard(); resizeWizard();
} }
}, },