Re: Making changes to EO after validation?
Re: Making changes to EO after validation?
- Subject: Re: Making changes to EO after validation?
- From: Stirling Olson <email@hidden>
- Date: Thu, 12 May 2005 23:28:41 -0600
Right, but if 4c "flew away" I need to adjust the CashBox.balance
when I end the shift (and the money gets counted) so the next shift
has the actual cash starting balance when they get the cash box. I
only want to change this balance in the cash box once we have a
"final answer" from the user who's shift is ending. This way the
cash box balance stays at the value it SHOULD have in it until the
user swears up and down and then gives some excuse (discrepancy) for
why the balance doesn't match. I don't want to set the
CashBox.balance to the new value BEFORE ending the shift because then
if the EO save to end the Shift fails validation I have to remember
to go back and put the CashBox.balance to its original value.
Anyhow, point taken re: post-validation changes = no-no. I'll stick to:
1) check validateForSave()
2) if (1) succeeds then update CashBox.balance (when necessary)
3) saveChanges()
Just means validateForSave() gets called twice for each save and I
have to remember to do this exercise each time (and place) where I
may end a shift but such is life.
Thanks again.
Best,
Stirling
On May 12, 2005, at 11:12 PM, Anjo Krank wrote:
Am 13.05.2005 um 07:02 schrieb Stirling Olson:
The 2x save was actually so I WOULDN"T screw up the cycle. Wasn't
optimal though because my updates weren't atomic which is why I
changed to just check validateUpdate() and if that succeeds then I
set the CashBox.balance and then saveChanges(). Presto, BUT but I
have to do it in all components that might have this happen
instead of just once in the EO.
Look, I'm not in the retail businessa nd I may not get your problem
correctly, but... a cashbox's balance is the amount of money that's
in it. If that is not enough, you'd have a set of notes saying
"oops there is 5c missing, frank", "here I took another 4c, jim"
etc. So the totalBalance is email@hiddenepacy.
Now at the end of the shift, you'd compare Shift.endingBalance to
totalBalance and see if *those* match.
In real live, your money in the Cachbox doesn't get magically
increased too, does it?
Anyway, you just don't modify stuff after validation, as it would
defeat the whole purpose (from the frameworks POV)
Cheers, Anjo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden