-
-
Save tac-ljustiniano/b47e0b708d8bf6378329c9684394b788 to your computer and use it in GitHub Desktop.
Removes a Location named "B_INV" from the list of locations based on a selected warehouse (SiteID)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using PX.Data; | |
using PX.Data.BQL; | |
using PX.Objects.IN; | |
namespace TEST | |
{ | |
public class LocationExtType | |
{ | |
public const string B_INV = "B-INV"; | |
public class b_INV : PX.Data.BQL.BqlString.Constant<b_INV> | |
{ | |
public b_INV() : base(B_INV) { } | |
} | |
} | |
public class LocationExtAttribute : LocationAttribute | |
{ | |
public LocationExtAttribute(Type SiteIDType, Type ExcludeLoc) : base(SiteIDType) | |
{ | |
_SiteIDType = SiteIDType ?? throw new PXArgumentException(nameof(SiteIDType), ErrorMessages.ArgumentNullException); | |
Type search = BqlTemplate.OfCommand< | |
Search<INLocation.locationID, | |
Where<INLocation.siteID, Equal<Optional<BqlPlaceholder.A>>, | |
And<INLocation.locationCD, NotEqual<BqlPlaceholder.B>>>>> | |
.Replace<BqlPlaceholder.A>(_SiteIDType) | |
.Replace<BqlPlaceholder.B>(ExcludeLoc) | |
.ToType(); | |
var attr = new LocationDimensionSelectorAttribute(search, GetSiteIDKeyRelation(SiteIDType)); | |
_Attributes.Add(attr); | |
_SelAttrIndex = _Attributes.Count - 1; | |
} | |
} | |
public class InventorySummaryEnq_Extension : PXGraphExtension<PX.Objects.IN.InventorySummaryEnq> | |
{ | |
public static bool IsActive() => true; // Check for Feature | |
[PXMergeAttributes(Method = MergeMethod.Replace)] | |
[LocationExt(typeof(InventorySummaryEnqFilter.siteID), typeof(LocationExtType.b_INV), Visibility = PXUIVisibility.Visible, KeepEntry = false, DescriptionField = typeof(INLocation.descr), DisplayName = "Location")] | |
protected void _(Events.CacheAttached<InventorySummaryEnqFilter.locationID> e) { } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using PX.Data; | |
using PX.Data.BQL; | |
using PX.Objects.IN; | |
namespace TEST | |
{ | |
public class LocationExtType | |
{ | |
public const string B_INV = "B-INV"; | |
public class b_INV : PX.Data.BQL.BqlString.Constant<b_INV> | |
{ | |
public b_INV() : base(B_INV) { } | |
} | |
} | |
public class InventorySummaryEnq_Extension : PXGraphExtension<PX.Objects.IN.InventorySummaryEnq> | |
{ | |
public static bool IsActive() => true; // Check for Feature | |
[PXMergeAttributes(Method = MergeMethod.Append)] | |
[PXRestrictor(typeof(Where<INLocation.locationCD, NotEqual<LocationExtType.b_INV>>),"")] | |
protected void _(Events.CacheAttached<InventorySummaryEnqFilter.locationID> e) { } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simple version added after good note by Daryl Bowman