* Create last viewed link to recently updated contact.
*
* @param array $crudLinkSpec
- * With keys:.
- * - action: int, CRM_Core_Action::UPDATE or CRM_Core_Action::VIEW [default: VIEW]
- * - entity_table: string, eg "civicrm_contact"
- * - entity_id: int
+ * - action: int, CRM_Core_Action::UPDATE or CRM_Core_Action::VIEW [default: VIEW]
+ * - entity_table: string, eg "civicrm_contact"
+ * - entity_id: int
+ *
* @return array|NULL
* NULL if unavailable, or
* [path: string, query: string, title: string]
}
/**
- * Delete a contact and all its associated records
+ * Delete a contact and all its associated records.
*
* @param int $id
* Id of the contact to delete.
* @param bool $skipUndelete
* Whether to force contact delete or not.
*
- * @return boolean
- * true if contact deleted, false otherwise
+ * @return bool
+ * Was contact deleted?
*/
public static function deleteContact($id, $restore = FALSE, $skipUndelete = FALSE) {
return TRUE;
}
-
// currently we only clear employer cache.
// we are not deleting inherited membership if any.
if ($contact->contact_type == 'Organization') {
}
/**
- * Delete the image of a contact
+ * Delete the image of a contact.
*
* @param int $id
* Id of the contact.
*
- * @return boolean
- * true if contact image is deleted
+ * @return bool
+ * Was contact image deleted?
*/
public static function deleteContactImage($id) {
if (!$id) {
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Report_Form_Membership_Summary extends CRM_Report_Form {
);
/**
- */
- /**
+ * Constructor function.
*/
public function __construct() {
// UI for selecting columns to appear in the report list
- // array conatining the columns, group_bys and filters build and provided to Form
+ // array containing the columns, group_bys and filters build and provided to Form
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
parent::__construct();
}
+ /**
+ * Pre-process function.
+ */
public function preProcess() {
$this->assign('reportTitle', ts('Membership Summary Report'));
parent::preProcess();
}
/**
+ * Set default values.
+ *
* @return array
+ * Default values.
*/
public function setDefaultValues() {
return parent::setDefaultValues();
}
+ /**
+ * Generate select clause.
+ */
public function select() {
$select = array();
$this->_columnHeaders = array();
}
/**
+ * Set form rules.
+ *
* @param $fields
* @param $files
* @param $self
LEFT JOIN civicrm_contribution {$this->_aliases['civicrm_contribution']}
ON {$this->_aliases['civicrm_membership']}.contact_id = {$this->_aliases['civicrm_contribution']}.contact_id
";
- // include address field if address column is to be included
+ // Include address table if address column is to be included.
if ($this->_addressField) {
$this->_from .= "LEFT JOIN civicrm_address {$this->_aliases['civicrm_address']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_address']}.contact_id AND {$this->_aliases['civicrm_address']}.is_primary = 1\n";
}
- // include email field if email column is to be included
+ // Include email table if email column is to be included.
if ($this->_emailField) {
$this->_from .= "LEFT JOIN civicrm_email {$this->_aliases['civicrm_email']} ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_email']}.contact_id AND {$this->_aliases['civicrm_email']}.is_primary = 1\n";
}
}
/**
- * @param $rows
+ * Generate statistics (bottom section of the report).
+ *
+ * @param array $rows
*
* @return array
*/
}
/**
- * @param $rows
+ * Make changes to how data is displayed.
+ *
+ * @param array $rows
*/
public function alterDisplay(&$rows) {
// custom code to alter rows
if (array_key_exists('civicrm_contact_sort_name', $row) &&
array_key_exists('civicrm_contact_id', $row)
) {
- $url = CRM_Utils_System::url('civicrm/report/member/detail',
+ $url = CRM_Utils_System::url(
+ 'civicrm/report/member/detail',
'reset=1&force=1&id_op=eq&id_value=' . $row['civicrm_contact_id'],
$this->_absoluteUrl
);
- $rows[$rowNum]['civicrm_contact_sort_name'] =
- "<a href='$url'>" . $row["civicrm_contact_sort_name"] . '</a>';
+ $rows[$rowNum]['civicrm_contact_sort_name']
+ = "<a href='$url'>" . $row["civicrm_contact_sort_name"] . '</a>';
$entryFound = TRUE;
}
}
/**
- * Test case for createProfileContac( )
- * test with all params.
- * ( create and update modes )
+ * Test case for createProfileContact.
*/
public function testCreateProfileContact() {
$fields = CRM_Contact_BAO_Contact::exportableFields('Individual');
}
/**
- * Test case for getContactDetails( )
+ * Test case for getContactDetails( ).
*/
public function testGetContactDetails() {
//get the contact params
}
/**
- * Test case for
- * importableFields( ) and exportableFields( )
+ * Test case for importableFields( ) and exportableFields( ).
*/
public function testFields() {
$allImpFileds = CRM_Contact_BAO_Contact::importableFields('All');
Contact::delete($contactId);
}
- // /**
- // * test logged in user has permissions for
- // * various operation types
- // */
- // function testPermissionedContact()
- // {
- // $contactId = Contact::createIndividual();
- // require_once 'CRM/Contact/BAO/Contact/Permission.php';
- // $userViewPermission = CRM_Contact_BAO_Contact_Permission::allow($contactId);
- // $this->assertEquals( $userViewPermission, true, 'Check user for view contact permission.' );
- //
- // $userEditPermission = CRM_Contact_BAO_Contact_Permission::allow($contactId, CRM_Core_Permission::EDIT);
- // $this->assertEquals( $userEditPermission, true, 'Check user for edit contact permission.' );
- //
- // Contact::delete($contactId);
- // }
-
/**
* Build common params
*/
}
/**
- * Ensure that created_date and modified_date are set
+ * Ensure that created_date and modified_date are set.
*/
- public function testTimestamps_contact() {
+ public function testTimestampContact() {
$test = $this;
$this->_testTimestamps(array(
'UPDATE' => function ($contactId) use ($test) {
'contact_type' => 'Individual',
'contact_id' => $contactId,
);
- $contact = CRM_Contact_BAO_Contact::add($params);
- $test->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object');
+ $contact = CRM_Contact_BAO_Contact::add($params);
+ $test->assertInstanceOf('CRM_Contact_DAO_Contact', $contact, 'Check for created object');
},
));
}
/**
- * Ensure that civicrm_contact.modified_date is updated when manipulating a phone record
+ * Ensure that civicrm_contact.modified_date is updated when manipulating a phone record.
*/
- public function testTimestamps_email() {
+ public function testTimestampsEmail() {
$test = $this;
$this->_testTimestamps(array(
'INSERT' => function ($contactId) use ($test) {
}
/**
- * Create test with unique field name on source
+ * Create test with unique field name on source.
*/
- public function testCreateContributionSourceInvalidContac() {
+ public function testCreateContributionSourceInvalidContact() {
$params = array(
'contact_id' => 999,
}
/**
- * This is the test for creating soft credits - however a 'get' is not yet possible via API
- * as the current BAO functions are contact-centric (from what I can find)
+ * This is the test for creating soft credits.
*/
- public function testCreateContributionWithSoftCredt() {
+ public function testCreateContributionWithSoftCredit() {
$description = "Demonstrates creating contribution with SoftCredit";
$subfile = "ContributionCreateWithSoftCredit";
$contact2 = $this->callAPISuccess('Contact', 'create', array(
'display_name' => 'superman',
'contact_type' => 'Individual',
));
- $softparams = array(
+ $softParams = array(
'contact_id' => $contact2['id'],
'amount' => 50,
'soft_credit_type_id' => 3,
);
- $params = $this->_params + array('soft_credit' => array(1 => $softparams));
+ $params = $this->_params + array('soft_credit' => array(1 => $softParams));
$contribution = $this->callAPIAndDocument('contribution', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
$result = $this->callAPISuccess('contribution', 'get', array('return' => 'soft_credit', 'sequential' => 1));
- $this->assertEquals($softparams['contact_id'], $result['values'][0]['soft_credit'][1]['contact_id']);
- $this->assertEquals($softparams['amount'], $result['values'][0]['soft_credit'][1]['amount']);
- $this->assertEquals($softparams['soft_credit_type_id'], $result['values'][0]['soft_credit'][1]['soft_credit_type']);
+ $this->assertEquals($softParams['contact_id'], $result['values'][0]['soft_credit'][1]['contact_id']);
+ $this->assertEquals($softParams['amount'], $result['values'][0]['soft_credit'][1]['amount']);
+ $this->assertEquals($softParams['soft_credit_type_id'], $result['values'][0]['soft_credit'][1]['soft_credit_type']);
$this->callAPISuccess('contribution', 'delete', array('id' => $contribution['id']));
$this->callAPISuccess('contact', 'delete', array('id' => $contact2['id']));