diff --git a/CRM/Core/Payment/eWAYRecurring.php b/CRM/Core/Payment/eWAYRecurring.php index 2dba510..0324c44 100644 --- a/CRM/Core/Payment/eWAYRecurring.php +++ b/CRM/Core/Payment/eWAYRecurring.php @@ -804,4 +804,12 @@ private function updateContactBillingAddress($params, $contribution) { civicrm_api3('Address', 'create', $billingAddress); } + /** + * Specify which fields are valid for update on Recurring Contributions + * + * @return array + */ + public function getEditableRecurringScheduleFields() { + return ['amount', 'installments', 'frequency_interval', 'frequency_unit', 'next_sched_contribution_date', 'end_date']; + } } diff --git a/eWAYRecurring.php b/eWAYRecurring.php index bad00e5..e4c3273 100644 --- a/eWAYRecurring.php +++ b/eWAYRecurring.php @@ -176,34 +176,7 @@ function ewayrecurring_civicrm_entityTypes(&$entityTypes) { * @param $form CRM_Core_Form */ function ewayrecurring_civicrm_buildForm($formName, &$form) { - if ($form instanceof CRM_Contribute_Form_UpdateSubscription) { - $contributionRecur = $form->_paymentProcessorObj; - if (($contributionRecur instanceof CRM_Core_Payment_eWAYRecurring)) { - $crid = $form->getEntityId(); - if ($crid) { - $sql = 'SELECT next_sched_contribution_date FROM civicrm_contribution_recur WHERE id = %1'; - $form->add('datepicker','next_scheduled_date', ts('Next Scheduled Date'), [ 'minDate' => date('Y-m-d')]); - if ($default_nsd = CRM_Core_DAO::singleValueQuery($sql, [ - 1 => [ - $crid, - 'Int', - ], - ])) { - $defaults['next_scheduled_date'] = $default_nsd; - $form->setDefaults($defaults); - } - // add next scheduled date field - $template = $form->toSmarty(); - Civi::resources() - ->addScript("CRM.eway.modifyUpdateSubscriptionForm(" . - json_encode([ - 'next_scheduled_date' => $template['next_scheduled_date'], - ]) . ");" - ); - } - } - } - elseif (($form instanceof CRM_Contribute_Form_CancelSubscription) && + if (($form instanceof CRM_Contribute_Form_CancelSubscription) && ($form->_paymentProcessor['payment_processor_type'] == 'eWay_Recurring')) { $form->removeElement('send_cancel_request'); } @@ -233,22 +206,6 @@ function ewayrecurring_civicrm_validateForm($formName, &$fields, &$files, &$form $errors['password'] = E::ts('API Password is a required field.'); } break; - case 'CRM_Contribute_Form_UpdateSubscription': - $submitted_nsd = strtotime(($fields['next_scheduled_date'] ?? '') . ' ' . ($fields['next_scheduled_date_time'] ?? '')); - - ($crid = $form->getVar('contributionRecurID')) || ($crid = $form->getVar('_crid')); - - $sql = 'SELECT UNIX_TIMESTAMP(MAX(receive_date)) FROM civicrm_contribution WHERE contribution_recur_id = %1'; - $current_nsd = CRM_Core_DAO::singleValueQuery($sql, [1 => [$crid, 'Int']]); - $form->setVar('_currentNSD', $current_nsd); - - if ($submitted_nsd < $current_nsd) { - $errors['next_scheduled_date'] = ts('Cannot schedule next contribution date before latest received date'); - } - elseif ($submitted_nsd < time()) { - $errors['next_scheduled_date'] = ts('Cannot schedule next contribution in the past'); - } - break; } } diff --git a/info.xml b/info.xml index f18e664..71dd1d3 100644 --- a/info.xml +++ b/info.xml @@ -15,8 +15,8 @@ support@agileware.com.au stable - 2023-12-15 - 2.6.5 + 2024-04-22 + 2.6.6 5.38