diff --git a/application/controllers/RequestController.php b/application/controllers/RequestController.php index ccab99bd24bcae0a85c95da973ebaaa4384e4084..85f5a26083fdb13c817318ff8320189566e0d914 100755 --- a/application/controllers/RequestController.php +++ b/application/controllers/RequestController.php @@ -491,19 +491,18 @@ class RequestController extends Nmc_Controller_Action $currentFormIndex = array_search(strtolower($currentForm), array_map("strtolower", $requestFormOrder)); - if($currentFormIndex === false) { - if (strtolower($currentForm) == 'edit') { - $nextForm = 'Preview'; - } else if ($submit = 'ReturntoEdit') { - $nextForm = 'Edit'; - } else { - $nextForm = $requestFormOrder[count($requestFormOrder) - 1]; - } + + if ($submit == 'ReturntoEdit') { + $nextForm = 'Edit'; + } else if($currentFormIndex === false) { + // if the current form page is something unexpected + $nextForm = 'Preview'; } else if($currentFormIndex < count($requestFormOrder) - 1) { $nextForm = $requestFormOrder[$currentFormIndex + 1]; } else { $nextForm = $requestFormOrder[$currentFormIndex]; } + if($currentFormIndex > 0) { $prevForm = $requestFormOrder[$currentFormIndex - 1]; } else {