Skip to content
Snippets Groups Projects
Commit b92fe364 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

refactor documentation

parent 16153e86
No related branches found
No related tags found
No related merge requests found
......@@ -98,23 +98,45 @@ AddressUtils.getLetterSalutation = function() {
*/
function AddressValidationUtils(){}
/**
* loads COUNTRYINFO.REQUIRED_FIELDS from db
*
* @param {String} countryCode
*
* @return {String} A string containing all mandatory fieldCodes
*
* @ignore
*/
AddressValidationUtils._getRequiredFields = function(countryCode)
{
if (!countryCode)
return "";
var cond = new SqlCondition();
cond.andPrepare("COUNTRYINFO.ISO2", countryCode );
var stmt = cond.buildSelect("select COUNTRYINFO.REQUIRED_FIELDS from COUNTRYINFO");
var requiredFields = db.cell(stmt);
var requiredFields = db.cell(SqlCondition.begin().andPrepare("COUNTRYINFO.ISO2", countryCode)
.buildSelect("select COUNTRYINFO.REQUIRED_FIELDS from COUNTRYINFO"));
return requiredFields;
};
/**
* check if the requested field is a mandatory field
*
* @param {String} countryCode
* @param {String} fieldCode
*
* @return {Boolean}
*/
AddressValidationUtils.isMandatoryField = function(countryCode, fieldCode)
{
var requiredFields = this._getRequiredFields(countryCode);
return requiredFields == "" || requiredFields.search(fieldCode) != -1;
};
/**
* load the regexp for zip validation from the database
*
* @param {String} countryCode
*
* @return {String} the regexp
*/
AddressValidationUtils._getZipValidationRegEx = function(countryCode)
{
if (!countryCode)
......@@ -125,6 +147,14 @@ AddressValidationUtils._getZipValidationRegEx = function(countryCode)
return db.cell(stmt);
};
/**
* check if the zip code is valid
*
* @param {String} countryCode
* @param {String} zipCode
*
* return {Boolean}
*/
AddressValidationUtils.isValidZip = function(countryCode, zipCode)
{
if (zipCode == "")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment