【发布时间】:2021-12-14 17:58:39
【问题描述】:
我有以下代码来覆盖采购订单条目屏幕上的“电子邮件采购订单”操作。
代码编译并显示消息,但在选择是或否后,消息会一次又一次地显示,直到我单击 X。知道什么会导致这种情况吗?
public delegate IEnumerable NotificationDelegate(PXAdapter adapter, String notificationCD);
[PXOverride]
public IEnumerable Notification(PXAdapter adapter, String notificationCD, NotificationDelegate baseMethod)
{
if(Base.Document.Ask("Are you sure you want to Email the PO?", MessageButtons.YesNo)
!= WebDialogResult.Yes) return adapter.Get();
return baseMethod(adapter, notificationCD);
}
更新:
这是我最近的尝试,但仍然无法正常工作。代码编译,但我从来没有得到消息框。添加了一条跟踪消息以确认它正在命中代码:
public PXAction<POOrder> notification;
[PXUIField(DisplayName = "Notifications", Visible = false)]
[PXButton(ImageKey = PX.Web.UI.Sprite.Main.DataEntryF)]
protected virtual IEnumerable Notification(PXAdapter adapter,
[PXString] string notificationCD)
{
PXTrace.WriteInformation("Reached Notification Action - Notification CD = " + notificationCD + '|');
if (notificationCD == "PURCHASE ORDER")
{
PXTrace.WriteInformation("Notification Action - If reached");
if(Base.Document.Ask("Are you sure you want to Email the PO?", MessageButtons.YesNo)
!= WebDialogResult.Yes) return adapter.Get();
}
return Base.notification.Press(adapter);
}
【问题讨论】:
标签: acumatica