Author: jleroux
Date: Sat Jul 12 05:25:02 2008 New Revision: 676164 URL: http://svn.apache.org/viewvc?rev=676164&view=rev Log: Applied fix from trunk for revision: 676162 Modified: ofbiz/branches/release4.0/ (props changed) ofbiz/branches/release4.0/applications/product/script/org/ofbiz/product/feature/ProductFeatureServices.xml ofbiz/branches/release4.0/framework/base/src/base/org/ofbiz/base/util/UtilValidate.java Propchange: ofbiz/branches/release4.0/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Sat Jul 12 05:25:02 2008 @@ -13,3 +13,4 @@ *.ipr *.iws *.time +.settings Propchange: ofbiz/branches/release4.0/ ------------------------------------------------------------------------------ svn:mergeinfo = /ofbiz/trunk:674173,676162 Modified: ofbiz/branches/release4.0/applications/product/script/org/ofbiz/product/feature/ProductFeatureServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/product/script/org/ofbiz/product/feature/ProductFeatureServices.xml?rev=676164&r1=676163&r2=676164&view=diff ============================================================================== --- ofbiz/branches/release4.0/applications/product/script/org/ofbiz/product/feature/ProductFeatureServices.xml (original) +++ ofbiz/branches/release4.0/applications/product/script/org/ofbiz/product/feature/ProductFeatureServices.xml Sat Jul 12 05:25:02 2008 @@ -258,6 +258,32 @@ <check-permission permission="CATALOG" action="_CREATE"><fail-message message="Security Error: to run createProductFeatureType you must have the CATALOG_CREATE or CATALOG_ADMIN permission"/></check-permission> <check-errors/> + <if> + <condition> + <not> + <if-regexp field-name="parameters.productFeatureTypeId" expr="^[a-zA-Z]+[0-9_]*$"></if-regexp> + </not> + </condition> + <then> + <add-error> + <fail-property resource="ProductErrorUiLabels" property="ProductFeatureTypeIdMustContainsLettersAndDigits"/> + </add-error> + </then> + </if> + <check-errors/> + + <if> + <condition> + <if-validate-method field-name="parameters.productFeatureTypeId" method="isJavaScriptReservedWord"></if-validate-method> + </condition> + <then> + <add-error> + <fail-property resource="ProductErrorUiLabels" property="ProductFeatureTypeIdMustNotBeResevedWord"/> + </add-error> + </then> + </if> + <check-errors/> + <make-value value-name="newEntity" entity-name="ProductFeatureType"/> <set-nonpk-fields map-name="parameters" value-name="newEntity"/> <set-pk-fields map-name="parameters" value-name="newEntity"/> Modified: ofbiz/branches/release4.0/framework/base/src/base/org/ofbiz/base/util/UtilValidate.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/framework/base/src/base/org/ofbiz/base/util/UtilValidate.java?rev=676164&r1=676163&r2=676164&view=diff ============================================================================== --- ofbiz/branches/release4.0/framework/base/src/base/org/ofbiz/base/util/UtilValidate.java (original) +++ ofbiz/branches/release4.0/framework/base/src/base/org/ofbiz/base/util/UtilValidate.java Sat Jul 12 05:25:02 2008 @@ -602,7 +602,30 @@ // All characters are numbers or letters. return true; } - + + public static boolean isJavaScriptReservedWord(String s) { + String[] javaScriptReservedWord = {"abstract", "alert", "arguments", "Array", "blur", "boolean", "Boolean", "break", "byte", + "callee", "caller", "captureEventscase", "catch", "char", "class", "clearInterval", "clearTimeout", "close", "closed", + "confirm", "const", "constructor", "continue", "Date", "debugger", "default", "defaultStatusdelete", "do", "document", + "double", "else", "enum", "escape", "eval", "export", "extends", "false", "final", "finally", "find", "float", "for", + "focus", "frames", "function", "Function", "goto", "history", "home", "if", "implements", "import", "in", "Infinity", + "innerHeight", "innerWidth", "instanceof", "int", "interface", "isFinite", "isNaN", "java", "length", "location", + "locationbar", "long", "Math", "menubar", "moveBy", "moveTo", "name", "NaN", "native", "netscape", "new", "null", + "Number", "Object", "open", "opener", "outerHeight", "outerWidth", "package", "Packages", "pageXOffset", "pageYOffset", + "parent", "parseFloat", "parseInt", "personalbar", "print", "private", "prompt", "protected", "prototype", "public", + "RegExp", "releaseEventsresizeBy", "resizeTo", "return", "routeEvent", "scroll", "scrollbars", "scrollBy", "scrollTo", + "self", "setInterval", "setTimeout", "short", "static", "status", "statusbar", "stop", "String", "super", "switch", + "synchronized", "this", "throw", "throws", "toolbar", "top", "toString", "transient", "true", "try", "typeof", "unescape", + "unwatch", "valueOf", "var", "void", "watch", "while", "with", "window"}; + for (String reservedWord : javaScriptReservedWord) { + if (reservedWord.equals(s)) { + return true; + } + } + return false; + } + + /* ================== METHODS TO CHECK VARIOUS FIELDS. ==================== */ /** isSSN returns true if string s is a valid U.S. Social Security Number. Must be 9 digits. */ |
Free forum by Nabble | Edit this page |