Merge pull request #4820 from kurund/CRM-15705
[civicrm-core.git] / CRM / Profile / Selector / Listings.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.6 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2014
32 * $Id$
33 *
34 */
35
36 /**
37 * This class is used to retrieve and display a range of
38 * contacts that match the given criteria (specifically for
39 * results of advanced search options.
40 *
41 */
42 class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CRM_Core_Selector_API {
43
44 /**
45 * Array of supported links, currenly view and edit
46 *
47 * @var array
48 * @static
49 */
50 static $_links = NULL;
51
52 /**
53 * We use desc to remind us what that column is, name is used in the tpl
54 *
55 * @var array
56 * @static
57 */
58 static $_columnHeaders;
59
60 /**
61 * The sql params we use to get the list of contacts
62 *
63 * @var string
64 */
65 protected $_params;
66
67 /**
68 * The public visible fields to be shown to the user
69 *
70 * @var array
71 */
72 protected $_fields;
73
74 /**
75 * The custom fields for this domain
76 *
77 * @var array
78 */
79 protected $_customFields;
80
81 /**
82 * Cache the query object
83 *
84 * @var object
85 */
86 protected $_query;
87
88 /**
89 * Cache the expanded options list if any
90 *
91 * @var object
92 */
93 protected $_options;
94
95 /**
96 * The group id that we are editing
97 *
98 * @var int
99 */
100 protected $_gid;
101
102 /**
103 * Do we enable mapping of users
104 *
105 * @var boolean
106 */
107 protected $_map;
108
109 /**
110 * Do we enable edit link
111 *
112 * @var boolean
113 */
114 protected $_editLink;
115
116 /**
117 * Should we link to the UF Profile
118 *
119 * @var boolean
120 */
121 protected $_linkToUF;
122
123 /**
124 * Store profile ids if multiple profile ids are passed using comma separated.
125 * Currently lets implement this functionality only for dialog mode
126 */
127 protected $_profileIds = array();
128
129 protected $_multiRecordTableName = NULL;
130
131 /**
132 * Class constructor
133 *
134 * @param array $params
135 * @param $customFields
136 * @param string params the params for the where clause
137 *
138 * @param bool $map
139 * @param bool $editLink
140 * @param bool $linkToUF
141 *
142 * @return \CRM_Profile_Selector_Listings
143 @access public
144 */
145 function __construct(
146 &$params,
147 &$customFields,
148 $ufGroupIds = NULL,
149 $map = FALSE,
150 $editLink = FALSE,
151 $linkToUF = FALSE
152 ) {
153 $this->_params = $params;
154
155 if (is_array($ufGroupIds)) {
156 $this->_profileIds = $ufGroupIds;
157 $this->_gid = $ufGroupIds[0];
158 }
159 else {
160 $this->_profileIds = array($ufGroupIds);
161 $this->_gid = $ufGroupIds;
162 }
163
164 $this->_map = $map;
165 $this->_editLink = $editLink;
166 $this->_linkToUF = $linkToUF;
167
168 //get the details of the uf group
169 if ($this->_gid) {
170 $groupId = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_UFGroup',
171 $this->_gid, 'limit_listings_group_id'
172 );
173 }
174
175 // add group id to params if a uf group belong to a any group
176 if ($groupId) {
177 if (!empty($this->_params['group'])) {
178 $this->_params['group'][$groupId] = 1;
179 }
180 else {
181 $this->_params['group'] = array($groupId => 1);
182 }
183 }
184
185 $this->_fields = CRM_Core_BAO_UFGroup::getListingFields(CRM_Core_Action::VIEW,
186 CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY |
187 CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY,
188 FALSE, $this->_profileIds
189 );
190
191 $this->_customFields = &$customFields;
192
193 $returnProperties = CRM_Contact_BAO_Contact::makeHierReturnProperties($this->_fields);
194 $returnProperties['contact_type'] = 1;
195 $returnProperties['contact_sub_type'] = 1;
196 $returnProperties['sort_name'] = 1;
197
198 $queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_params, 1);
199 $this->_query = new CRM_Contact_BAO_Query($queryParams, $returnProperties, $this->_fields);
200
201 //the below is done for query building for multirecord custom field listing
202 //to show all the custom field multi valued records of a particular contact
203 $this->setMultiRecordTableName($this->_fields);
204
205 $this->_options = &$this->_query->_options;
206 }
207
208 /**
209 * This method returns the links that are given for each search row.
210 *
211 * @param bool $map
212 * @param bool $editLink
213 * @param bool $ufLink
214 * @param null $gids
215 *
216 * @return array
217 */
218 public static function &links($map = FALSE, $editLink = FALSE, $ufLink = FALSE, $gids = NULL) {
219 if (!self::$_links) {
220 self::$_links = array();
221
222 $viewPermission = TRUE;
223 if ($gids) {
224 // check view permission for each profile id, in case multiple profile ids are rendered
225 // then view action is disabled if any profile returns false
226 foreach ($gids as $profileId) {
227 $viewPermission = CRM_Core_Permission::ufGroupValid($profileId, CRM_Core_Permission::VIEW);
228 if (!$viewPermission) {
229 break;
230 }
231 }
232 }
233
234 if ($viewPermission) {
235 self::$_links[CRM_Core_Action::VIEW] = array(
236 'name' => ts('View'),
237 'url' => 'civicrm/profile/view',
238 'qs' => 'reset=1&id=%%id%%&gid=%%gid%%',
239 'title' => ts('View Profile Details'),
240 );
241 }
242
243 if ($editLink) {
244 self::$_links[CRM_Core_Action::UPDATE] = array(
245 'name' => ts('Edit'),
246 'url' => 'civicrm/profile/edit',
247 'qs' => 'reset=1&id=%%id%%&gid=%%gid%%',
248 'title' => ts('Edit'),
249 );
250 }
251
252 if ($ufLink) {
253 self::$_links[CRM_Core_Action::PROFILE] = array(
254 'name' => ts('Website Profile'),
255 'url' => 'user/%%ufID%%',
256 'qs' => ' ',
257 'title' => ts('View Website Profile'),
258 );
259 }
260
261 if ($map) {
262 self::$_links[CRM_Core_Action::MAP] = array(
263 'name' => ts('Map'),
264 'url' => 'civicrm/profile/map',
265 'qs' => 'reset=1&cid=%%id%%&gid=%%gid%%',
266 'title' => ts('Map'),
267 );
268 }
269 }
270 return self::$_links;
271 }
272
273 /**
274 * Getter for array of the parameters required for creating pager.
275 *
276 * @param $action
277 * @param array $params
278 *
279 */
280 public function getPagerParams($action, &$params) {
281 $status =
282 CRM_Utils_System::isNull($this->_multiRecordTableName) ? ts('Contact %%StatusMessage%%') : ts('Contact Multi Records %%StatusMessage%%');
283 $params['status'] = $status;
284 $params['csvString'] = NULL;
285 $params['rowCount'] = CRM_Utils_Pager::ROWCOUNT;
286
287 $params['buttonTop'] = 'PagerTopButton';
288 $params['buttonBottom'] = 'PagerBottomButton';
289 }
290
291 /**
292 * Returns the column headers as an array of tuples:
293 * (name, sortName (key to the sort array))
294 *
295 * @param string $action the action being performed
296 * @param enum $output what should the result set include (web/email/csv)
297 *
298 * @return array the column headers that need to be displayed
299 */
300 public function &getColumnHeaders($action = NULL, $output = NULL) {
301 static $skipFields = array('group', 'tag');
302 $multipleFields = array('url');
303 $direction = CRM_Utils_Sort::ASCENDING;
304 $empty = TRUE;
305 if (!isset(self::$_columnHeaders)) {
306 self::$_columnHeaders = array(array('name' => ''),
307 array(
308 'name' => ts('Name'),
309 'sort' => 'sort_name',
310 'direction' => CRM_Utils_Sort::ASCENDING,
311 'field_name' => 'sort_name',
312 ),
313 );
314
315 $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
316
317 foreach ($this->_fields as $name => $field) {
318 // skip pseudo fields
319 if (substr($name, 0, 9) == 'phone_ext') {
320 continue;
321 }
322
323 if (!empty($field['in_selector']) &&
324 !in_array($name, $skipFields)
325 ) {
326
327 if (strpos($name, '-') !== FALSE) {
328 $value = explode('-', $name);
329 $fieldName = CRM_Utils_Array::value(0, $value);
330 $lType = CRM_Utils_Array::value(1, $value);
331 $type = CRM_Utils_Array::value(2, $value);
332
333 if (!in_array($fieldName, $multipleFields)) {
334 if ($lType == 'Primary') {
335 $locationTypeName = 1;
336 }
337 else {
338 $locationTypeName = $locationTypes[$lType];
339 }
340
341 if (in_array($fieldName, array(
342 'phone', 'im', 'email'))) {
343 if ($type) {
344 $name = "`$locationTypeName-$fieldName-$type`";
345 }
346 else {
347 $name = "`$locationTypeName-$fieldName`";
348 }
349 }
350 else {
351 $name = "`$locationTypeName-$fieldName`";
352 }
353 }
354 else {
355 $name = "website-{$lType}-{$fieldName}";
356 }
357 }
358
359 self::$_columnHeaders[] = array(
360 'name' => $field['title'],
361 'sort' => $name,
362 'direction' => $direction,
363 'field_name' => CRM_Core_BAO_UFField::isValidFieldName($name) ? $name : $fieldName,
364 );
365
366 $direction = CRM_Utils_Sort::DONTCARE;
367 $empty = FALSE;
368 }
369 }
370
371 // if we dont have any valid columns, dont add the implicit ones
372 // this allows the template to check on emptiness of column headers
373 if ($empty) {
374 self::$_columnHeaders = array();
375 }
376 else {
377 self::$_columnHeaders[] = array('desc' => ts('Actions'));
378 }
379 }
380 return self::$_columnHeaders;
381 }
382
383 /**
384 * Returns total number of rows for the query.
385 *
386 * @param
387 *
388 * @return int Total number of rows
389 */
390 public function getTotalCount($action) {
391 $additionalWhereClause = 'contact_a.is_deleted = 0';
392 $additionalFromClause = NULL;
393 $returnQuery = NULL;
394
395 if ($this->_multiRecordTableName &&
396 !array_key_exists($this->_multiRecordTableName, $this->_query->_whereTables)) {
397 $additionalFromClause = CRM_Utils_Array::value($this->_multiRecordTableName, $this->_query->_tables);
398 $returnQuery = TRUE;
399 }
400
401 $countVal = $this->_query->searchQuery(0, 0, NULL, TRUE, NULL, NULL, NULL,
402 $returnQuery, $additionalWhereClause, NULL, $additionalFromClause
403 );
404
405 if (!$returnQuery) {
406 return $countVal;
407 }
408
409 if ($returnQuery) {
410 $sql = preg_replace('/DISTINCT/', '', $countVal);
411 return CRM_Core_DAO::singleValueQuery($sql);
412 }
413 }
414
415 /**
416 * Return the qill for this selector
417 *
418 * @return string
419 */
420 public function getQill() {
421 return $this->_query->qill();
422 }
423
424 /**
425 * Returns all the rows in the given offset and rowCount
426 *
427 * @param enum $action the action being performed
428 * @param int $offset the row number to start from
429 * @param int $rowCount the number of rows to return
430 * @param string $sort the sql string that describes the sort order
431 * @param enum $output what should the result set include (web/email/csv)
432 *
433 * @return int the total number of rows for this action
434 */
435 public function &getRows($action, $offset, $rowCount, $sort, $output = NULL, $extraWhereClause = NULL) {
436
437 $multipleFields = array('url');
438 //$sort object processing for location fields
439 if ($sort) {
440 $vars = $sort->_vars;
441 $varArray = array();
442 foreach ($vars as $key => $field) {
443 $field = $vars[$key];
444 $fieldArray = explode('-', $field['name']);
445 $fieldType = CRM_Utils_Array::value('2', $fieldArray);
446 if (is_numeric(CRM_Utils_Array::value('1', $fieldArray))) {
447 if (!in_array($fieldType, $multipleFields)) {
448 $locationType = new CRM_Core_DAO_LocationType();
449 $locationType->id = $fieldArray[1];
450 $locationType->find(TRUE);
451 if ($fieldArray[0] == 'email' || $fieldArray[0] == 'im' || $fieldArray[0] == 'phone') {
452 $field['name'] = "`" . $locationType->name . "-" . $fieldArray[0] . "-1`";
453 }
454 else {
455 $field['name'] = "`" . $locationType->name . "-" . $fieldArray[0] . "`";
456 }
457 }
458 else {
459 $field['name'] = "`website-" . $fieldArray[1] . "-{$fieldType}`";
460 }
461 }
462 $varArray[$key] = $field;
463 }
464 $sort->_vars = $varArray;
465 }
466
467 $additionalWhereClause = 'contact_a.is_deleted = 0';
468
469 if ($extraWhereClause) {
470 $additionalWhereClause .= " AND {$extraWhereClause}";
471 }
472
473 $returnQuery = NULL;
474 if ($this->_multiRecordTableName) {
475 $returnQuery = TRUE;
476 }
477 $this->_query->_useGroupBy = TRUE;
478 $result = $this->_query->searchQuery($offset, $rowCount, $sort, NULL, NULL,
479 NULL, NULL, $returnQuery, $additionalWhereClause
480 );
481
482 if ($returnQuery) {
483 $resQuery = preg_replace('/GROUP BY contact_a.id[\s]+ORDER BY/', ' ORDER BY', $result);
484 $result = CRM_Core_DAO::executeQuery($resQuery);
485 }
486
487 // process the result of the query
488 $rows = array();
489
490 // check if edit is configured in profile settings
491 if ($this->_gid) {
492 $editLink = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'is_edit_link');
493 }
494
495 //FIXME : make sure to handle delete separately. CRM-4418
496 $mask = CRM_Core_Action::mask(array(CRM_Core_Permission::getPermission()));
497 if ($editLink && ($mask & CRM_Core_Permission::EDIT)) {
498 // do not allow edit for anon users in joomla frontend, CRM-4668
499 $config = CRM_Core_Config::singleton();
500 if (!$config->userFrameworkFrontend) {
501 $this->_editLink = TRUE;
502 }
503 }
504 $links = self::links($this->_map, $this->_editLink, $this->_linkToUF, $this->_profileIds);
505
506 $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
507
508 $names = array();
509 static $skipFields = array('group', 'tag');
510
511 foreach ($this->_fields as $key => $field) {
512 // skip pseudo fields
513 if (substr($key, 0, 9) == 'phone_ext') {
514 continue;
515 }
516
517 if (!empty($field['in_selector']) &&
518 !in_array($key, $skipFields)
519 ) {
520 if (strpos($key, '-') !== FALSE) {
521 $value = explode('-', $key);
522 $fieldName = CRM_Utils_Array::value(0, $value);
523 $id = CRM_Utils_Array::value(1, $value);
524 $type = CRM_Utils_Array::value(2, $value);
525
526 if (!in_array($fieldName, $multipleFields)) {
527 $locationTypeName = NULL;
528 if (is_numeric($id)) {
529 $locationTypeName = CRM_Utils_Array::value($id, $locationTypes);
530 }
531 else {
532 if ($id == 'Primary') {
533 $locationTypeName = 1;
534 }
535 }
536
537 if (!$locationTypeName) {
538 continue;
539 }
540 $locationTypeName = str_replace(' ', '_', $locationTypeName);
541 if (in_array($fieldName, array(
542 'phone', 'im', 'email'))) {
543 if ($type) {
544 $names[] = "{$locationTypeName}-{$fieldName}-{$type}";
545 }
546 else {
547 $names[] = "{$locationTypeName}-{$fieldName}";
548 }
549 }
550 else {
551 $names[] = "{$locationTypeName}-{$fieldName}";
552 }
553 }
554 else {
555 $names[] = "website-{$id}-{$fieldName}";
556 }
557 }
558 elseif ($field['name'] == 'id') {
559 $names[] = 'contact_id';
560 }
561 else {
562 $names[] = $field['name'];
563 }
564 }
565 }
566
567
568 $multipleSelectFields = array('preferred_communication_method' => 1);
569 $multiRecordTableId = NULL;
570 if ($this->_multiRecordTableName) {
571 $multiRecordTableId = "{$this->_multiRecordTableName}_id";
572 }
573
574 // we need to determine of overlay profile should be shown
575 $showProfileOverlay = CRM_Core_BAO_UFGroup::showOverlayProfile();
576
577 while ($result->fetch()) {
578 $this->_query->convertToPseudoNames($result);
579
580 if (isset($result->country)) {
581 // the query returns the untranslated country name
582 $i18n = CRM_Core_I18n::singleton();
583 $result->country = $i18n->translate($result->country);
584 }
585 $row = array();
586 $empty = TRUE;
587 $row[] = CRM_Contact_BAO_Contact_Utils::getImage($result->contact_sub_type ?
588 $result->contact_sub_type : $result->contact_type,
589 FALSE,
590 $result->contact_id,
591 $showProfileOverlay
592 );
593 if ($result->sort_name) {
594 $row[] = $result->sort_name;
595 $empty = FALSE;
596 }
597 else {
598 continue;
599 }
600
601 foreach ($names as $name) {
602 if ($cfID = CRM_Core_BAO_CustomField::getKeyID($name)) {
603 $row[] = CRM_Core_BAO_CustomField::getDisplayValue($result->$name,
604 $cfID,
605 $this->_options,
606 $result->contact_id
607 );
608 }
609 elseif (substr($name, -4) == '-url' &&
610 !empty($result->$name)
611 ) {
612 $url = CRM_Utils_System::fixURL($result->$name);
613 $typeId = substr($name, 0, -4) . "-website_type_id";
614 $typeName = CRM_Core_PseudoConstant::getLabel('CRM_Core_DAO_Website', 'website_type_id', $result->$typeId);
615 if ($typeName) {
616 $row[] = "<a href=\"$url\">{$result->$name} (${typeName})</a>";
617 }
618 else {
619 $row[] = "<a href=\"$url\">{$result->$name}</a>";
620 }
621 }
622 elseif ($name == 'preferred_language') {
623 $row[] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', 'preferred_language', $result->$name);
624 }
625 elseif ($multipleSelectFields &&
626 array_key_exists($name, $multipleSelectFields)
627 ) {
628 $paramsNew = array($name => $result->$name);
629 $name = array($name => array('newName' => $name, 'groupName' => $name));
630
631 CRM_Core_OptionGroup::lookupValues($paramsNew, $name, FALSE);
632 $row[] = $paramsNew[$key];
633 }
634 elseif (strpos($name, '-im')) {
635 if (!empty($result->$name)) {
636 $providerId = $name . "-provider_id";
637 $providerName = CRM_Core_PseudoConstant::getLabel('CRM_Core_DAO_IM', 'provider_id', $result->$providerId);
638 $row[] = $result->$name . " ({$providerName})";
639 }
640 else {
641 $row[] = '';
642 }
643 }
644 elseif (strpos($name, '-phone-')) {
645 $phoneExtField = str_replace('phone', 'phone_ext', $name);
646 if (isset($result->$phoneExtField)) {
647 $row[] = $result->$name . " (" . $result->$phoneExtField . ")";
648 }
649 else {
650 $row[] = $result->$name;
651 }
652 }
653 elseif (in_array($name, array(
654 'addressee', 'email_greeting', 'postal_greeting'))) {
655 $dname = $name . '_display';
656 $row[] = $result->$dname;
657 }
658 elseif (in_array($name, array(
659 'birth_date', 'deceased_date'))) {
660 $row[] = CRM_Utils_Date::customFormat($result->$name);
661 }
662 elseif (isset($result->$name)) {
663 $row[] = $result->$name;
664 }
665 else {
666 $row[] = '';
667 }
668
669 if (!empty($result->$name)) {
670 $empty = FALSE;
671 }
672 }
673
674 $newLinks = $links;
675 $params = array(
676 'id' => $result->contact_id,
677 'gid' => implode(',', $this->_profileIds),
678 );
679
680 // pass record id param to view url for multi record view
681 if ($multiRecordTableId && $newLinks) {
682 if ($result->$multiRecordTableId){
683 if ($newLinks[CRM_Core_Action::VIEW]['url'] == 'civicrm/profile/view') {
684 $newLinks[CRM_Core_Action::VIEW]['qs'] .= "&multiRecord=view&recordId=%%recordId%%&allFields=1";
685 $params['recordId'] = $result->$multiRecordTableId;
686 }
687 }
688 }
689
690 if ($this->_linkToUF) {
691 $ufID = CRM_Core_BAO_UFMatch::getUFId($result->contact_id);
692 if (!$ufID) {
693 unset($newLinks[CRM_Core_Action::PROFILE]);
694 }
695 else {
696 $params['ufID'] = $ufID;
697 }
698 }
699
700 $row[] = CRM_Core_Action::formLink($newLinks,
701 $mask,
702 $params,
703 ts('more'),
704 FALSE,
705 'profile.selector.row',
706 'Contact',
707 $result->contact_id
708 );
709
710 if (!$empty) {
711 $rows[] = $row;
712 }
713 }
714 return $rows;
715 }
716
717 /**
718 * Name of export file.
719 *
720 * @param string $output type of output
721 *
722 * @return string name of the file
723 */
724 public function getExportFileName($output = 'csv') {
725 return ts('CiviCRM Profile Listings');
726 }
727
728 /**
729 * set the _multiRecordTableName to display the result set
730 * according to multi record custom field values
731 */
732 public function setMultiRecordTableName($fields) {
733 $customGroupId = $multiRecordTableName = NULL;
734 $selectorSet = FALSE;
735
736 foreach ($fields as $field => $properties) {
737 if (!CRM_Core_BAO_CustomField::getKeyID($field)) {
738 continue;
739 }
740 if ($cgId = CRM_Core_BAO_CustomField::isMultiRecordField($field)) {
741 $customGroupId = CRM_Utils_System::isNull($customGroupId) ? $cgId : $customGroupId;
742
743 //if the field is submitted set multiRecordTableName
744 if ($customGroupId) {
745 $isSubmitted = FALSE;
746 foreach ($this->_query->_params as $key => $value) {
747 //check the query params 'where' element
748 if ($value[0] == $field) {
749 $isSubmitted = TRUE;
750 break;
751 }
752 }
753
754 if ($isSubmitted) {
755 $this->_multiRecordTableName = $multiRecordTableName =
756 CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'table_name');
757 if ($multiRecordTableName) {
758 return;
759 }
760 }
761
762 if (!empty($properties['in_selector'])) {
763 $selectorSet = TRUE;
764 }
765 }
766 }
767 }
768
769 if (!isset($customGroupId) || !$customGroupId) {
770 return;
771 }
772
773 //if the field is in selector and not a searchable field
774 //get the proper customvalue table name
775 if ($selectorSet) {
776 $this->_multiRecordTableName = $multiRecordTableName =
777 CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'table_name');
778 }
779 } //func close
780 }