*/
public static function formRule($fields, $files, $self) {
$errors = array();
-
// Check for Credit Card Contribution.
if ($self->_mode) {
if (empty($fields['payment_processor_id'])) {
CRM_Contribute_BAO_ContributionRecur::validateRecurContribution($fields, $files, $self, $errors);
// Form rule for status http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow
- if ($self->_id && $self->_values['contribution_status_id'] != $fields['contribution_status_id']) {
+ if (($self->_action & CRM_Core_Action::UPDATE)
+ && $self->_id
+ && $self->_values['contribution_status_id'] != $fields['contribution_status_id']
+ ) {
CRM_Contribute_BAO_Contribution::checkStatusValidation($self->_values, $fields, $errors);
}
// CRM-16015, add form-rule to restrict change of financial type if using price field of different financial type
- if ($self->_id && $self->_values['financial_type_id'] != $fields['financial_type_id']) {
+ if (($self->_action & CRM_Core_Action::UPDATE)
+ && $self->_id
+ && $self->_values['financial_type_id'] != $fields['financial_type_id']
+ ) {
CRM_Contribute_BAO_Contribution::checkFinancialTypeChange(NULL, $self->_id, $errors);
}
//FIXME FOR NEW DATA FLOW http://wiki.civicrm.org/confluence/display/CRM/CiviAccounts+4.3+Data+Flow