shadow9449
Registered User.
- Local time
- Today, 14:07
- Joined
- Mar 5, 2004
- Messages
- 1,037
I've developed a custom delete sequence that I think many people could benefit from. The problem is that it's not working properly and I can't figure out why not.
The goal is that if a user deletes an invoice, the user is prompted for a reason for the deletion and then the cancelled invoice is logged with the Invoice Number, Client Name, Amount and Reason for deletion. This makes auditors (and accounting and management) happier rather than just see missing invoices and it's more user-friendly than just not allowing people to delete their mistakes.
Here's how I implemented it:
- In the form's Delete method, I put a few lines of code that opens a form in dialogue mode (that way it won't just delete until the user finishes entering the reason) with a text box where the user can enter a reason. There is an OK and Cancel button on this screen. I have a global variable called CANCELDELETE which is set to True if the user clicks cancel and False if the User enters a reason and clicks OK. When the user clicks ok, there is an SQL statement that INSERTS the information about the invoice into the Cancel Log
- The next line of code in the Delete method simply says Cancel = CANCELDELETE. That way the user had a chance to abort the deletion from the screen mentioned in the previous step.
Sounds pretty simple and useful but here's what happens:
- When you click Delete the invoice disappears. This is normal as it's placed into a buffer until the Delete method, Before_DelConfirm and After Del Confirm all fire.
- The dialogue box opens where you enter the reason.
- When you click ok, the invoice is gone.
- When you come back to the invoice, it's back! It's logged correctly.
I've played extensively with different tests including reading the response code from the After_del_Confirm method and I get a response that the deletion occurred properly.
The part that's most difficult is that this happens about 50% of the time and the other 50% of the time the invoice is indeed deleted.
So, my questions are:
- Does anyone know WHY an invoice would appear to delete and then come back?
- If not, can anyone recommend an alternate method of allowing a user to enter a deletion reason?
Thanks very much
SHADOW
The goal is that if a user deletes an invoice, the user is prompted for a reason for the deletion and then the cancelled invoice is logged with the Invoice Number, Client Name, Amount and Reason for deletion. This makes auditors (and accounting and management) happier rather than just see missing invoices and it's more user-friendly than just not allowing people to delete their mistakes.
Here's how I implemented it:
- In the form's Delete method, I put a few lines of code that opens a form in dialogue mode (that way it won't just delete until the user finishes entering the reason) with a text box where the user can enter a reason. There is an OK and Cancel button on this screen. I have a global variable called CANCELDELETE which is set to True if the user clicks cancel and False if the User enters a reason and clicks OK. When the user clicks ok, there is an SQL statement that INSERTS the information about the invoice into the Cancel Log
- The next line of code in the Delete method simply says Cancel = CANCELDELETE. That way the user had a chance to abort the deletion from the screen mentioned in the previous step.
Sounds pretty simple and useful but here's what happens:
- When you click Delete the invoice disappears. This is normal as it's placed into a buffer until the Delete method, Before_DelConfirm and After Del Confirm all fire.
- The dialogue box opens where you enter the reason.
- When you click ok, the invoice is gone.
- When you come back to the invoice, it's back! It's logged correctly.
I've played extensively with different tests including reading the response code from the After_del_Confirm method and I get a response that the deletion occurred properly.
The part that's most difficult is that this happens about 50% of the time and the other 50% of the time the invoice is indeed deleted.
So, my questions are:
- Does anyone know WHY an invoice would appear to delete and then come back?
- If not, can anyone recommend an alternate method of allowing a user to enter a deletion reason?
Thanks very much
SHADOW