In the Sales Order screen, there is this view :
public PXSelect<SiteStatus> sitestatusview;
And SiteStatus table is declared as this :
[SiteStatusAccumulator]
[PXDisableCloneAttributes()]
[Serializable]
public partial class SiteStatus : INSiteStatus, IQtyAllocated
{...
...}
SiteStatusAccumulator among its usage is to check available quantities. And I want to override this validation. Particularly the SiteStatusAccumulator.PersistInserted method. With fields, I can cache_attached and override the attributes. But with tables, how can you achieve something similar ?
I have a need to override the Select statement being used for the SOShipmentPlan PXProjection/DAC, namely, removing the
And <INPlanType.isFixed, Equal<boolFalse>
condition.
I can override all of the CreateShipment() logic and bring in any other necessary routines into an SOShipmentEntry_Extension class, to the point where I finally can use my own version of a SOShipmentPlan class, but that all seems needlessly complex when all I want to do is override the select for the PXProjection attribute. Overriding CreateShipment() and supporting routines also seems like a quick way to get in trouble come time for upgrades.
So, is there an easy way to override the PXProjection's BQL, or am I stuck overriding all kinds of code?
UPDATE 1
Based on a link provided below (stackoverflow.com/a/41540659/7376238), I feel like I'm close. Here's the block of code I end up with:
namespace PX.Objects.SO
{
public class SOShipmentEntry_Extension : PXGraphExtension<SOShipmentEntry>
{
#region Event Handlers
#endregion
[Serializable]
[PXProjection(typeof(Select2<SOOrder,
InnerJoin<SOOrderType, On<SOOrder.FK.OrderType>,
InnerJoin<INItemPlan, On<INItemPlan.refNoteID, Equal<SOOrder.noteID>>,
InnerJoin<INPlanType, On<INItemPlan.FK.PlanType>>>>,
Where<INItemPlan.hold, Equal<boolFalse>,
And<INItemPlan.planQty, Greater<decimal0>,
And<INPlanType.isDemand, Equal<boolTrue>,
And<INPlanType.isForDate, Equal<boolTrue>,
And<Where<INItemPlan.fixedSource, IsNull,
Or<INItemPlan.fixedSource, NotEqual<INReplenishmentSource.transfer>>>>>>>>>))]
[PXSubstitute()]
public partial class SOShipmentPlanCst : SOShipmentPlan
{
int x = 0;
}
}
But it doesn't seem to work. Not sure of where I'm supposed to put the code. I've tried putting the class definition inside and outside of public class SOShipmentEntry_Extension : PXGraphExtension<SOShipmentEntry> class (currently inside the extension class as shown). No luck either way.
THIS ANSWER DIDN'T WORK
Fair warning... I have not done this to a PXProjection before, so you'll have to see if this works. The nature of extensions tends to allow overriding views by simply redefining them. I have not done this myself with a projection, but I suspect it will be similar. Give it a try and see if you get the desired results. All I can say about testing it is that "it compiled" when I added to my project and removed the INItemPLanType.isFixed condition.
public class SOShipmentEntry_Extension : PXGraphExtension<SOShipmentEntry>
{
[PXProjection(typeof(Select2<SOOrder,
InnerJoin<SOOrderType, On<SOOrder.FK.OrderType>,
InnerJoin<INItemPlan, On<INItemPlan.refNoteID, Equal<SOOrder.noteID>>,
InnerJoin<INPlanType, On<INItemPlan.FK.PlanType>>>>,
Where<INItemPlan.hold, Equal<boolFalse>,
And<INItemPlan.planQty, Greater<decimal0>,
And<INPlanType.isDemand, Equal<boolTrue>,
And<INPlanType.isForDate, Equal<boolTrue>,
And<Where<INItemPlan.fixedSource, IsNull, Or<INItemPlan.fixedSource, NotEqual<INReplenishmentSource.transfer>>>>>>>>>))]
public partial class SOShipmentPlan : IBqlTable { }
}
I created an interface ISecureStorageProvider like below.
public interface ISecureStorageProvider : IStorageProvider
{
}
Concrete implementation for ISecureStorageProvider looks like below.
public class SecureAzureBlobStorageProvider : AzureFileSystem, ISecureStorageProvider
{
}
What I found was, the class SecureAzureBlobStorageProvider gets injected for both the interfaces ISecureStorageProvider , IStorageProvider. But, I want both of them to be available, not one suppressing another.
is there a way to get the name of a child class inside of a super class?
class ChildClass inherits SuperClass { }
class SuperClass {
notify { "$NAME_OF_CHILD_CLASS is inheriting me": }
}
The expected output would be ChildClass is inheriting me. I'd need something similar to $module_name which contains the name of the class that contains the current resource's definition.
Is there a way to achieve this? I don't mind if I need a custom function for that...
Is there a way to pass the parameters to the LoadControl function when loading the user control dynamically?
I found a solution that uses reflection here
All you need to do is create a descendant of the UserControl class, add a default constructor and another constructor that takes your parameters. The parameterless constructor is necessary for designer support.
public class MyControl : UserControl
{
public MyControl() : base()
{
// do initialization stuff...
}
public MyControl(int parameter) : this()
{
// do additional stuff with parameter
}
}