Skip to content

Commit

Permalink
Convert MembershipLog.modified_date from date to timestamp so we reco…
Browse files Browse the repository at this point in the history
…rd time as well
  • Loading branch information
mattwire committed Jan 16, 2025
1 parent 128739c commit e75b04a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions CRM/Member/BAO/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ public static function fixMembershipStatusBeforeRenew(&$currentMembership, $chan
$currentMembership['end_date'],
$format
),
'modified_date' => date('Y-m-d H:i:s', CRM_Utils_Time::strtotime($today)),
'modified_date' => date('YmdHis', CRM_Utils_Time::strtotime($today)),
'membership_type_id' => $currentMembership['membership_type_id'],
'max_related' => $currentMembership['max_related'] ?? 0,
];
Expand Down Expand Up @@ -2490,7 +2490,7 @@ public static function updateMembershipStatus($deceasedParams, $contactType) {
'start_date' => CRM_Utils_Date::isoToMysql($dao->start_date),
'end_date' => CRM_Utils_Date::isoToMysql($dao->end_date),
'modified_id' => $userId,
'modified_date' => CRM_Utils_Time::date('Ymd'),
'modified_date' => CRM_Utils_Time::date('YmdHis'),
'membership_type_id' => $dao->membership_type_id,
'max_related' => $dao->max_related,
];
Expand Down Expand Up @@ -2576,7 +2576,7 @@ private static function createMembershipLog($membership, string $logStartDate =
'status_id' => $membership->status_id,
'start_date' => $logStartDate,
'end_date' => CRM_Utils_Date::isoToMysql($membership->end_date),
'modified_date' => CRM_Utils_Time::date('Ymd'),
'modified_date' => CRM_Utils_Time::date('YmdHis'),
'membership_type_id' => $membershipTypeID ?? $membership->membership_type_id,
'max_related' => $membership->max_related,
];
Expand Down
8 changes: 8 additions & 0 deletions CRM/Upgrade/Incremental/php/FiveEightyThree.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ class CRM_Upgrade_Incremental_php_FiveEightyThree extends CRM_Upgrade_Incrementa
*/
public function upgrade_5_83_alpha1($rev): void {
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
$this->addTask(
'Convert MembershipLog.modified_date to timestamp',
'alterColumn',
'civicrm_membership_log',
'modified_date',
"timestamp NULL DEFAULT NULL COMMENT 'Date this membership modification action was logged.'",
FALSE
);
}

}
2 changes: 1 addition & 1 deletion schema/Member/MembershipLog.entityType.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
],
'modified_date' => [
'title' => ts('Membership Change Date'),
'sql_type' => 'date',
'sql_type' => 'timestamp',
'input_type' => 'Select Date',
'description' => ts('Date this membership modification action was logged.'),
'add' => '1.5',
Expand Down

0 comments on commit e75b04a

Please sign in to comment.