+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
/**
* @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);
$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();
}
}
- /**
- * @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.
*