Skip to content

Instantly share code, notes, and snippets.

@tocohara
Created December 21, 2020 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tocohara/ac8a37ddc3cea4037716672b8abdfc8e to your computer and use it in GitHub Desktop.
Save tocohara/ac8a37ddc3cea4037716672b8abdfc8e to your computer and use it in GitHub Desktop.
Override the Re-Open Appointment Method
public delegate IEnumerable ReopenAppointmentDelegate(PXAdapter adapter);
[PXOverride]
public IEnumerable ReopenAppointment(PXAdapter adapter, ReopenAppointmentDelegate baseMethod)
{
try
{
Base.FieldVerifying.AddHandler<FSAppointmentDet.qty>(CancelActualQtyUpdate);
Base.RowDeleting.AddHandler<FSAppointmentLog>(CancelLogDeletion);
var ret = baseMethod(adapter);
return ret;
}
finally
{
Base.FieldVerifying.RemoveHandler<FSAppointmentDet.qty>(CancelActualQtyUpdate);
Base.RowDeleting.RemoveHandler<FSAppointmentLog>(CancelLogDeletion);
}
}
private void CancelLogDeletion(PXCache sender, PXRowDeletingEventArgs e)
{
e.Cancel = true;
}
private void CancelActualQtyUpdate(PXCache sender, PXFieldVerifyingEventArgs e)
{
var row = e.Row as FSAppointmentDet;
e.NewValue = row.Qty;
e.Cancel = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment