From: kurund Date: Tue, 17 Dec 2013 05:52:38 +0000 (-0800) Subject: Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2013-12-16-21-42-04 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ed0d980a1603209bcb6cfd5ac308a9d96db7e70b;p=civicrm-core.git Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2013-12-16-21-42-04 Conflicts: CRM/Event/BAO/Participant.php templates/CRM/common/Navigation.tpl --- ed0d980a1603209bcb6cfd5ac308a9d96db7e70b diff --cc CRM/Contribute/Form/Contribution.php index ed1ad471be,180fd19f2f..a8d26025a5 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@@ -934,10 -934,24 +934,24 @@@ class CRM_Contribute_Form_Contribution } //FIXME FOR NEW DATA FLOW http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow - if (CRM_Utils_Array::value('fee_amount', $fields) + if (CRM_Utils_Array::value('fee_amount', $fields) && $financialType = CRM_Contribute_BAO_Contribution::validateFinancialType($fields['financial_type_id'])) { - $errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType; + $errors['financial_type_id'] = ts("Financial Account of account relationship of 'Expense Account is' is not configured for Financial Type : ") . $financialType; } + + // $trxn_id must be unique CRM-13919 + if (!empty($fields['trxn_id'])) { + $queryParams = array(1 => array($fields['trxn_id'], 'String')); + $query = 'select count(*) from civicrm_contribution where trxn_id = %1'; + if ($self->_id) { + $queryParams[2] = array((int)$self->_id, 'Integer'); + $query .= ' and id !=%2'; + } + $tCnt = CRM_Core_DAO::singleValueQuery($query, $queryParams); + if ($tCnt) { + $errors['trxn_id'] = ts('Transaction ID\'s must be unique. Transaction \'%1\' already exists in your database.', array(1 => $fields['trxn_id'])); + } + } $errors = array_merge($errors, $softErrors); return $errors;