Beispiel #1
0
 /**
  * Function check the status of the membership before adding membership for a contact.
  *
  * @param int $contactId
  *   Contact id.
  *
  * @return int
  */
 public static function statusAvailabilty($contactId)
 {
     $membership = new CRM_Member_DAO_MembershipStatus();
     $membership->whereAdd('is_active=1');
     return $membership->count();
 }
 /** 
  * Function check the status of the membership before adding membership for a contact
  *
  * @param int $contactId contact id
  *
  * @return 
  */
 function statusAvilability($contactId)
 {
     require_once 'CRM/Member/DAO/MembershipStatus.php';
     $membership = new CRM_Member_DAO_MembershipStatus();
     $membership->whereAdd('1');
     $count = $membership->count();
     if (!$count) {
         $session = CRM_Core_Session::singleton();
         CRM_Core_Session::setStatus(ts('There are no status present, You cannot add membership.'));
         return CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$contactId}&selectedChild=member"));
     }
 }