+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016 |
+ | Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
$finalSort = array();
$options['sort'] = NULL;
if (!empty($sort)) {
- foreach ((array) $sort as $s) {
- if (CRM_Utils_Rule::mysqlOrderBy($s)) {
+ if (!is_array($sort)) {
+ $sort = array_map('trim', explode(',', $sort));
+ }
+ foreach ($sort as $s) {
+ if ($s == '(1)' || CRM_Utils_Rule::mysqlOrderBy($s)) {
if ($entity && $action == 'get') {
switch (trim(strtolower($s))) {
case 'id':
*
* @param array $returnArray
* Array to append custom data too - generally $result[4] where 4 is the entity id.
+ * @param $checkPermission
* @param string $entity
* E.g membership, event.
* @param int $entity_id
return array($errors);
}
+
/**
* Used by the Validate API.
+ * @param $fieldName
* @param array $fieldInfo
* @param string $entity
* @param array $params
*
+ * @throws API_Exception
* @throws Exception
*/
function _civicrm_api3_validate_switch_cases($fieldName, $fieldInfo, $entity, $params) {
_civicrm_api3_validate_constraint($params[$fieldName], $fieldName, $fieldInfo);
}
elseif (!empty($fieldInfo['required'])) {
- throw new Exception("DB Constraint Violation - possibly $fieldName should possibly be marked as mandatory for this API. If so, please raise a bug report.");
+ throw new Exception("DB Constraint Violation - $fieldName should possibly be marked as mandatory for $entity,$action API. If so, please raise a bug report.");
}
}
if (!empty($fieldInfo['api.unique'])) {
$d = new $dao();
$fields = $d->fields();
- // Set html attributes for text fields
foreach ($fields as $name => &$field) {
+ // Denote as core field
+ $field['is_core_field'] = TRUE;
+ // Set html attributes for text fields
if (isset($field['html'])) {
$field['html'] += (array) $d::makeAttribute($field);
}
*
* @throws API_Exception
*/
-function _civicrm_api3_validate_integer(&$params, &$fieldName, &$fieldInfo, $entity) {
+function _civicrm_api3_validate_integer(&$params, $fieldName, &$fieldInfo, $entity) {
list($fieldValue, $op) = _civicrm_api3_field_value_check($params, $fieldName);
if (strpos($op, 'NULL') !== FALSE || strpos($op, 'EMPTY') !== FALSE) {
return;