I have two modules, leads and payments, that I want to relate via a logic hook. I have several fields saving correctly from the leads editview into the payments module but the two aren't relating on the save. I've seen several examples but I can't quite figure it out. The relationship is one lead to many payments. The version is 6.3.1 CE. Could anyone please give me a simple example on how to get the two to insert the relationship into the database properly? I'd prefer to use beans over inserting directly into the database if that's possible. Thanks!
Here is the code I've been using so far...
Code:function insertPayments(&$bean, $event, $arguments) { $custDownPay = 0; $weekBtwn = 0; $payAmnt = 0; $leadID = $bean->id; $objPayment = new pay_Payments(); $objPayment->load_relationship('Leads'); $leadID = $bean->id; $objPayment->id = $leadID; $payAmt = $bean->payments_amount_c; $objPayment->payment_amount = $payAmnt; $weekBtwn = $bean->weeks_btwn_pay_c; $objPayment->weed_btwn_pay = $weekBtwn; $objPayment->save(); }


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks