How to show only attended events in events subpanel

@jyotip
Look at as example:

  1. modules/Activities/metadata/subpaneldefs.php and variable ‘where’ in array ‘Meetings’ or ‘Tasks’ . It’s for events.
  2. modules/Accounts/metadata/subpanels/default.php variable ‘where’ . It’s for another modules.

Hi @p.konetskiy, Thanks for your reply :slight_smile:

I want to show only those records in events sub panel of contacts module which have attended status.

Suppose contact ‘A’ got the invitation for 2 events X an Y but he attended only X, So now when we open ‘A’ record in its event subpanel, it should show only X.

How we can do this?

@jyotip
I tested decision:
You can edit the files:

  1. modules/Meetings/metadata/subpanels/ForActivities.php for Meetings.
  2. modules/Calls/metadata/subpanels/ForActivities.php for Calls.

and change from:

...
'where' => "(meetings.status !='Held' AND meetings.status !='Not Held')",
...

to:

...
'where' => "(meetings.status !='Held' AND meetings.status !='Not Held' AND meetings_contacts.accept_status='Accepted')",
...

Hi @p.konetskiy,

Thank you so much for your reply :).

Actually my requirement is related to this .

@jyotip
SuiteCRM send your Contact email with invitation for the meeting. If your Contact click “Accepted” than the field ‘accept_status’ will be changed.

@p.konetskiy,

I am getting MySQL error 1054: Unknown column ‘meetings_contacts.accept_status’ in ‘where clause’ error if i add -
‘where’ => “(meetings.status !=‘Held’ AND meetings.status !=‘Not Held’ AND meetings_contacts.accept_status=‘Accepted’)”,

@jyotip
It’s very strange because the table “meetings_contacts” and the column “accept_status” were included to base system since SugarCRM CE. It’s the link between modules Meeting and Contact. You can show file metadata/meetings_contactsMetaData.php .
If you can check tables in data base.

contact module’s (Event subpanel) -

Event module -

this is still same

@p.konetskiy Thanks a lot for helping me

@jyotip
I wrote about Meeting as an example.
For module FP_events code here:
Edit file: modules/Contacts/metadata/subpanels/FP_events_subpanel_fp_events_contacts.php
and after

global $app_strings;

add line:

$subpanel_layout['where']="fp_events_contacts_c.accept_status='Accepted'";

It’s work. I tested.

Without code:

With code:

@p.konetskiy,

The query is working on delegates subpanel but the problem is that it is not allowing me to select delegates from select delegates option.

I want to apply this query for the event subpanel of the contacts module.

the activity status remains none always.

@jyotip
The field ‘activity_status_type’ whose label ‘Activity Status’ present in SuiteCRM but don’t use. You can add logic for this field manually.

Hello @p.konetskiy,

How we can add invite_status field in event subpanel of contact module to show only those events which have attended status.

@jyotip
You can use logichook: process_record . Look at information here: https://docs.suitecrm.com/developer/logic-hooks/
When the record is read you can analyse Delegates data of Events and write correct status.

Hi @p.konetskiy,

If i am using process record logic hook, my query is not executing from this logic hook for events.

Can you check at you end.

Thanks

Hi, @jyotip
Can you show your code?

Sure,
./custom/Extension/modules/FP_events/Ext/LogicHooks/eventquery.php

./custom/modules/FP_events/process_record_class.php

Initialize hook_array before adding to it

$hook_array['process_record'] = Array();
$hook_array['process_record'][] =  .... etc

Hi @pgr,

I initialized it, but still it’s same

Check your php_errors.log for any errors. The path for it is defined in your php.ini.

And instead of outputting things onto the screen to check if the hook is running, try writing to the logs instead. Hooks are not made to output any views, you never know where your output is going, it won’t necessarily be visible, and it might even break the screen.

Hi,

I am able to write query as per my wish but the problem is i am unable to hide those rows from sub panel which doesn’t has “Attended” status and it is affecting list view of events module also which i don’t want.

if there is a record in subpanel which don’t have attended status, i don’t want to show that row at all.

Please guide how we can hide rows from subpanel as per query.

Thanks