[Vtigercrm-developers] Event handlers add/update distinction
Prasad
prasad at vtiger.com
Thu Jan 6 23:18:38 PST 2011
Darjan,
The event handler parameter will have the information
about the record mode as depicted below:
class MyModuleEventHandler extends VTEventHandler {
function handleEvent($eventName, $data) {
if ($data->isNew()) {
// Create of new record
} else {
// Edit of older record
}
}
}
Regards,
Prasad
vtiger Team
On Fri, Jan 7, 2011 at 11:45 AM, Darjan Prtic <dprtic at gmail.com> wrote:
> Hi!
>
> Is there a way using event handlers to distinct when some record is being
> updated (edited and then saved) and newly added?
> When new record is saved i make relations in vtiger_crmentityrel table by
> inserting corresponding crmid of that module and contact, also vice versa. I
> do that in aftersave event because i need crmid of record that is being
> created. That works fine. But now i have a problem when i just edit that
> record and save it. New, unnecessary insert is being made to
> vtiger_crmentityrel table with already existing values. What should be done
> is _only_ update if necessary.
>
> I use vtiger 5.10.
>
> Thank you!
> Darjan Prtic
>
> _______________________________________________
> http://www.vtiger.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20110107/8ba24b07/attachment-0002.html
More information about the vtigercrm-developers
mailing list