public static function create(&$params) {
// check required params
if (!self::dataExists($params)) {
- CRM_Core_Error::fatal('Not enough data to create activity object,');
+ throw new CRM_Core_Exception('Not enough data to create activity object');
}
$activity = new CRM_Activity_DAO_Activity();
$t = array_slice($params['target_contact_id'], 0, 1);
$recentContactId = $t[0];
}
- elseif (isset($params['target_contact_id'])) {
+ //is array check fixes warning without degrading functionality but it seems this bit of code may no longer work
+ // as it may always be an array
+ elseif (isset($params['target_contact_id']) && !is_array($params['target_contact_id'])) {
$msgs[] = "target={$params['target_contact_id']}";
// will be used for recently viewed display
$recentContactId = $params['target_contact_id'];
*/
static function create(&$params, $ids = array()) {
$valid = $invalid = $duplicate = $saved = 0;
- $relationships = array();
+ $relationships = $relationshipIds = array();
$relationshipId = CRM_Utils_Array::value('relationship', $ids, CRM_Utils_Array::value('id', $params));
//CRM-9015 - the hooks are called here & in add (since add doesn't call create)
// but in future should be tidied per ticket
* @access public
* @static
*/
- static function &create(&$params, $ids = array()) {
+ static function create(&$params, $ids = array()) {
$dateFields = array('receive_date', 'cancel_date', 'receipt_date', 'thankyou_date');
foreach ($dateFields as $df) {
if (isset($params[$df])) {
* @access public
* @static
*/
- static function &create(&$params) {
+ static function create(&$params) {
$transaction = new CRM_Core_Transaction();
$status = NULL;
}
if ((!CRM_Utils_Array::value('id', $params)) ||
- ($params['status_id'] != $status)
+ (isset($params['status_id']) && $params['status_id'] != $status)
) {
CRM_Activity_BAO_Activity::addActivity($participant);
}
function _civicrm_api3_case_get_spec(&$params) {
$params['contact_id']['api.aliases'] = array('client_id');
$params['contact_id']['title'] = 'Case Client';
+ $params['creator_id']['api.default'] = 'user_contact_id';
}
/**
WHERE (contact_id_a = $contact
OR contact_id_b = $contact)
AND case_id IS NOT NULL";
- $dao = &CRM_Core_DAO::executeQuery($sql);
+ $dao = CRM_Core_DAO::executeQuery($sql);
$cases = array();
while ($dao->fetch()) {
*
* @param int $caseId
*
- * @return array (reference) case object
+ * @param $params
+ *
+ * @internal param $options
*
+ * @return array (reference) case object
*/
function _civicrm_api3_case_read($caseId, $options) {
$return = CRM_Utils_Array::value('return', $options, array());
* Internal function to format create params for processing
*/
function _civicrm_api3_case_format_params(&$params) {
- if (!array_key_exists('creator_id', $params)) {
- $session = CRM_Core_Session::singleton();
- $params['creator_id'] = $session->get('userID');
- }
- if (empty($params['start_date'])) {
- $params['start_date'] = date('YmdHis');
- }
// figure out case type id from case type and vice-versa
$caseTypes = CRM_Case_PseudoConstant::caseType('label', FALSE);
if (empty($params['case_type_id'])) {
* @access public
*/
function civicrm_api3_grant_create($params) {
- $values = array();
- _civicrm_api3_custom_format_params($params, $values, 'Grant');
- $params = array_merge($values, $params);
- return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'grant');
+ return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Grant');
}
/**
* @access public
*/
function civicrm_api3_grant_get($params) {
- return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+ return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Grant');
}
/**
if ($options['is_count']) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
- $membershipValues = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
+ $membershipValues = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Membership');
$return = $options['return'];
if(empty($membershipValues) ||
'sort' => CRM_Utils_Rule::string($sort) ? $sort : NULL,
'limit' => CRM_Utils_Rule::integer($limit) ? $limit : NULL,
'is_count' => $is_count,
- 'return' => !empty($returnProperties) ? $returnProperties : NULL,
+ 'return' => !empty($returnProperties) ? $returnProperties : array(),
);
if ($options['sort'] && stristr($options['sort'], 'SELECT')) {
return civicrm_api3_create_success(_civicrm_api3_dao_to_array($bao, $params, FALSE, $entity), $params, $entity, 'get');
}
else {
- return _civicrm_api3_dao_to_array($bao, $params, FALSE, $entity);
+ return _civicrm_api3_dao_to_array($bao, $params, FALSE, $entity, 'get');
}
}
* @param string $subName - Subtype of entity
*/
function _civicrm_api3_custom_data_get(&$returnArray, $entity, $entity_id, $groupID = NULL, $subType = NULL, $subName = NULL) {
- $groupTree = &CRM_Core_BAO_CustomGroup::getTree($entity,
+ $groupTree = CRM_Core_BAO_CustomGroup::getTree($entity,
CRM_Core_DAO::$_nullObject,
$entity_id,
$groupID,