diff --git a/js/db_routines.js b/js/db_routines.js index 5fe45730d4..d61001f217 100644 --- a/js/db_routines.js +++ b/js/db_routines.js @@ -80,6 +80,13 @@ function validateRoutineEditor(syntaxHiglighter) { isError = true; } } + if (! isError && $('select[name=routine_type]').find(':selected').val() == 'FUNCTION') { + if ($('.rte_table').find('textarea[name=routine_definition]').val().toLowerCase().indexOf('return') < 0) { + syntaxHiglighter.focus(); + alert(PMA_messages['MissingReturn']); + return false; + } + } if (! isError) { return true; } else { diff --git a/js/messages.php b/js/messages.php index 91b3d53e0a..21595ab7ab 100644 --- a/js/messages.php +++ b/js/messages.php @@ -86,6 +86,9 @@ $js_messages['strShowSearchResults'] = __('Show search results'); $js_messages['strBrowsing'] = __('Browsing'); $js_messages['strDeleting'] = __('Deleting'); +/* For db_routines.js */ +$js_messages['MissingReturn'] = __('The definition of a stored function must contain a RETURN statement!'); + /* For import.js */ $js_messages['strImportCSV'] = __('Note: If the file contains multiple tables, they will be combined into one');