fixes for keeping account ids

This commit is contained in:
Radu Ioan Fericean
2016-01-22 15:47:42 +02:00
parent a0c4613adc
commit 2e2edcf233
3 changed files with 12 additions and 3 deletions

View File

@@ -672,7 +672,10 @@ func (ms *MapStorage) SetActionPlan(key string, ats *ActionPlan) (err error) {
return
}
// get existing action plan to merge the account ids
if existingAts, _ := ms.GetActionPlan(utils.ACTION_PLAN_PREFIX, true); existingAts != nil {
if existingAts, _ := ms.GetActionPlan(key, true); existingAts != nil {
if ats.AccountIDs == nil && len(existingAts.AccountIDs) > 0 {
ats.AccountIDs = make(utils.StringMap)
}
for accID := range existingAts.AccountIDs {
ats.AccountIDs[accID] = true
}

View File

@@ -1167,7 +1167,10 @@ func (ms *MongoStorage) SetActionPlan(key string, ats *ActionPlan) error {
return nil
}
// get existing action plan to merge the account ids
if existingAts, _ := ms.GetActionPlan(utils.ACTION_PLAN_PREFIX, true); existingAts != nil {
if existingAts, _ := ms.GetActionPlan(key, true); existingAts != nil {
if ats.AccountIDs == nil && len(existingAts.AccountIDs) > 0 {
ats.AccountIDs = make(utils.StringMap)
}
for accID := range existingAts.AccountIDs {
ats.AccountIDs[accID] = true
}

View File

@@ -928,7 +928,10 @@ func (rs *RedisStorage) SetActionPlan(key string, ats *ActionPlan) (err error) {
return err
}
// get existing action plan to merge the account ids
if existingAts, _ := rs.GetActionPlan(utils.ACTION_PLAN_PREFIX, true); existingAts != nil {
if existingAts, _ := rs.GetActionPlan(key, true); existingAts != nil {
if ats.AccountIDs == nil && len(existingAts.AccountIDs) > 0 {
ats.AccountIDs = make(utils.StringMap)
}
for accID := range existingAts.AccountIDs {
ats.AccountIDs[accID] = true
}