Commit bb5eaaf0 authored by totten's avatar totten Committed by eileen

Regenerate civicrm_generated.mysql

parent 4567fc9c
......@@ -16,10 +16,8 @@ function sequentialcreditnotes_civicrm_alterSettingsFolders(&$metaDataFolders =
* Add a creditnote_id if appropriate.
*
* If the contribution is created with cancelled or refunded status, add credit note id
* do the same for chargeback - this entered the code 'accidentally' but moving it to here
* as part of cleanup maintains consistency.
*
* Note that the
* do the same for chargeback
* - creditnotes for chargebacks entered the code 'accidentally' but since it did we maintain it.
*
* @param \CRM_Core_DAO $op
* @param string $objectName
......@@ -34,7 +32,7 @@ function sequentialcreditnotes_civicrm_pre($op, $objectName, $id, &$params) {
$reversalStatuses = ['Cancelled', 'Chargeback', 'Refunded'];
if (empty($params['creditnote_id']) && in_array(CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $params['contribution_status_id']), $reversalStatuses, TRUE)) {
if ($id) {
$existing = Contribution::get()->addWhere('id', '=', (int) $id)->setSelect(['creditnote_id'])->execute()->first();
$existing = Contribution::get()->setCheckPermissions(FALSE)->addWhere('id', '=', (int) $id)->setSelect(['creditnote_id'])->execute()->first();
if ($existing['creditnote_id']) {
// Since we have it adding it makes is clearer.
$params['creditnote_id'] = $existing['creditnote_id'];
......
This diff is collapsed.
......@@ -486,6 +486,8 @@ class api_v3_PaymentTest extends CiviUnitTestCase {
/**
* Test negative payment using create API.
*
* @throws \CRM_Core_Exception
*/
public function testRefundPayment() {
$result = $this->callAPISuccess('Contribution', 'create', [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment