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-16188, added order api for delete action and test #7684

Merged
merged 2 commits into from
Feb 9, 2016

Conversation

pradpnayak
Copy link
Contributor


* @return array
*/
function civicrm_api3_order_delete($params) {
$contribution = civicrm_api3('Contribution', 'get', array(
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a note here - one way to make this shorter would be

if (!civicrm_api3('Contribution', 'getvalue', array('return' => 'is_test', 'id' => $params['id')) {
throw new ....
}

Note you can be sure $params['id'] will be set due to your aliasing - you don't need to check contribution_id.

Also - I suggest you edit the exception to say only test orders can be deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had tried with

$result = civicrm_api3('Contribution', 'getvalue', array(
'sequential' => 1,
'return' => array("is_test"),
'id' => 22,
));

I was getting exception error with 'field Array unset or not existing'.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah I think that might be a bug in the contribution api - no accepting that as a return value

@eileenmcnaughton
Copy link
Contributor

The test fails are unrelated but I think it's worth at minimum expanding the api exception message to state the reason and getting rid of the unnecessary e-notice preventions. The other comments are more in the nice-to-have.

I don't see any larger concerns with this PR

@eileenmcnaughton eileenmcnaughton changed the title CRM-16188, added order api for delete action and test [needs minor changes] CRM-16188, added order api for delete action and test Feb 1, 2016
@eileenmcnaughton
Copy link
Contributor

I've updated the title to [needs minor changes] to reflect my comment above - please change to [needs core team review] when you have fixed the exception (& preferably the enotice over-handling)

@pradpnayak pradpnayak changed the title [needs minor changes] CRM-16188, added order api for delete action and test [needs core team review] CRM-16188, added order api for delete action and test Feb 8, 2016
@eileenmcnaughton eileenmcnaughton changed the title [needs core team review] CRM-16188, added order api for delete action and test CRM-16188, added order api for delete action and test Feb 9, 2016
eileenmcnaughton added a commit that referenced this pull request Feb 9, 2016
CRM-16188, added order api for delete action and test
@eileenmcnaughton eileenmcnaughton merged commit 1c0d8fc into civicrm:master Feb 9, 2016
@pradpnayak pradpnayak deleted the CRM-16188-3 branch April 27, 2016 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants