Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy_redirect_path handling #16134

Merged
merged 1 commit into from
Dec 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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