Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
basic
Commits
b92fe364
Commit
b92fe364
authored
6 years ago
by
Johannes Hörmann
Browse files
Options
Downloads
Patches
Plain Diff
refactor documentation
parent
16153e86
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
process/PostalAddress_lib/process.js
+34
-4
34 additions, 4 deletions
process/PostalAddress_lib/process.js
with
34 additions
and
4 deletions
process/PostalAddress_lib/process.js
+
34
−
4
View file @
b92fe364
...
...
@@ -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
==
""
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment