On Friday, April 01, 2011 02:03:17 pm Paul McNett wrote:
> On 4/1/11 12: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've always handled this by having address fields at the order level, that
> get copied from the customer record when the order is created...
> 
> Paul
I follow Paul's way when I can.  But I know of at least two different 
accounting systems that do it differently - xTuple and NetSuite (oracle).  In 
their case each of them have fields in the tables that act as flags.
In the address table
addr_active boolean

In the contact table
address_change

to find the address you have to check both fields to locate the current active 
address.  So when creating a SO the pk of current address is saved as a FK.  
So deleting an address is not allowed if there is associated document.

Johnf

_______________________________________________
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