From 7d8c9da2af38803dd4f4b87a67c0b013079987db Mon Sep 17 00:00:00 2001 From: DanB Date: Mon, 17 Aug 2015 13:06:52 +0200 Subject: [PATCH] ApierV1.SetAccount - add Disabled option, proper AllowNegative implementation --- apier/v1/accounts.go | 9 +++++++-- utils/apitpdata.go | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apier/v1/accounts.go b/apier/v1/accounts.go index f9c3b53ed..b8702597c 100644 --- a/apier/v1/accounts.go +++ b/apier/v1/accounts.go @@ -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 diff --git a/utils/apitpdata.go b/utils/apitpdata.go index 3adbde62a..861242b50 100644 --- a/utils/apitpdata.go +++ b/utils/apitpdata.go @@ -1080,7 +1080,8 @@ type AttrSetAccount struct { Direction string Account string ActionPlanId string - AllowNegative bool + AllowNegative *bool + Disabled *bool } type AttrRemoveAccount struct {