if (empty($params['is_override']) && empty($params['skipStatusCal'])) {
$fieldsToLoad = [];
foreach (['start_date', 'end_date', 'join_date'] as $dateField) {
- if (!empty($params[$dateField]) && $params[$dateField] !== 'null' && strpos($params[$dateField], date('Ymd', strtotime(trim($params[$dateField])))) !== 0) {
- $params[$dateField] = date('Ymd', strtotime(trim($params[$dateField])));
+ if (!empty($params[$dateField]) && $params[$dateField] !== 'null' && strpos($params[$dateField], date('Ymd', CRM_Utils_Time::strtotime(trim($params[$dateField])))) !== 0) {
+ $params[$dateField] = date('Ymd', CRM_Utils_Time::strtotime(trim($params[$dateField])));
// @todo enable this once core is using the api.
// CRM_Core_Error::deprecatedWarning('Relying on the BAO to clean up dates is deprecated. Call membership create via the api');
}
$dates = ['startDate', 'endDate'];
foreach ($dates as $date) {
if (strlen($$date) === 8) {
- $$date = date('Y-m-d', strtotime($$date));
+ $$date = date('Y-m-d', CRM_Utils_Time::strtotime($$date));
}
}
$currentMembership['end_date'],
$format
),
- 'modified_date' => date('Y-m-d H:i:s', strtotime($today)),
+ 'modified_date' => date('Y-m-d H:i:s', CRM_Utils_Time::strtotime($today)),
'membership_type_id' => $currentMembership['membership_type_id'],
'max_related' => $currentMembership['max_related'] ?? 0,
];
*/
protected static function matchesRequiredMembership($params, $membership) {
foreach (['start_date', 'end_date'] as $date) {
- if (strtotime($params[$date]) !== strtotime($membership[$date])) {
+ if (CRM_Utils_Time::strtotime($params[$date]) !== CRM_Utils_Time::strtotime($membership[$date])) {
return FALSE;
}
if ((int) $params['status_id'] !== (int) $membership['status_id']) {
}
$today = time();
- if ($deceasedDate && strtotime($deceasedDate) > $today) {
+ if ($deceasedDate && CRM_Utils_Time::strtotime($deceasedDate) > $today) {
return $updateMembershipMsg;
}
CRM_Core_Error::deprecatedFunctionWarning('pass now rather than today in');
}
- $statusDate = date('Ymd', strtotime($statusDate));
+ $statusDate = date('Ymd', CRM_Utils_Time::strtotime($statusDate));
//fix for CRM-3570, if we have statuses with is_admin=1,
//exclude these statuses from calculatation during import.
$membershipStatus = CRM_Core_DAO::executeQuery($query);
$dates = [
- 'start' => ($startDate && $startDate !== 'null') ? date('Ymd', strtotime($startDate)) : '',
- 'end' => ($endDate && $endDate !== 'null') ? date('Ymd', strtotime($endDate)) : '',
- 'join' => ($joinDate && $joinDate !== 'null') ? date('Ymd', strtotime($joinDate)) : '',
+ 'start' => ($startDate && $startDate !== 'null') ? date('Ymd', CRM_Utils_Time::strtotime($startDate)) : '',
+ 'end' => ($endDate && $endDate !== 'null') ? date('Ymd', CRM_Utils_Time::strtotime($endDate)) : '',
+ 'join' => ($joinDate && $joinDate !== 'null') ? date('Ymd', CRM_Utils_Time::strtotime($joinDate)) : '',
];
while ($membershipStatus->fetch()) {
if ($membershipStatus->{$eve . '_event_adjust_unit'} &&
$membershipStatus->{$eve . '_event_adjust_interval'}
) {
- $month = date('m', strtotime($date));
- $day = date('d', strtotime($date));
- $year = date('Y', strtotime($date));
+ $month = date('m', CRM_Utils_Time::strtotime($date));
+ $day = date('d', CRM_Utils_Time::strtotime($date));
+ $year = date('Y', CRM_Utils_Time::strtotime($date));
// add in months
if ($membershipStatus->{$eve . '_event_adjust_unit'} === 'month') {
${$eve . 'Event'} = date('Ymd', mktime(0, 0, 0,
$recurParams['start_date'] = $recurParams['create_date'] = $recurParams['modified_date'] = date('YmdHis');
if (!empty($params['receive_date'])) {
- $recurParams['start_date'] = date('YmdHis', strtotime($params['receive_date']));
+ $recurParams['start_date'] = date('YmdHis', CRM_Utils_Time::strtotime($params['receive_date']));
}
$recurParams['invoice_id'] = $params['invoiceID'] ?? NULL;
$recurParams['contribution_status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending');
])) {
return CRM_Member_BAO_Membership::create($memParams);
}
- $memParams['join_date'] = date('Ymd', strtotime($currentMembership['join_date']));
+ $memParams['join_date'] = date('Ymd', CRM_Utils_Time::strtotime($currentMembership['join_date']));
$isMembershipCurrent = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipStatus', $currentMembership['status_id'], 'is_current_member');
// CRM-7297 Membership Upsell - calculate dates based on new membership type