'membership_type_id',
'member_is_test',
'is_override',
+ 'member_is_override',
'status_override_end_date',
'status_id',
'member_is_pay_later'
*
* Generated from xml/schema/CRM/Member/Membership.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:64ef044391b9dee565e8e2a9d893f4cf)
+ * (GenCodeChecksum:40f3b0813c1e13fab544ae1f8fa2ebb3)
*/
/**
'labelColumn' => 'label',
],
],
- 'is_override' => [
+ 'member_is_override' => [
'name' => 'is_override',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Status Override'),
'title' => ts('Max Related'),
'description' => ts('Maximum number of related memberships (membership_type override).'),
'where' => 'civicrm_membership.max_related',
+ 'export' => TRUE,
'table_name' => 'civicrm_membership',
'entity' => 'Membership',
'bao' => 'CRM_Member_BAO_Membership',
'type' => 'CheckBox',
],
],
- 'contribution_recur_id' => [
+ 'membership_recur_id' => [
'name' => 'contribution_recur_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Membership Recurring Contribution'),
'description' => ts('Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.'),
'where' => 'civicrm_membership.contribution_recur_id',
+ 'export' => TRUE,
'table_name' => 'civicrm_membership',
'entity' => 'Membership',
'bao' => 'CRM_Member_BAO_Membership',
$params[$key] = $this->parsePseudoConstantField($val, $this->fieldMetadata[$key]);
break;
- case 'is_override':
+ case 'member_is_override':
$params[$key] = CRM_Utils_String::strtobool($val);
break;
}
else {
//fix for CRM-2219 Update Membership
// onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE
- if (!empty($formatted['is_override']) && empty($formatted['status_id'])) {
+ if (!empty($formatted['member_is_override']) && empty($formatted['status_id'])) {
array_unshift($values, 'Required parameter missing: Status');
return CRM_Import_Parser::ERROR;
}
//fix for CRM-3570, exclude the statuses those having is_admin = 1
//now user can import is_admin if is override is true.
$excludeIsAdmin = FALSE;
- if (empty($formatted['is_override'])) {
+ if (empty($formatted['member_is_override'])) {
$formatted['exclude_is_admin'] = $excludeIsAdmin = TRUE;
}
$calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate,
if (empty($formatted['status_id'])) {
$formatted['status_id'] = $calcStatus['id'];
}
- elseif (empty($formatted['is_override'])) {
+ elseif (empty($formatted['member_is_override'])) {
if (empty($calcStatus)) {
array_unshift($values, 'Status in import row (' . $formatValues['status_id'] . ') does not match calculated status based on your configured Membership Status Rules. Record was not imported.');
return CRM_Import_Parser::ERROR;
//fix for CRM-3570, exclude the statuses those having is_admin = 1
//now user can import is_admin if is override is true.
$excludeIsAdmin = FALSE;
- if (empty($formatted['is_override'])) {
+ if (empty($formatted['member_is_override'])) {
$formatted['exclude_is_admin'] = $excludeIsAdmin = TRUE;
}
$calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate,
if (empty($formatted['status_id'])) {
$formatted['status_id'] = CRM_Utils_Array::value('id', $calcStatus);
}
- elseif (empty($formatted['is_override'])) {
+ elseif (empty($formatted['member_is_override'])) {
if (empty($calcStatus)) {
array_unshift($values, 'Status in import row (' . CRM_Utils_Array::value('status_id', $formatValues) . ') does not match calculated status based on your configured Membership Status Rules. Record was not imported.');
return CRM_Import_Parser::ERROR;
* (change the x in the function name):
*/
- // /**
- // * Upgrade function.
- // *
- // * @param string $rev
- // */
- // public function upgrade_5_0_x($rev) {
- // $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
- // $this->addTask('Do the foo change', 'taskFoo', ...);
- // // Additional tasks here...
- // // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex.
- // // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
- // }
+ /**
+ * Upgrade function.
+ *
+ * @param string $rev
+ */
+ public function upgrade_5_18_alpha1($rev) {
+ $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
+ $this->addTask('Update smart groups to reflect change of unique name for is_override', 'updateSmartGroups', [
+ 'renameField' => [
+ ['old' => 'is_override', 'new' => 'member_is_override'],
+ ],
+ ]);
+ }
// public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) {
// return TRUE;
'Membership Status' => 'New',
'Membership ID' => '2',
'Primary Member ID' => '',
- 'max_related' => '',
- 'membership_recur_id' => 1,
+ 'Max Related' => '',
+ 'Membership Recurring Contribution' => 1,
'Campaign ID' => '',
- 'member_is_override' => '',
+ 'Status Override' => '',
'Total Amount' => '200.00',
'Contribution Status' => 'Pending',
'Date Received' => '2019-07-25 07:34:23',
88 => 'Membership Status',
89 => 'Membership ID',
90 => 'Primary Member ID',
- 91 => 'max_related',
- 92 => 'membership_recur_id',
+ 91 => 'Max Related',
+ 92 => 'Membership Recurring Contribution',
93 => 'Campaign ID',
- 94 => 'member_is_override',
+ 94 => 'Status Override',
];
}
'membership_status' => 'membership_status varchar(255)',
'membership_id' => 'membership_id varchar(16)',
'owner_membership_id' => 'owner_membership_id varchar(16)',
- 'max_related' => 'max_related text',
- 'membership_recur_id' => 'membership_recur_id varchar(255)',
+ 'max_related' => 'max_related varchar(16)',
+ 'membership_recur_id' => 'membership_recur_id varchar(16)',
'member_campaign_id' => 'member_campaign_id varchar(16)',
- 'member_is_override' => 'member_is_override text',
+ 'member_is_override' => 'member_is_override varchar(16)',
];
}
$this->assertEquals(2, $result['count']);
}
+ /**
+ * Test overriding a membership but not providing status.
+ *
+ * @throws \CRM_Core_Exception
+ */
public function testImportOverriddenMembershipButWithoutStatus() {
$this->individualCreate(['email' => 'anthony_anderson2@civicrm.org']);
'mapper[0][0]' => 'email',
'mapper[1][0]' => 'membership_type_id',
'mapper[2][0]' => 'membership_start_date',
- 'mapper[3][0]' => 'is_override',
+ 'mapper[3][0]' => 'member_is_override',
];
$membershipImporter = new CRM_Member_Import_Parser_Membership($fieldMapper);
$membershipImporter->init();
'email',
'membership_type_id',
'membership_start_date',
- 'is_override',
+ 'member_is_override',
'status_id',
]);
'mapper[0][0]' => 'email',
'mapper[1][0]' => 'membership_type_id',
'mapper[2][0]' => 'membership_start_date',
- 'mapper[3][0]' => 'is_override',
+ 'mapper[3][0]' => 'member_is_override',
'mapper[4][0]' => 'status_id',
'mapper[5][0]' => 'status_override_end_date',
];
'mapper[0][0]' => 'email',
'mapper[1][0]' => 'membership_type_id',
'mapper[2][0]' => 'membership_start_date',
- 'mapper[3][0]' => 'is_override',
+ 'mapper[3][0]' => 'member_is_override',
'mapper[4][0]' => 'status_id',
'mapper[5][0]' => 'status_override_end_date',
];
'email',
'membership_type_id',
'membership_start_date',
- 'is_override',
+ 'member_is_override',
'status_id',
]);
$this->callAPISuccess('Membership', 'Delete', [
'id' => $this->_membershipID,
]);
- $this->assertEquals($result['contact_id'], $this->_contactID, "In line " . __LINE__);
- $this->assertEquals($result['membership_type_id'], $this->_membershipTypeID, "In line " . __LINE__);
- $this->assertEquals($result['status_id'], $this->_membershipStatusID, "In line " . __LINE__);
- $this->assertEquals($result['join_date'], '2009-01-21', "In line " . __LINE__);
- $this->assertEquals($result['start_date'], '2009-01-21', "In line " . __LINE__);
- $this->assertEquals($result['end_date'], '2009-12-21', "In line " . __LINE__);
- $this->assertEquals($result['source'], 'Payment', "In line " . __LINE__);
- $this->assertEquals($result['is_override'], 1, "In line " . __LINE__);
+ $this->assertEquals($result['contact_id'], $this->_contactID);
+ $this->assertEquals($result['membership_type_id'], $this->_membershipTypeID);
+ $this->assertEquals($result['status_id'], $this->_membershipStatusID);
+ $this->assertEquals($result['join_date'], '2009-01-21');
+ $this->assertEquals($result['start_date'], '2009-01-21');
+ $this->assertEquals($result['end_date'], '2009-12-21');
+ $this->assertEquals($result['source'], 'Payment');
+ $this->assertEquals($result['is_override'], 1);
}
/**
</foreignKey>
<field>
<name>is_override</name>
+ <uniqueName>member_is_override</uniqueName>
<title>Status Override</title>
<import>true</import>
+ <export>true</export>
<headerPattern>/override$/i</headerPattern>
<type>boolean</type>
<comment>Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record.</comment>
<type>int</type>
<comment>Maximum number of related memberships (membership_type override).</comment>
<add>4.3</add>
+ <export>true</export>
<html>
<type>Text</type>
</html>
</field>
<field>
<name>contribution_recur_id</name>
+ <uniqueName>membership_recur_id</uniqueName>
<title>Membership Recurring Contribution</title>
<type>int unsigned</type>
+ <export>true</export>
<comment>Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.</comment>
<add>3.3</add>
</field>