X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FUFGroup.php;h=8e294147d973d9fb27f7cb57584fba617607f932;hb=8dc65d88b293208aab284087ae65e2beae4bb3de;hp=722fc4b9dfc6d05a8d8fce2ccc4c5902d788a8f1;hpb=5e27028609a22fb01370d7ed1d7a9290ff27918f;p=civicrm-core.git diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 722fc4b9df..ed8f31cec9 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2018 | + | Copyright CiviCRM LLC (c) 2004-2019 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2018 + * @copyright CiviCRM LLC (c) 2004-2019 */ /** @@ -116,8 +116,8 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup { * @param bool $is_active * Value we want to set the is_active field. * - * @return Object - * CRM_Core_DAO_UFGroup object on success, null otherwise + * @return bool + * true if we found and updated the object, else false */ public static function setIsActive($id, $is_active) { return CRM_Core_DAO::setFieldValue('CRM_Core_DAO_UFGroup', $id, 'is_active', $is_active); @@ -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(); @@ -1673,12 +1675,12 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) public static function getModuleUFGroup($moduleName = NULL, $count = 0, $skipPermission = TRUE, $op = CRM_Core_Permission::VIEW, $returnFields = NULL) { $selectFields = array('id', 'title', 'created_id', 'is_active', 'is_reserved', 'group_type'); - if (CRM_Core_DAO::checkFieldExists('civicrm_uf_group', 'description')) { + if (CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_uf_group', 'description')) { // CRM-13555, since description field was added later (4.4), and to avoid any problems with upgrade $selectFields[] = 'description'; } - if (CRM_Core_DAO::checkFieldExists('civicrm_uf_group', 'frontend_title')) { + if (CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_uf_group', 'frontend_title')) { $selectFields[] = 'frontend_title'; } @@ -3320,48 +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'])) { - 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'])), - ); - } - else { - $append[] = $id; - } - } - foreach ($append as $id) { - foreach ($links as &$link) { - $link['url'] .= ",$id"; - } - } - } - return $links; - } - /** * Retrieve groups of profiles. *