Created
December 21, 2020 02:24
-
-
Save tocohara/ac8a37ddc3cea4037716672b8abdfc8e to your computer and use it in GitHub Desktop.
Override the Re-Open Appointment Method
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
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