Skip to content

Commit

Permalink
Merge pull request #16134 from eileenmcnaughton/member_legacy
Browse files Browse the repository at this point in the history
Remove legacy_redirect_path handling
  • Loading branch information
seamuslee001 authored Dec 22, 2019
2 parents df8f605 + 47abf30 commit 439e52a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
12 changes: 0 additions & 12 deletions CRM/Core/LegacyErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,6 @@ public static function handleException($event) {
CRM_Utils_Array::value('message_title', $params),
CRM_Utils_Array::value('message_type', $params, 'error')
);

// @todo remove this code - legacy redirect path is an interim measure for moving redirects out of BAO
// to somewhere slightly more acceptable. they should not be part of the exception class & should
// be managed @ the form level - if you find a form that is triggering this piece of code
// you should log a ticket for it to be removed with details about the form you were on.
if (!empty($params['legacy_redirect_path'])) {
if (CRM_Utils_System::isDevelopment()) {
$intentionalENotice = "How did you get HERE?! - Please log in JIRA";
// here we could set a message telling devs to log it per above
}
CRM_Utils_System::redirect($params['legacy_redirect_path'], $params['legacy_redirect_query']);
}
}
}

Expand Down
10 changes: 0 additions & 10 deletions CRM/Member/BAO/Membership.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,16 +269,6 @@ public static function create(&$params, &$ids = []) {
'today', $excludeIsAdmin, CRM_Utils_Array::value('membership_type_id', $params), $params
);
if (empty($calcStatus)) {
// Redirect the form in case of error
// @todo this redirect in the BAO layer is really bad & should be moved to the form layer
// however since we have no idea how (if) this is triggered we can't safely move / remove it
// NB I tried really hard to trigger this error from backoffice membership form in order to test it
// and am convinced form validation is complete on that form WRT this error.
$errorParams = [
'message_title' => ts('No valid membership status for given dates.'),
'legacy_redirect_path' => 'civicrm/contact/view',
'legacy_redirect_query' => "reset=1&force=1&cid={$params['contact_id']}&selectedChild=member",
];
throw new CRM_Core_Exception(ts(
"The membership cannot be saved because the status cannot be calculated for start_date: $start_date end_date $end_date join_date $join_date as at " . date('Y-m-d H:i:s')),
0,
Expand Down

0 comments on commit 439e52a

Please sign in to comment.