diff --git a/data/tariffplans/tutorial/Attributes.csv b/data/tariffplans/tutorial/Attributes.csv index f00bbb246..1a7c17ec2 100644 --- a/data/tariffplans/tutorial/Attributes.csv +++ b/data/tariffplans/tutorial/Attributes.csv @@ -1,3 +1,3 @@ #Tenant,ID,Contexts,FilterIDs,ActivationInterval,FieldName,Initial,Substitute,Append,Weight -cgrates.org,ATTR_1,*rating,FLTR_ACNT_1007,2014-01-14T00:00:00Z,Account,*any,1001,false,10 +cgrates.org,ATTR_1,*rating,FLTR_ACNT_1007;*type:name:val,2014-01-14T00:00:00Z,Account,*any,1001,false,10 cgrates.org,ATTR_1,,,,Subject,*any,1001,true, diff --git a/engine/filters.go b/engine/filters.go index b4e88ca14..434f2c8f4 100644 --- a/engine/filters.go +++ b/engine/filters.go @@ -70,14 +70,31 @@ func (fS *FilterS) connStatS() (err error) { return } +type InlineFilter struct { + Type string + FieldName string + FieldVal string +} + +func NewInlineFilter(content string) (f *InlineFilter, err error) { + + return +} + // PassFiltersForEvent will check all filters wihin filterIDs and require them passing for event // there should be at least one filter passing, ie: if filters are not active event will fail to pass func (fS *FilterS) PassFiltersForEvent(tenant string, ev map[string]interface{}, filterIDs []string) (pass bool, err error) { var atLeastOneFilterPassing bool for _, fltrID := range filterIDs { - f, err := fS.dm.GetFilter(tenant, fltrID, false, utils.NonTransactional) - if err != nil { - return false, err + var f *Filter + if strings.HasPrefix(fltrID, "*") { + fmt.Printf("fltr %+v", fltrID) + } else { + fmt.Printf("enter here with ID %s", fltrID) + f, err = fS.dm.GetFilter(tenant, fltrID, false, utils.NonTransactional) + if err != nil { + return false, err + } } if f.ActivationInterval != nil && !f.ActivationInterval.IsActiveAtTime(time.Now()) { // not active