From eea79052e06581519869ff93a9a2d6c40ce1c05d Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Thu, 22 Aug 2013 10:15:55 +0200 Subject: [PATCH] [-] BO : fixed bug #PSCFV-10169 - now you can go backward from step 3 to 2 when no ranges are set --- js/admin_carrier_wizard.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/js/admin_carrier_wizard.js b/js/admin_carrier_wizard.js index cbc704a15..8592ecdb9 100644 --- a/js/admin_carrier_wizard.js +++ b/js/admin_carrier_wizard.js @@ -105,8 +105,8 @@ function onLeaveStepCallback(obj, context) { if (context.toStep == nbr_steps) 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() @@ -192,10 +192,10 @@ function displaySummary() }); } -function validateSteps(step_number) +function validateSteps(fromStep, toStep) { 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)) is_ok = false; @@ -204,13 +204,13 @@ function validateSteps(step_number) $('.wizard_error').remove(); if (is_ok) { - form = $('#carrier_wizard #step-'+step_number+' form'); + form = $('#carrier_wizard #step-'+fromStep+' form'); $.ajax({ type:"POST", url : validate_url, async: false, 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) { if (datas.has_error) @@ -220,7 +220,7 @@ function validateSteps(step_number) $('input').focus( function () { $(this).removeClass('field_error'); }); - displayError(datas.errors, step_number); + displayError(datas.errors, fromStep); resizeWizard(); } },