On Apr 1, 2011, at 3:56 PM, Nate Lowrie wrote:

> I have a bizobj for an addresses table.  The addresses are tied to 
> customers, orders, and some other places in the system.  The business 
> requirement is that we persist old address data for customers so that 
> the addresses tied to orders don't change.  When a user edits an 
> address, if there are any changes, I need to be able to make a copy of 
> the data as a new record with the is_active field set to true and then 
> revert the old record and set it's is_active field to false. I would 
> like to define this at the bizobj level and I think it should go after 
> validation but before the save completes.
> 
> Does this sound reasonable and if so, would any of y'all have a code 
> snippet for something like this?

        I don't have code available, but I have done things like this for 
medical systems. Generally, you would catch this in the beforeSave(), and if 
the record is not new, insert a new record containing the values in the current 
record, revert the current record, and save the new record. Depending on how 
these records are referenced, you will also need to manage updating anything 
that pointed to the original record that should be pointing to the new record 
by updating the FKs appropriately.



-- Ed Leafe



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to