Ejemplo n.º 1
0
 /**                          
  * Delete the record that are associated with this Membership Payment
  * 
  * @param  int  $membershipId  membsership id. 
  * 
  * @return boolean  true if deleted false otherwise
  * @access public 
  */
 static function deleteMembershipPayment($membershipId)
 {
     require_once 'CRM/Member/DAO/MembershipPayment.php';
     $membesrshipPayment = new CRM_Member_DAO_MembershipPayment();
     $membesrshipPayment->membership_id = $membershipId;
     $membesrshipPayment->find();
     while ($membesrshipPayment->fetch()) {
         require_once 'CRM/Contribute/BAO/Contribution.php';
         CRM_Contribute_BAO_Contribution::deleteContribution($membesrshipPayment->contribution_id);
         CRM_Utils_Hook::pre('delete', 'MembershipPayment', $membesrshipPayment->id, $membesrshipPayment);
         $membesrshipPayment->delete();
         CRM_Utils_Hook::post('delete', 'MembershipPayment', $membesrshipPayment->id, $membesrshipPayment);
     }
     return $membesrshipPayment;
 }
Ejemplo n.º 2
0
 /**
  * Delete the record that are associated with this Membership Payment.
  *
  * @param int $membershipId
  *
  * @return object
  *   $membershipPayment deleted membership payment object
  */
 public static function deleteMembershipPayment($membershipId)
 {
     $membershipPayment = new CRM_Member_DAO_MembershipPayment();
     $membershipPayment->membership_id = $membershipId;
     $membershipPayment->find();
     while ($membershipPayment->fetch()) {
         CRM_Contribute_BAO_Contribution::deleteContribution($membershipPayment->contribution_id);
         CRM_Utils_Hook::pre('delete', 'MembershipPayment', $membershipPayment->id, $membershipPayment);
         $membershipPayment->delete();
         CRM_Utils_Hook::post('delete', 'MembershipPayment', $membershipPayment->id, $membershipPayment);
     }
     return $membershipPayment;
 }
/**
 * Retrieve one / all contribution(s) / membership(s) linked to a
 * membership / contrbution.
 *
 * @param  array   $params           (reference ) input parameters
 *
 * @return array (reference )        array of properties, if error an array with an error id and error message
 * @static void
 * @access public
 */
function &civicrm_membershipcontributionlink_get(&$params)
{
    _civicrm_initialize();
    if (empty($params)) {
        return civicrm_create_error(ts('No input parameters present'));
    }
    if (!is_array($params)) {
        return civicrm_create_error(ts('Input parameters is not an array'));
    }
    require_once 'CRM/Member/DAO/MembershipPayment.php';
    $mpDAO = new CRM_Member_DAO_MembershipPayment();
    $mpDAO->copyValues($params);
    $mpDAO->id = CRM_Utils_Array::value('membership_contribution_id', $params);
    $mpDAO->find();
    $values = array();
    while ($mpDAO->fetch()) {
        _civicrm_object_to_array($mpDAO, $mpArray);
        $mpArray['membership_contribution_id'] = $mpDAO->id;
        unset($mpArray['id']);
        $values[$mpDAO->id] = $mpArray;
    }
    return $values;
}