Updated Accounts

This commit is contained in:
Trial97
2021-02-09 14:19:03 +02:00
committed by Dan Christian Bogos
parent 6d9585b1ff
commit 167f7c0a4a
3 changed files with 10 additions and 9 deletions

View File

@@ -110,14 +110,9 @@ func (aS *AccountS) matchingAccountForEvent(tnt string, cgrEv *utils.CGREvent,
}
return
}
if _, isDisabled := qAcnt.Opts[utils.Disabled]; isDisabled {
if lked {
guardian.Guardian.UnguardIDs(refID)
}
continue
}
if qAcnt.ActivationInterval != nil && cgrEv.Time != nil &&
!qAcnt.ActivationInterval.IsActiveAtTime(*cgrEv.Time) { // not active
if _, isDisabled := qAcnt.Opts[utils.Disabled]; isDisabled ||
(qAcnt.ActivationInterval != nil && cgrEv.Time != nil &&
!qAcnt.ActivationInterval.IsActiveAtTime(*cgrEv.Time)) { // not active
if lked {
guardian.Guardian.UnguardIDs(refID)
}
@@ -138,6 +133,9 @@ func (aS *AccountS) matchingAccountForEvent(tnt string, cgrEv *utils.CGREvent,
if acnt == nil || acnt.Weight < qAcnt.Weight {
acnt = qAcnt
if lked {
if lkID != utils.EmptyString {
guardian.Guardian.UnguardIDs(lkID)
}
lkID = refID
}
} else if lked {

View File

@@ -941,7 +941,7 @@ func (iDB *InternalDB) GetAccountProfileDrv(tenant, id string) (ap *utils.Accoun
if !ok || x == nil {
return nil, utils.ErrNotFound
}
return x.(*utils.AccountProfile), nil
return x.(*utils.AccountProfile).Clone(), nil
}
func (iDB *InternalDB) SetAccountProfileDrv(ap *utils.AccountProfile) (err error) {

View File

@@ -139,6 +139,9 @@ func (aP *AccountProfile) Clone() (acnt *AccountProfile) {
//Clone returns a clone of the ActivationInterval
func (aI *ActivationInterval) Clone() *ActivationInterval {
if aI == nil {
return nil
}
return &ActivationInterval{
ActivationTime: aI.ActivationTime,
ExpiryTime: aI.ExpiryTime,