private void InitAttribute(Type search, Type branchID, bool filterBranch, bool suppressActiveVerify) { _branchID = branchID; search = search ?? typeof(Search <CashAccount.cashAccountID>); Type searchCommand = generateNewSearch(search.GetGenericArguments(), _branchID, filterBranch); if (searchCommand == null) { throw new PXArgumentException("search", ErrorMessages.ArgumentException); } var dimensionSelectorAttribute = new PXDimensionSelectorAttribute(DimensionName, searchCommand, typeof(CashAccount.cashAccountCD), _selectorCols) { CacheGlobal = true, DescriptionField = typeof(CashAccount.descr) }; _Attributes.Add(dimensionSelectorAttribute); _SelAttrIndex = _Attributes.Count - 1; this.Filterable = true; if (!suppressActiveVerify) { Type msgParam = typeof(CashAccount.cashAccountCD); PXRestrictorAttribute cashAccountActiveStatusRestrictor = new PXRestrictorAttribute(typeof(Where <CashAccount.active, Equal <True> >), CA.Messages.CashAccountInactive, msgParam); _Attributes.Add(cashAccountActiveStatusRestrictor); } }
private void InitializeAttributeRestrictions(bool onlyActive, Type organizationFieldType, Type featureFieldType) { if (onlyActive) { _Attributes.Add(new PXRestrictorAttribute(typeof(Where <Branch.active, Equal <True> >), Messages.BranchInactive)); } PXRestrictorAttribute organizationRestrictor; if (featureFieldType == null) { organizationRestrictor = new PXRestrictorAttribute(BqlCommand.Compose( typeof(Where <, ,>), typeof(Branch.organizationID), typeof(Equal <>), typeof(Optional2 <>), organizationFieldType, typeof(Or <,>), typeof(Optional2 <>), organizationFieldType, typeof(IsNull)), Messages.TheSpecifiedBranchDoesNotBelongToTheSelectedCompany); } else { organizationRestrictor = new PXRestrictorAttribute(BqlCommand.Compose( typeof(Where <, ,>), typeof(Branch.organizationID), typeof(Equal <>), typeof(Optional2 <>), organizationFieldType, typeof(And <, ,>), typeof(Optional2 <>), organizationFieldType, typeof(IsNotNull), typeof(Or <>), typeof(Where <, ,>), typeof(Optional2 <>), organizationFieldType, typeof(IsNull), typeof(And <>), typeof(Not <>), typeof(FeatureInstalled <>), featureFieldType), Messages.TheSpecifiedBranchDoesNotBelongToTheSelectedCompany); } _Attributes.Add(organizationRestrictor); }