From 47abf309c12b6627e5023c52806ca0c80cf08daa Mon Sep 17 00:00:00 2001 From: eileen Date: Sun, 22 Dec 2019 11:47:12 +1300 Subject: [PATCH] Remove legacy_redirect_path handling This has been hanging around for a long time & no-one has logged a JIRA (or pointed out that JIRA is now defunct) so the initial analysis of it being unreachable makes sense --- CRM/Core/LegacyErrorHandler.php | 12 ------------ CRM/Member/BAO/Membership.php | 10 ---------- 2 files changed, 22 deletions(-) diff --git a/CRM/Core/LegacyErrorHandler.php b/CRM/Core/LegacyErrorHandler.php index ae0f1f9859..f82b3ce6d3 100644 --- a/CRM/Core/LegacyErrorHandler.php +++ b/CRM/Core/LegacyErrorHandler.php @@ -20,18 +20,6 @@ class CRM_Core_LegacyErrorHandler { 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']); - } } } diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index 7794deef0c..1198b7f149 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -269,16 +269,6 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { '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, -- 2.25.1