On Sunday, April 03, 2011 08:45:12 am Ed Leafe wrote:
> On Apr 3, 2011, at 10:51 AM, John Fabiani wrote:
> > I don't know about Nate but for me that was a little confusing.  Could
> > you explain using the sales order record and the address record as the
> > references.
> 
>       Addresses can't be changed - that's the rule. So when the user of the 
> app
> tries to modify an address, the app needs to create a new address record
> and leave the original intact.
> 
>       Let's assume we have customer ID=1, with address ID=1, who places order
> ID=1. The address table would have customerFK=1, and the order table would
> have both customerFK=1 and addressFK=1.
> 
>       Next year the customer has moved, and places another order. The app user
> would modify the address for that customer and enter the order. When they
> save the order, the address bizobj's beforeSave() would check for
> isChanged=True and isAdding=False. Since this is the case, it would clone
> the current record (id=1), and save that new record. Once it's been saved,
> it would note the new record's ID (let's say it's 33). It would then
> update the order bizobj with the new addressFK. Finally, it would call
> cancel() on the current address record to preserve the original values.
> 
>       When that's done, you would have two records in the address table (ID=1
> and ID=33) with customerFK=1. The two order table records for customerFK=1
> would have different addressFKs: 1 (for the first) and 33 (for the
> second).
> 
> 
> 
> -- Ed Leafe

Thanks that helped.  And in the customer record the FK 33 would be saved for 
future transactions.

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