[Vtigercrm-developers] Event issue

Nicolas Larcipretti niclarcipretti at gmail.com
Thu Jul 28 16:22:44 PDT 2011


Yes that's the exact workaround i'm using...not pretty but works....

Cheers

Nicolas

2011/7/28 Asha <asha at vtiger.com>

> Hi Nicolas,
>
> There is another parameter for the register api, which lets you specify the
> condition on which you want the event to be triggered. The type of condition
> allowed is something like "module IN ('Accounts')".
>
> But unfortunately, we have an issue in parsing the condition and hence the
> condition part is not working right now.
>
> As a workaround, you can add a condition in your event handler, to perform
> the action only if the module is 'Accounts'.
> For eg:
> Something like below would workout for you:
>
> if($eventName == 'vtiger.entity.aftersave') {
>  $moduleName = $entityData->getModuleName();
> if ($moduleName == 'Accounts') {
>                                 .......
>                         }
> }
>
> On Wed, Jun 8, 2011 at 11:50 PM, Nicolas Larcipretti <
> niclarcipretti at gmail.com> wrote:
>
>> Hi folks,
>>
>> I'm having some trouble registering events on vtiger. I register them
>> giving a specific module by parameter, but it seem to be applying the event
>> for every single module in the system.
>>
>> Example:
>>
>> require_once('vtlib/Vtiger/Module.php');
>>
>> $modulo = Vtiger_Module::getInstance('Accounts');
>>
>> $evento =
>> Vtiger_Event::register($modulo,'vtiger.entity.beforesave','MyClass','myclass.php');
>>
>> This event triggers everytime I save an account, but it also triggers when
>> I save a Contact. Why vtiger is not respecting the module I gave when I
>> create the event? Is there any workaround to this issue?
>>
>> Cheers,
>>
>> Nicolas
>>
>>
>> _______________________________________________
>> http://www.vtiger.com/
>>
>
>
>
> --
> Regards,
> Asha
> vtiger Team
>
> *Connect with us on: *Twitter <http://twitter.com/#%21/vtigercrm> *I*
> Facebook <http://www.facebook.com/pages/vtiger/226866697333578?sk=wall> *I
> * Blog <http://blog.vtiger.com/>* I* Wiki<http://wiki.vtiger.com/index.php/Main_Page>
>  *I *Forums  <http://forums.vtiger.com/>*I* Website <http://vtiger.com/>
>
>
> _______________________________________________
> http://www.vtiger.com/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20110728/7ca7aa23/attachment-0002.html 


More information about the vtigercrm-developers mailing list