Commit 971e129b authored by Seamus Lee's avatar Seamus Lee

(NFC) Update CRM/Member CRM/Note CRM/Logging CRM/Import and CRM/Price folders...

(NFC) Update CRM/Member CRM/Note CRM/Logging CRM/Import and CRM/Price folders to be a future coder standard
parent b18ac85d
......@@ -75,9 +75,9 @@ class CRM_Import_DataSource_CSV extends CRM_Import_DataSource {
$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');
......
......@@ -103,8 +103,7 @@ abstract class CRM_Import_Form_DataSource extends CRM_Core_Form {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
}
/**
......
......@@ -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.
*
......@@ -66,8 +67,7 @@ abstract class CRM_Import_Form_Preview extends CRM_Core_Form {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
}
/**
......
......@@ -49,8 +49,7 @@ abstract class CRM_Import_Form_Summary extends CRM_Core_Form {
'name' => ts('Done'),
'isDefault' => TRUE,
),
)
);
));
}
/**
......
......@@ -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;
......@@ -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;
......
......@@ -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;
......@@ -281,7 +284,6 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form {
$this->diffs = $this->getAllContactChangesForConnection();
}
/**
* Get an array of changes made in the mysql connection.
*
......
......@@ -128,7 +128,7 @@ class CRM_Logging_Reverter {
// 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) {
......
......@@ -25,7 +25,6 @@
+--------------------------------------------------------------------+
*/
use Civi\ActionSchedule\RecipientBuilder;
/**
* Class CRM_Member_ActionMapping
......
......@@ -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.
......@@ -601,6 +601,7 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty
*
* @param int $membershipId
* Membership id that needs to be deleted.
* @param bool $preserveContrib
*
* @return int
* Id of deleted Membership on success, false otherwise.
......@@ -616,6 +617,7 @@ INNER JOIN civicrm_membership_type type ON ( type.id = membership.membership_ty
*
* @param int $membershipId
* Membership id that needs to be deleted.
* @param bool $preserveContrib
*
* @return int
* Id of deleted Membership on success, false otherwise.
......@@ -1114,7 +1116,7 @@ AND civicrm_membership.is_test = %2";
* @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;
......@@ -1517,6 +1519,7 @@ WHERE civicrm_membership.contact_id = civicrm_contact.id
* Delete the record that are associated with this Membership Payment.
*
* @param int $membershipId
* @param bool $preserveContrib
*
* @return object
* $membershipPayment deleted membership payment object
......@@ -2192,7 +2195,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND
*
* @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[]
......
......@@ -33,6 +33,7 @@
*
*/
class CRM_Member_BAO_MembershipBlock extends CRM_Member_DAO_MembershipBlock {
/**
* Class constructor.
*/
......
......@@ -34,7 +34,6 @@
*/
class CRM_Member_BAO_MembershipPayment extends CRM_Member_DAO_MembershipPayment {
/**
* Class constructor.
*/
......
......@@ -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.
......
......@@ -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.
......@@ -716,7 +717,6 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType {
return self::$_membershipTypeInfo;
}
/**
* @param array $params
* @param int $previousID
......
......@@ -233,7 +233,8 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_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) {
......
......@@ -47,7 +47,7 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment {
/**
* Membership Type ID
* @var
* @var int
*/
protected $_memType;
......
......@@ -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;
......@@ -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;
......@@ -128,7 +130,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
*/
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>'
......@@ -142,7 +144,6 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
*/
public function addCustomDataToForm() {}
/**
* Overriding this entity trait function as not yet tested.
*
......@@ -1730,9 +1731,12 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
*/
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'));
......@@ -1797,6 +1801,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
}
}
}
/**
* Set context in session.
*/
......
......@@ -38,6 +38,7 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa
/**
* Store membership price set id
* @var int
*/
protected $_memPriceSetId = NULL;
......
......@@ -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;
......@@ -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;
......@@ -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;
......@@ -402,6 +405,8 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
*
* @param array $params
* (ref.) an assoc array of name/value pairs.
* @param $files
* @param $self
*
* @return bool|array
* mixed true or array of errors
......
......@@ -91,7 +91,7 @@ class CRM_Member_Form_MembershipStatus extends CRM_Core_Form {
* 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() {
......
......@@ -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.
......
......@@ -61,6 +61,7 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search {
/**
* Prefix for the controller.
* @var string
*/
protected $_prefix = "member_";
......
......@@ -45,11 +45,13 @@ class CRM_Member_Form_Task_Batch extends CRM_Member_Form_Task {
/**
* Maximum profile fields that will be displayed.
* @var int
*/
protected $_maxFields = 9;
/**
* Variable to store redirect path.
* @var string
*/
protected $_userContext;
......
......@@ -47,11 +47,13 @@ class CRM_Member_Form_Task_PickProfile extends CRM_Member_Form_Task {
/**
* Maximum members that should be allowed to update
* @var int
*/
protected $_maxMembers = 100;
/**
* Variable to store redirect path
* @var string
*/
protected $_userContext;
......
......@@ -34,17 +34,20 @@
*/
class CRM_Member_Import_Field {
/**#@+
/**
* #@+
* @var string
*/
/**
* Name of the field
* @var string
*/
public $_name;
/**
* Title of the field to be used in display
* @var string
*/
public $_title;
......
......@@ -44,8 +44,7 @@ class CRM_Member_Import_Form_MapField extends CRM_Import_Form_MapField {
*
* @var int
*/
static $_contactType = NULL;
public static $_contactType = NULL;
/**
* Set variables up before form is built.
......
......@@ -36,22 +36,26 @@ abstract class CRM_Member_Import_Parser extends CRM_Import_Parser {
protected $_fileName;
/**#@+
/**
* #@+
* @var integer
*/
/**
* Imported file size
* @var int
*/
protected $_fileSize;
/**
* Seperator being used
* @var string
*/
protected $_seperator;
/**
* Total number of lines in file
* @var int
*/
protected $_lineCount;
......@@ -70,6 +74,8 @@ abstract class CRM_Member_Import_Parser extends CRM_Import_Parser {
* @param int $mode
* @param int $contactType
* @param int $onDuplicate
* @param int $statusID
* @param int $totalRowCount
*
* @return mixed
* @throws Exception
......
......@@ -51,7 +51,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser {
/**
* Array of successfully imported membership id's
*
* @array
* @var array
*/
protected $_newMemberships;
......
......@@ -38,6 +38,7 @@
class CRM_Member_Info extends CRM_Core_Component_Info {
/**
* @var string
* @inheritDoc
*/
protected $keyword = 'member';
......@@ -51,6 +52,7 @@ class CRM_Member_Info extends CRM_Core_Component_Info {
* @return array
* collection of required component settings
*/
/**
* @return array
*/
......@@ -64,7 +66,6 @@ class CRM_Member_Info extends CRM_Core_Component_Info {
];
}
/**
* @inheritDoc
* Provides permissions that are used by component.
......@@ -115,6 +116,7 @@ class CRM_Member_Info extends CRM_Core_Component_Info {
* collection of required dashboard settings,
* null if no element offered
*/
/**
* @return array|null
*/
......@@ -139,6 +141,7 @@ class CRM_Member_Info extends CRM_Core_Component_Info {
* collection of required dashboard settings,
* null if no element offered
*/
/**
* @return array|null
*/
......@@ -167,6 +170,7 @@ class CRM_Member_Info extends CRM_Core_Component_Info {
* collection of required pane settings,
* null if no element offered
*/
/**
* @return array|null
*/
......@@ -187,6 +191,7 @@ class CRM_Member_Info extends CRM_Core_Component_Info {
* @return array|null
* collection of activity types
*/
/**
* @return array|null
*/
......
......@@ -45,7 +45,7 @@ class CRM_Member_Page_MembershipStatus extends CRM_Core_Page_Basic {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* Get BAO Name.
......
......@@ -43,7 +43,7 @@ class CRM_Member_Page_MembershipType extends CRM_Core_Page {
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
public $useLivePageJS = TRUE;
......
......@@ -39,8 +39,8 @@ class CRM_Member_Page_Tab extends CRM_Core_Page {
*
* @var array
*/
static $_links = NULL;
static $_membershipTypesLinks = NULL;
public static $_links = NULL;
public static $_membershipTypesLinks = NULL;
public $_permission = NULL;
public $_contactId = NULL;
......
......@@ -92,7 +92,7 @@ class CRM_Member_PseudoConstant extends CRM_Core_PseudoConstant {
* @param bool $allStatus
*
* @return array
* array reference of all membership statuses if any
* array reference of all membership statuses if any
*/
public static function &membershipStatus($id = NULL, $cond = NULL, $column = 'name', $force = FALSE, $allStatus = FALSE) {
if (self::$membershipStatus === NULL) {
......
......@@ -43,20 +43,20 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C
*
* @var array
*/
static $_links = NULL;
public static $_links = NULL;
/**
* We use desc to remind us what that column is, name is used in the tpl
*
* @var array
*/
static $_columnHeaders;
public static $_columnHeaders;
/**
* Properties of contact we're interested in displaying
* @var array
*/
static $_properties = [
public static $_properties = [
'contact_id',
'membership_id',
'contact_type',
......
......@@ -40,11 +40,15 @@
*
*/
class CRM_Member_Task extends CRM_Core_Task {
const
// Member tasks
LABEL_MEMBERS = 201;
/**
* Member tasks
*/
const LABEL_MEMBERS = 201;
static $objectType = 'membership';
/**
* @var string
*/
public static $objectType = 'membership';
/**
* These tasks are the core set of tasks that the user can perform
......
......@@ -63,8 +63,7 @@ class CRM_Member_Tokens extends \Civi\Token\AbstractTokenSubscriber {
*/
public function checkActive(\Civi\Token\TokenProcessor $processor) {
// Extracted from scheduled-reminders code. See the class description.
return
!empty($processor->context['actionMapping'])
return !empty($processor->context['actionMapping'])
&& $processor->context['actionMapping']->getEntity() === 'civicrm_membership';
}
......
......@@ -143,8 +143,7 @@ class CRM_Note_Form_Note extends CRM_Core_Form {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
);
]);
return;
}
......@@ -166,7 +165,7 @@ class CRM_Note_Form_Note extends CRM_Core_Form {
'type' => 'cancel',
'name' => ts('Cancel'),
],
]
]
);
}
......
......@@ -799,7 +799,7 @@ WHERE li.contribution_id = %1";
* @param array $lineItemsToUpdate
*
* @return array
* List of formatted reverse Financial Items to be recorded
* List of formatted reverse Financial Items to be recorded
*/
protected function getAdjustedFinancialItemsToRecord($entityID, $entityTable, $contributionID, $priceFieldValueIDsToCancel, $lineItemsToUpdate) {
$previousLineItems = CRM_Price_BAO_LineItem::getLineItems($entityID, str_replace('civicrm_', '', $entityTable));
......@@ -872,7 +872,7 @@ WHERE li.contribution_id = %1";
* @param array $feeBlock
*
* @return array
* List of submitted line items
* List of submitted line items
*/
protected function getSubmittedLineItems($inputParams, $feeBlock) {
$submittedLineItems = [];
......@@ -896,7 +896,7 @@ WHERE li.contribution_id = %1";
* @param string $entity
*
* @return array
* Array of line items to alter with the following keys
* Array of line items to alter with the following keys
* - line_items_to_add. If the line items required are new radio options that
* have not previously been set then we should add line items for them
* - line_items_to_update. If we have already been an active option and a change has
......@@ -980,6 +980,7 @@ WHERE li.contribution_id = %1";
return TRUE;
}
}
/**
* Add line Items as result of fee change.
*
......
......@@ -842,7 +842,8 @@ WHERE id IN (" . implode(',', array_keys($priceFields)) . ')';
$error['_qf_default'] = ts('%1 amount can not be less than zero. Please select the options accordingly.', [1 => $componentName]);
}
elseif ($totalAmount > 0 &&
$totalPaymentAmountEnteredOnForm >= $totalAmount && // if total amount is equal to all selected amount in hand
// if total amount is equal to all selected amount in hand
$totalPaymentAmountEnteredOnForm >= $totalAmount &&
(CRM_Utils_Array::value('contribution_status_id', $fields) == CRM_Core_PseudoConstant::getKey('CRM_Contribute_DAO_Contribution', 'contribution_status_id', 'Partially paid'))
) {
$error['total_amount'] = ts('You have specified the status Partially Paid but have entered an amount that equals or exceeds the amount due. Please adjust the status of the payment or the amount');
......
......@@ -42,7 +42,7 @@ class CRM_Price_BAO_PriceSet extends CRM_Price_DAO_PriceSet {
*
* @var array
*/
static $_defaultPriceSet = NULL;
public static $_defaultPriceSet = NULL;
/**
* Class constructor.
......@@ -559,7 +559,6 @@ WHERE id = %1";
return (int) implode('_', array_keys($priceSet['fields'][$priceFieldID]['options']));
}
/**
* Initiate price set such that various non-BAO things are set on the form.
*
......
......@@ -64,6 +64,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form {
/**