Skip to content

Commit

Permalink
(NFC) Update CRM/Member CRM/Note CRM/Logging CRM/Import and CRM/Price…
Browse files Browse the repository at this point in the history
… folders to be a future coder standard
  • Loading branch information
seamuslee001 committed Apr 7, 2019
1 parent b18ac85 commit 971e129
Show file tree
Hide file tree
Showing 41 changed files with 115 additions and 67 deletions.
6 changes: 3 additions & 3 deletions CRM/Import/DataSource/CSV.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public function buildQuickForm(&$form) {
$form->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE);
$form->setMaxFileSize($uploadFileSize);
$form->addRule('uploadFile', ts('File size should be less than %1 MBytes (%2 bytes)', [
1 => $uploadSize,
2 => $uploadFileSize,
]), 'maxfilesize', $uploadFileSize);
1 => $uploadSize,
2 => $uploadFileSize,
]), 'maxfilesize', $uploadFileSize);
$form->addRule('uploadFile', ts('Input file must be in CSV format'), 'utf8File');
$form->addRule('uploadFile', ts('A valid file must be uploaded.'), 'uploadedfile');

Expand Down
3 changes: 1 addition & 2 deletions CRM/Import/Form/DataSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ public function buildQuickForm() {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions CRM/Import/Form/Preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
* those classes can be removed entirely and this class will not need to be abstract
*/
abstract class CRM_Import_Form_Preview extends CRM_Core_Form {

/**
* Return a descriptive name for the page, used in wizard header.
*
Expand Down Expand Up @@ -66,8 +67,7 @@ public function buildQuickForm() {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions CRM/Import/Form/Summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public function buildQuickForm() {
'name' => ts('Done'),
'isDefault' => TRUE,
),
)
);
));
}

/**
Expand Down
11 changes: 11 additions & 0 deletions CRM/Import/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,19 @@ abstract class CRM_Import_Parser {

/**
* Total number of non empty lines
* @var int
*/
protected $_totalCount;

/**
* Running total number of valid lines
* @var int
*/
protected $_validCount;

/**
* Running total number of invalid rows
* @var int
*/
protected $_invalidRowCount;

Expand All @@ -81,41 +84,49 @@ abstract class CRM_Import_Parser {

/**
* Array of error lines, bounded by MAX_ERROR
* @var array
*/
protected $_errors;

/**
* Total number of conflict lines
* @var int
*/
protected $_conflictCount;

/**
* Array of conflict lines
* @var array
*/
protected $_conflicts;

/**
* Total number of duplicate (from database) lines
* @var int
*/
protected $_duplicateCount;

/**
* Array of duplicate lines
* @var array
*/
protected $_duplicates;

/**
* Running total number of warnings
* @var int
*/
protected $_warningCount;

/**
* Maximum number of warnings to store
* @var int
*/
protected $_maxWarningCount = self::MAX_WARNINGS;

/**
* Array of warning lines, bounded by MAX_WARNING
* @var array
*/
protected $_warnings;

Expand Down
6 changes: 4 additions & 2 deletions CRM/Logging/ReportDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form {
protected $altered_by;
protected $altered_by_id;

// detail/summary report ids
/**
* detail/summary report ids
* @var int
*/
protected $detail;
protected $summary;

Expand Down Expand Up @@ -281,7 +284,6 @@ protected function calculateContactDiffs() {
$this->diffs = $this->getAllContactChangesForConnection();
}


/**
* Get an array of changes made in the mysql connection.
*
Expand Down
2 changes: 1 addition & 1 deletion CRM/Logging/Reverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function revert() {
// DAO-based tables

case (($tableDAO = CRM_Core_DAO_AllCoreTables::getClassForTable($table)) != FALSE):
$dao = new $tableDAO ();
$dao = new $tableDAO();
foreach ($row as $id => $changes) {
$dao->id = $id;
foreach ($changes as $field => $value) {
Expand Down
1 change: 0 additions & 1 deletion CRM/Member/ActionMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
+--------------------------------------------------------------------+
*/

use Civi\ActionSchedule\RecipientBuilder;

/**
* Class CRM_Member_ActionMapping
Expand Down
13 changes: 8 additions & 5 deletions CRM/Member/BAO/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership {
*
* @var array
*/
static $_importableFields = NULL;
public static $_importableFields = NULL;

static $_renewalActType = NULL;
public static $_renewalActType = NULL;

static $_signupActType = NULL;
public static $_signupActType = NULL;

/**
* Class constructor.
Expand Down Expand Up @@ -601,6 +601,7 @@ public static function getStatusANDTypeValues($membershipId) {
*
* @param int $membershipId
* Membership id that needs to be deleted.
* @param bool $preserveContrib
*
* @return int
* Id of deleted Membership on success, false otherwise.
Expand All @@ -616,6 +617,7 @@ public static function del($membershipId, $preserveContrib = FALSE) {
*
* @param int $membershipId
* Membership id that needs to be deleted.
* @param bool $preserveContrib
*
* @return int
* Id of deleted Membership on success, false otherwise.
Expand Down Expand Up @@ -1114,7 +1116,7 @@ public static function statusAvailabilty() {
* @param CRM_Member_DAO_Membership $membership
* @param \CRM_Contribute_BAO_Contribution|\CRM_Contribute_DAO_Contribution $contribution
*/
static public function updateRecurMembership(CRM_Member_DAO_Membership $membership, CRM_Contribute_BAO_Contribution $contribution) {
public static function updateRecurMembership(CRM_Member_DAO_Membership $membership, CRM_Contribute_BAO_Contribution $contribution) {

if (empty($contribution->contribution_recur_id)) {
return;
Expand Down Expand Up @@ -1517,6 +1519,7 @@ public static function createRelatedMemberships(&$params, &$dao, $reset = FALSE)
* Delete the record that are associated with this Membership Payment.
*
* @param int $membershipId
* @param bool $preserveContrib
*
* @return object
* $membershipPayment deleted membership payment object
Expand Down Expand Up @@ -2192,7 +2195,7 @@ public function processPriceSet($membershipId, $lineItem) {
*
* @param int $membershipId
* Membership id.
* @all bool
* @param bool $all
* if more than one payment associated with membership id need to be returned.
*
* @return int|int[]
Expand Down
1 change: 1 addition & 0 deletions CRM/Member/BAO/MembershipBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
*
*/
class CRM_Member_BAO_MembershipBlock extends CRM_Member_DAO_MembershipBlock {

/**
* Class constructor.
*/
Expand Down
1 change: 0 additions & 1 deletion CRM/Member/BAO/MembershipPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
*/
class CRM_Member_BAO_MembershipPayment extends CRM_Member_DAO_MembershipPayment {


/**
* Class constructor.
*/
Expand Down
3 changes: 2 additions & 1 deletion CRM/Member/BAO/MembershipStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ class CRM_Member_BAO_MembershipStatus extends CRM_Member_DAO_MembershipStatus {

/**
* Static holder for the default LT.
* @var int
*/
static $_defaultMembershipStatus = NULL;
public static $_defaultMembershipStatus = NULL;

/**
* Class constructor.
Expand Down
6 changes: 3 additions & 3 deletions CRM/Member/BAO/MembershipType.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType {

/**
* Static holder for the default Membership Type.
* @var int
*/
static $_defaultMembershipType = NULL;
public static $_defaultMembershipType = NULL;

static $_membershipTypeInfo = [];
public static $_membershipTypeInfo = [];

/**
* Class constructor.
Expand Down Expand Up @@ -716,7 +717,6 @@ public static function getMembershipTypeInfo() {
return self::$_membershipTypeInfo;
}


/**
* @param array $params
* @param int $previousID
Expand Down
3 changes: 2 additions & 1 deletion CRM/Member/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ public static function whereClauseSingle(&$values, &$query) {
$value = ['IN' => explode(',', $value)];
}
case 'membership_id':
case 'member_id': // CRM-18523 Updated to membership_id but kept member_id case for backwards compatibility
// CRM-18523 Updated to membership_id but kept member_id case for backwards compatibility
case 'member_id':
case 'member_campaign_id':

if (strpos($name, 'status') !== FALSE) {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Member/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment {

/**
* Membership Type ID
* @var
* @var int
*/
protected $_memType;

Expand Down
15 changes: 10 additions & 5 deletions CRM/Member/Form/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {

/**
* email of the person paying for the membership (used for receipts)
* @var string
*/
protected $_memberEmail = NULL;

Expand All @@ -76,6 +77,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {

/**
* email of the person paying for the membership (used for receipts)
* @var string
*/
protected $_contributorEmail = NULL;

Expand Down Expand Up @@ -128,7 +130,7 @@ protected function setEntityFields() {
*/
public function setDeleteMessage() {
$this->deleteMessage = '<span class="font-red bold">'
. ts("WARNING: Deleting this membership will also delete any related payment (contribution) records." . ts("This action cannot be undone.")
. ts("WARNING: Deleting this membership will also delete any related payment (contribution) records." . ts("This action cannot be undone.")
. '</span><p>'
. ts("Consider modifying the membership status instead if you want to maintain an audit trail and avoid losing payment data. You can set the status to Cancelled by editing the membership and clicking the Status Override checkbox.")
. '</p><p>'
Expand All @@ -142,7 +144,6 @@ public function setDeleteMessage() {
*/
public function addCustomDataToForm() {}


/**
* Overriding this entity trait function as not yet tested.
*
Expand Down Expand Up @@ -1730,9 +1731,12 @@ public function submit() {
*/
protected function updateContributionOnMembershipTypeChange($inputParams, $membership) {
if (Civi::settings()->get('update_contribution_on_membership_type_change') &&
($this->_action & CRM_Core_Action::UPDATE) && // on update
$this->_id && // if ID is present
!in_array($this->_memType, $this->_memTypeSelected) // if selected membership doesn't match with earlier membership
// on update
($this->_action & CRM_Core_Action::UPDATE) &&
// if ID is present
$this->_id &&
// if selected membership doesn't match with earlier membership
!in_array($this->_memType, $this->_memTypeSelected)
) {
if (CRM_Utils_Array::value('is_recur', $inputParams)) {
CRM_Core_Session::setStatus(ts('Associated recurring contribution cannot be updated on membership type change.', ts('Error'), 'error'));
Expand Down Expand Up @@ -1797,6 +1801,7 @@ public static function addPriceFieldByMembershipType(&$formValues, $priceFields,
}
}
}

/**
* Set context in session.
*/
Expand Down
1 change: 1 addition & 0 deletions CRM/Member/Form/MembershipBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa

/**
* Store membership price set id
* @var int
*/
protected $_memPriceSetId = NULL;

Expand Down
5 changes: 5 additions & 0 deletions CRM/Member/Form/MembershipRenewal.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {

/**
* email of the person paying for the membership (used for receipts)
* @var string
*/
protected $_memberEmail = NULL;

Expand All @@ -65,6 +66,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {

/**
* email of the person paying for the membership (used for receipts)
* @var string
*/
protected $_contributorEmail = NULL;

Expand All @@ -85,6 +87,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
/**
* context would be set to standalone if the contact is use is being selected from
* the form rather than in the URL
* @var string
*/
public $_context;

Expand Down Expand Up @@ -402,6 +405,8 @@ public function buildQuickForm() {
*
* @param array $params
* (ref.) an assoc array of name/value pairs.
* @param $files
* @param $self
*
* @return bool|array
* mixed true or array of errors
Expand Down
2 changes: 1 addition & 1 deletion CRM/Member/Form/MembershipStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function setEntityFields() {
* We do this from the constructor in order to do a translation.
*/
public function setDeleteMessage() {
$this->deleteMessage = ts('You will not be able to delete this membership status if there are existing memberships with this status. You will need to check all your membership status rules afterwards to ensure that a valid status will always be available.') . " " . ts('Do you want to continue?');
$this->deleteMessage = ts('You will not be able to delete this membership status if there are existing memberships with this status. You will need to check all your membership status rules afterwards to ensure that a valid status will always be available.') . " " . ts('Do you want to continue?');
}

public function preProcess() {
Expand Down
2 changes: 1 addition & 1 deletion CRM/Member/Form/MembershipView.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class CRM_Member_Form_MembershipView extends CRM_Core_Form {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;

/**
* The id of the membership being viewed.
Expand Down
Loading

0 comments on commit 971e129

Please sign in to comment.