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

CRM-19739 : New Account Relationship Option Screen does not show excep… #10651

Merged
merged 3 commits into from
Aug 21, 2017

Conversation

jitendrapurohit
Copy link
Contributor

@jitendrapurohit jitendrapurohit commented Jul 13, 2017

…tion

Exception fails to show message on ajax pop-up, hence replaced it with setStatus() and returned false if relationship isn't calculated as valid.


@jitendrapurohit jitendrapurohit changed the title CRM-19739: New Account Relationship Option Screen does not show excep… CRM-19739 : New Account Relationship Option Screen does not show excep… Jul 13, 2017
@kainuk
Copy link
Contributor

kainuk commented Aug 12, 2017

Hi Jitendra, just tested the patch and shows the message. Thanks for fixing it. (Klaas Eikelboom)

@jitendrapurohit
Copy link
Contributor Author

Thanks @kainuk.

@eileenmcnaughton @monishdeb Can we merge this as it is being tested as per above comment.

self::validateRelationship($financialTypeAccount);
$valid = self::validateRelationship($financialTypeAccount);
if (!$valid) {
return FALSE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jitendrapurohit the function we are calling here appears to throw an exception - which seems really appropriate for the BAO layer. I feel like the form layer should catch the exception & call CRM_Core_Session::statusBounce().

@@ -300,7 +300,9 @@ public function postProcess() {
$params['entity_id'] = $this->_aid;
}
$financialTypeAccount = CRM_Financial_BAO_FinancialTypeAccount::add($params, $ids);
CRM_Core_Session::setStatus(ts('The financial type Account has been saved.'));
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton Aug 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, what I was alluding to above is I think this could be

try {
  $financialTypeAccount = CRM_Financial_BAO_FinancialTypeAccount::add($params, $ids);
}
catch (CRM_Core_Exception $e) {
  CRM_Core_Session::statusBounce($e->getMessage());
}

Copy link
Contributor Author

@jitendrapurohit jitendrapurohit Aug 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and updated the code with statusBounce(). Thanks for the suggestion 👍

@eileenmcnaughton
Copy link
Contributor

@jitendrapurohit style issue :-(

I think the testing @kainuk did earlier still stands, although this is slightly different now

@kainuk
Copy link
Contributor

kainuk commented Aug 16, 2017

I did a new a functional test with the latest code.

@eileenmcnaughton
Copy link
Contributor

You rock!

}
catch (CRM_Core_Exception $e) {
CRM_Core_Error::statusBounce($e->getMessage());
}
CRM_Core_Session::setStatus(ts('The financial type Account has been saved.'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L308 should be moved after line 303?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @pradpnayak - the statusBounce will mean the code does not reach that line, but that will be much clear if you change it as suggested @jitendrapurohit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the success message to the specified line for clarity.

@eileenmcnaughton
Copy link
Contributor

Merging - thanks @jitendrapurohit & @pradpnayak for review & suggestion

@eileenmcnaughton
Copy link
Contributor

also thanks @kainuk

@eileenmcnaughton eileenmcnaughton merged commit 5105de0 into civicrm:master Aug 21, 2017
@jitendrapurohit jitendrapurohit deleted the CRM-19739 branch April 16, 2019 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants