X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FUFGroup.php;h=ed8f31cec9fa3346b514816bf23781530a5d87f0;hb=8dc65d88b293208aab284087ae65e2beae4bb3de;hp=9fc2793259347a45af0fc40ac653c9310b64a391;hpb=a2aecef52f49ae780ceed74fc040d831e6f4c29c;p=civicrm-core.git diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 9fc2793259..ed8f31cec9 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -993,8 +993,10 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { $details = $query->searchQuery(0, 0, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, $additionalWhereClause); - if (!$details->fetch()) { - return; + while ($details->fetch()) { + if (!$details) { + return; + } } $query->convertToPseudoNames($details); $config = CRM_Core_Config::singleton(); @@ -3320,54 +3322,6 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) } } - /** - * @param array|string $profiles - name of profile(s) to create links for - * @param array $appendProfiles - * Name of profile(s) to append to each link. - * - * @return array - */ - public static function getCreateLinks($profiles = '', $appendProfiles = array()) { - // Default to contact profiles - if (!$profiles) { - $profiles = array('new_individual', 'new_organization', 'new_household'); - } - $profiles = (array) $profiles; - $toGet = array_merge($profiles, (array) $appendProfiles); - $retrieved = civicrm_api3('uf_group', 'get', array( - 'name' => array('IN' => $toGet), - 'is_active' => 1, - )); - $links = $append = array(); - if (!empty($retrieved['values'])) { - $icons = [ - 'individual' => 'fa-user', - 'organization' => 'fa-building', - 'household' => 'fa-home', - ]; - foreach ($retrieved['values'] as $id => $profile) { - if (in_array($profile['name'], $profiles)) { - $links[] = array( - 'label' => $profile['title'], - 'url' => CRM_Utils_System::url('civicrm/profile/create', "reset=1&context=dialog&gid=$id", - NULL, NULL, FALSE, FALSE, TRUE), - 'type' => ucfirst(str_replace('new_', '', $profile['name'])), - 'icon' => CRM_Utils_Array::value(str_replace('new_', '', $profile['name']), $icons), - ); - } - else { - $append[] = $id; - } - } - foreach ($append as $id) { - foreach ($links as &$link) { - $link['url'] .= ",$id"; - } - } - } - return $links; - } - /** * Retrieve groups of profiles. *