Updated internalDB.GetCDRs for *exist case

This commit is contained in:
Trial97
2020-01-21 17:07:52 +02:00
parent c3445c93bd
commit a3c5c1fa25

View File

@@ -1045,11 +1045,11 @@ func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*C
filter.NotSubjects = nil
filter.Subjects = nil
default:
if val, has := filter.ExtraFields[cdrIdx]; has {
if val, has := filter.ExtraFields[cdrIdx]; has && val != utils.MetaExists { // if the filter value is *exist it should not be treated as a indexed field
pairSlice = append(pairSlice, filterPair{cdrIdx, []string{val}})
delete(filter.ExtraFields, cdrIdx)
}
if val, has := filter.NotExtraFields[cdrIdx]; has {
if val, has := filter.NotExtraFields[cdrIdx]; has && val != utils.MetaExists { // if the filter value is *exist it should not be treated as a indexed field
notPairSlice = append(notPairSlice, filterPair{cdrIdx, []string{val}})
delete(filter.NotExtraFields, cdrIdx)
}
@@ -1063,11 +1063,11 @@ func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*C
filter.DestinationPrefixes = nil
filter.NotDestinationPrefixes = nil
default:
if val, has := filter.ExtraFields[cdrIdx]; has {
if val, has := filter.ExtraFields[cdrIdx]; has && val != utils.MetaExists { // if the filter value is *exist it should not be treated as a indexed field
pairSlice = append(pairSlice, filterPair{cdrIdx, []string{val}})
delete(filter.ExtraFields, cdrIdx)
}
if val, has := filter.NotExtraFields[cdrIdx]; has {
if val, has := filter.NotExtraFields[cdrIdx]; has && val != utils.MetaExists { // if the filter value is *exist it should not be treated as a indexed field
notPairSlice = append(notPairSlice, filterPair{cdrIdx, []string{val}})
delete(filter.NotExtraFields, cdrIdx)
}