X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2FPledge.php;h=6b5dfeaa5947f7a93bf0b2b1c70bc28afe6018fe;hb=926932e43f8f695618aea99636e1386ad5b9df76;hp=2e5caf44f3152fb99f0511b23826cc4d4e5d52dd;hpb=f8c36033b83eb127a5443595b7aea3c6e68cd855;p=civicrm-core.git diff --git a/api/v3/Pledge.php b/api/v3/Pledge.php index 2e5caf44f3..6b5dfeaa59 100644 --- a/api/v3/Pledge.php +++ b/api/v3/Pledge.php @@ -2,7 +2,7 @@ /* +--------------------------------------------------------------------+ - | CiviCRM version 4.3 | + | CiviCRM version 4.4 | +--------------------------------------------------------------------+ | Copyright CiviCRM LLC (c) 2004-2013 | +--------------------------------------------------------------------+ @@ -129,25 +129,11 @@ function _civicrm_api3_pledge_create_spec(&$params) { * @access public */ function civicrm_api3_pledge_get($params) { + $mode = CRM_Contact_BAO_Query::MODE_PLEDGE; + $entity = 'pledge'; + + list($dao, $query) = _civicrm_api3_get_query_object($params, $mode, $entity); - $options = _civicrm_api3_get_options_from_params($params, TRUE, 'pledge','get'); - if (empty($options['return'])) { - $options['return'] = CRM_Pledge_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_PLEDGE); - } - else { - $options['return']['pledge_id'] = 1; - } - $newParams = CRM_Contact_BAO_Query::convertFormValues($options['input_params']); - $query = new CRM_Contact_BAO_Query($newParams, $options['return'], NULL, - FALSE, FALSE, CRM_Contact_BAO_Query::MODE_PLEDGE - ); - list($select, $from, $where) = $query->query(); - $sql = "$select $from $where"; - if (!empty($options['sort'])) { - $sql .= " ORDER BY " . $options['sort']; - } - $sql .= " LIMIT " . $options['offset'] . " , " . $options['limit']; - $dao = CRM_Core_DAO::executeQuery($sql); $pledge = array(); while ($dao->fetch()) { $pledge[$dao->pledge_id] = $query->store($dao);