Skip to content

Commit

Permalink
Merge pull request civicrm#11187 from yashodha/CRM-21342
Browse files Browse the repository at this point in the history
CRM-21342 - Contribution note is not wiped if the value is removed
  • Loading branch information
colemanw authored and sluc23 committed Jan 10, 2018
2 parents f9fc6d0 + 79cf7e7 commit f73a2d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CRM/Contribute/Form/AdditionalInfo.php
Expand Up @@ -254,6 +254,10 @@ public static function processPremium($params, $contributionID, $premiumID = NUL
* @param int $contributionNoteID
*/
public static function processNote($params, $contactID, $contributionID, $contributionNoteID = NULL) {
if (CRM_Utils_System::isNull($params['note']) && $contributionNoteID) {
CRM_Core_BAO_Note::del($contributionNoteID);
return;
}
//process note
$noteParams = array(
'entity_table' => 'civicrm_contribution',
Expand Down
4 changes: 2 additions & 2 deletions CRM/Contribute/Form/Contribution.php
Expand Up @@ -534,7 +534,7 @@ public function buildQuickForm() {
}

if ($this->_noteID &&
isset($this->_values['note'])
!CRM_Utils_System::isNull($this->_values['note'])
) {
$defaults['hidden_AdditionalDetail'] = 1;
}
Expand Down Expand Up @@ -1701,7 +1701,7 @@ protected function submit($submittedValues, $action, $pledgePaymentID) {
);
}

if ($contribution->id && !empty($submittedValues['note'])) {
if ($contribution->id && array_key_exists('note', $submittedValues)) {
CRM_Contribute_Form_AdditionalInfo::processNote($submittedValues, $this->_contactID, $contribution->id, $this->_noteID);
}

Expand Down

0 comments on commit f73a2d8

Please sign in to comment.