mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 07:27:33 +08:00
support sub account
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
const PARENT_ACCOUNT_CURRENCY_PLACEHODLER = "---"
|
||||
|
||||
// ISO 4217
|
||||
var ALL_CURRENCY_NAMES = map[string]bool {
|
||||
"AED": true, //UAE Dirham
|
||||
@@ -167,6 +169,10 @@ var ALL_CURRENCY_NAMES = map[string]bool {
|
||||
|
||||
func ValidCurrency(fl validator.FieldLevel) bool {
|
||||
if value, ok := fl.Field().Interface().(string); ok {
|
||||
if value == PARENT_ACCOUNT_CURRENCY_PLACEHODLER {
|
||||
return true
|
||||
}
|
||||
|
||||
_, ok := ALL_CURRENCY_NAMES[value]
|
||||
return ok
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user