CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Show current employer in Find particpants search results in 2.1
Pages: [1]

Author Topic: Show current employer in Find particpants search results in 2.1  (Read 1624 times)

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Show current employer in Find particpants search results in 2.1
January 16, 2009, 04:13:31 am
Hi there,

I'd like to be able to hack the code to add the current employer as a column in the event participants table in 2.1.2.  I thought this would be as simple as adding another column to the SQL query that retrieves this info but not being an expert in CiviCRM architecture, am struggling to find the right place to do this.

I would say the longer term nice and extensible solution is to add a "search view" drop down to CiviEvent search replicating what happens in Advanced Search.  (This would also be great to implement in CiviMember) and am happy to add this as a feature request, but I would also really like some advice on how to do this little hack to do this in the 2.1 release if possible.

Cheers,
Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Show current employer in Find particpants search results in 2.1
January 16, 2009, 05:29:25 am
Michael,

You can apply following patch: ( For this I would recommend to use custom template / custom php feature )

Quote
Index: CRM/Event/Selector/Search.php
===================================================================
--- CRM/Event/Selector/Search.php   (revision 19380)
+++ CRM/Event/Selector/Search.php   (working copy)
@@ -72,6 +72,7 @@
     static $_properties = array( 'contact_id',
                                  'contact_type',
                                  'sort_name',
+                                 'organization_name',
                                  'event_id',
                                  'participant_status_id',
                                  'event_title',
@@ -392,6 +393,11 @@
                                                 'sort'      => 'participant_role_id',
                                                 'direction' => CRM_Utils_Sort::DONTCARE,
                                                 ),
+                                          array(
+                                                'name'      => ts('Current Employer'),
+                                                'sort'      => 'organization_name',
+                                                'direction' => CRM_Utils_Sort::DONTCARE,
+                                                ),       
                                           array('desc' => ts('Actions') ),
                                           );
 
Index: CRM/Event/BAO/Query.php
===================================================================
--- CRM/Event/BAO/Query.php   (revision 19380)
+++ CRM/Event/BAO/Query.php   (working copy)
@@ -454,6 +454,7 @@
                                 'contact_type'              => 1,
                                 'sort_name'                 => 1,
                                 'display_name'              => 1,
+                                'organization_name'         => 1,
                                 'event_id'                  => 1,
                                 'event_title'               => 1,
                                 'event_start_date'          => 1,
Index: templates/CRM/Event/Form/Selector.tpl
===================================================================
--- templates/CRM/Event/Form/Selector.tpl   (revision 19380)
+++ templates/CRM/Event/Form/Selector.tpl   (working copy)
@@ -56,6 +56,7 @@
     <td>{$row.participant_register_date|truncate:10:''|crmDate}</td>   
     <td>{$row.participant_status_id}</td>
     <td>{$row.participant_role_id}</td>
+    <td>{$row.organization_name}</td>
     <td>{$row.action}</td>
    </tr>
   {/foreach}

HTh

Kurund
« Last Edit: January 16, 2009, 05:33:46 am by Kurund Jalmi »
Found this reply helpful? Support CiviCRM

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Show current employer in Find particpants search results in 2.1
January 16, 2009, 09:34:42 am
Hi Kurund,

Thanks a lot for the patch - I applied manually by copying and pasting the changes into new files I created in my custom php and templates directory.  I'm pretty sure I did this correctly because I can see the effects when I turn each part on/off, etc

The problem is that this only works for organisations: if I register an organisation as an attendee, there information will show in the current employer box, but if it is an individual, then it doesn't show (even though that information is present in the database table at that location) - any ideas on how I can finish it off?

Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Show current employer in Find particpants search results in 2.1
January 16, 2009, 01:16:29 pm
There was minor mistake in above patch, instead of "organization_name" change it to 'current_employer'.

So now patch looks: (Tested this in v2.1, above patch with corrections mentioned here should work for v2.2)

Quote
Index: CRM/Event/Selector/Search.php
===================================================================
--- CRM/Event/Selector/Search.php   (revision 18873)
+++ CRM/Event/Selector/Search.php   (working copy)
@@ -72,6 +72,7 @@
     static $_properties = array( 'contact_id',
                                  'contact_type',
                                  'sort_name',
+                                 'current_employer',
                                  'event_id',
                                  'participant_status_id',
                                  'event_title',
@@ -397,6 +398,11 @@
                                                 'sort'      => 'participant_role_id',
                                                 'direction' => CRM_Utils_Sort::DONTCARE,
                                                 ),
+                                          array(
+                                                'name'      => ts('Current Employer'),
+                                                'sort'      => 'current_employer',
+                                                'direction' => CRM_Utils_Sort::DONTCARE,
+                                                ),
                                           array('desc' => ts('Actions') ),
                                           );
 
Index: CRM/Event/BAO/Query.php
===================================================================
--- CRM/Event/BAO/Query.php   (revision 18873)
+++ CRM/Event/BAO/Query.php   (working copy)
@@ -454,6 +454,7 @@
                                 'contact_type'              => 1,
                                 'sort_name'                 => 1,
                                 'display_name'              => 1,
+                                'current_employer'         => 1,
                                 'event_id'                  => 1,
                                 'event_title'               => 1,
                                 'event_start_date'          => 1,
Index: templates/CRM/Event/Form/Selector.tpl
===================================================================
--- templates/CRM/Event/Form/Selector.tpl   (revision 18873)
+++ templates/CRM/Event/Form/Selector.tpl   (working copy)
@@ -55,6 +55,7 @@
    </td>
     <td>{$row.participant_status_id}</td>
     <td>{$row.participant_role_id}</td>
+    <td>{$row.current_employer}</td>
     <td>{$row.action}</td>
    </tr>
   {/foreach}


HTh

Kurund
Found this reply helpful? Support CiviCRM

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Show current employer in Find particpants search results in 2.1
January 20, 2009, 08:14:35 am
Great - works perfectly - thanks a lot Kurund :)
Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Show current employer in Find particpants search results in 2.1

This forum was archived on 2017-11-26.