ApierV1.SetAccount - add Disabled option, proper AllowNegative implementation

This commit is contained in:
DanB
2015-08-17 13:06:52 +02:00
parent 2aebd5e080
commit 7d8c9da2af
2 changed files with 9 additions and 3 deletions

View File

@@ -168,8 +168,7 @@ func (self *ApierV1) SetAccount(attr utils.AttrSetAccount, reply *string) error
ub = bal
} else { // Not found in db, create it here
ub = &engine.Account{
Id: balanceId,
AllowNegative: attr.AllowNegative,
Id: balanceId,
}
}
@@ -183,6 +182,12 @@ func (self *ApierV1) SetAccount(attr utils.AttrSetAccount, reply *string) error
at.AccountIds = append(at.AccountIds, balanceId)
}
}
if attr.AllowNegative != nil {
ub.AllowNegative = *attr.AllowNegative
}
if attr.Disabled != nil {
ub.Disabled = *attr.Disabled
}
// All prepared, save account
if err := self.AccountDb.SetAccount(ub); err != nil {
return 0, err

View File

@@ -1080,7 +1080,8 @@ type AttrSetAccount struct {
Direction string
Account string
ActionPlanId string
AllowNegative bool
AllowNegative *bool
Disabled *bool
}
type AttrRemoveAccount struct {