We would like to hide the AUTHORIZE button in the dialog for Create Payment on Sales Order Entry. The button should be disabled/hidden if Payment Method ID = “CCARD”
Is this something that is possible to do?
I have the code to check the payment method but I’m not sure how or even if it’s possible to hide the AUTHORIZE button when the field is updated.
Thanks for any advice even if it’s just that it’s not possible to do what we want.
Phil
Best answer by Nayan Mansinha
Deetz wrote:
With that knowledge, couldn’t you do a
createPaymentAuthorize.SetEnabled(false);
somewhere?
That somewhere will be in the RowSelected event of the DAC that displays Create Payment dialog. See example code below:
using PX.Data;
using PX.Objects.SO.GraphExtensions.SOOrderEntryExt;
namespace PX.Objects.SO
{
publicclass SOOrderEntry_Extension : PXGraphExtension<CreatePaymentExt, SOOrderEntry>
{
publicstaticboolIsActive() => true;
#region Event Handlersprotectedvirtualvoid _(Events.RowSelected<SOQuickPayment> eventArgs, PXRowSelected baseEvent)
{
baseEvent?.Invoke(eventArgs.Cache, eventArgs.Args);
// control buttons here
Base1.createPaymentAuthorize.SetVisible(
eventArgs.Row.PaymentMethodID != "CCARD");
}
#endregion
}
}
I’m not sure if it’s possible or not, but one alternative could be duplicating the dialog and removing the button from one, so that you have two different versions of the same dialog. If you override where the dialog is called from, you could decide which dialog to show depending on which payment method is used.
Edit:
Just realized I don’t think you have that information prior to the dialog being called, in which case, this wouldn’t work.
(I’d delete this post, but I don’t think that’s possible.)
Failing being able to hide the button is it possible to just pop up a warning message and ignore the button press if the payment method is CCARD? I’ve been looking at the source for SOOrderEntry but can’t seem to find where this is triggered.
The button is a Dialog within the SO301000 screen. I invoked the screen and then used Ctrl+Alt to click on the Authorize button so I could add the screen to a customization project and find the button faster.
Looking at the properties of the button I see that it is calling a command called CreatePaymentAuthorize. I searched through the codebase and found that action declared in CreatePaymentExtBase.cs which is a graph extension.
Now, at this point, I’ve hit the end of my knowledge because I don’t understand how this graph extension is being instantiated so I’m not sure how to write the extension to wrap around it.
Hopefully someone can expand upon that to get you further.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.