From 7a17438cc31e7a5ccb188699debd10a928da67f8 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 18 Mar 2019 14:21:06 +1300 Subject: [PATCH] Update Cancel Billing & update billing to use status bounce rather than fatal Per https://lab.civicrm.org/dev/core/issues/560 we have resolved to get rid of fatal & move to throwing Exceptions. However, I'm leaning towards making statusBounces the rules for when we just deem a form inaccessible. In this case we have 3 paralel forms - cancel, update & a similar update but slightly different just cos. One does a status bounce - 2 spit out fatals when access not available. Just looking at Cancel these are the places that still have fatal - The recurring contribution looks to have been cancelled already - Required information missing I'm not sure the value of a fatal as opposed to the gentler statusBounces in either of those cases. Throwing an exception looks very much like a fatal except 1) it doesn't hurt tests or cli tools as much 2) IF display backtrace is enabled THEN the back trace displays. so, it's generally better BUT I kinda feel like the only time when it's actually better than a status bounce is when a bug has occurred (eg. an unexpectedly failed api call) - anything we anticipate seems like a bounce to me.... --- CRM/Contribute/Form/CancelSubscription.php | 2 +- CRM/Contribute/Form/UpdateBilling.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Form/CancelSubscription.php b/CRM/Contribute/Form/CancelSubscription.php index 8c76d9502d..c904f7fa94 100644 --- a/CRM/Contribute/Form/CancelSubscription.php +++ b/CRM/Contribute/Form/CancelSubscription.php @@ -107,7 +107,7 @@ class CRM_Contribute_Form_CancelSubscription extends CRM_Core_Form { if (!CRM_Core_Permission::check('edit contributions')) { if ($this->_subscriptionDetails->contact_id != $this->getContactID()) { - CRM_Core_Error::fatal(ts('You do not have permission to cancel this recurring contribution.')); + CRM_Core_Error::statusBounce(ts('You do not have permission to cancel this recurring contribution.')); } $this->_selfService = TRUE; } diff --git a/CRM/Contribute/Form/UpdateBilling.php b/CRM/Contribute/Form/UpdateBilling.php index e9c19c4332..0e7cc9b267 100644 --- a/CRM/Contribute/Form/UpdateBilling.php +++ b/CRM/Contribute/Form/UpdateBilling.php @@ -89,7 +89,7 @@ class CRM_Contribute_Form_UpdateBilling extends CRM_Core_Form { } if (!CRM_Core_Permission::check('edit contributions')) { if ($this->_subscriptionDetails->contact_id != $this->getContactID()) { - CRM_Core_Error::fatal(ts('You do not have permission to cancel subscription.')); + CRM_Core_Error::statusBounce(ts('You do not have permission to cancel subscription.')); } $this->_selfService = TRUE; } -- 2.25.1