CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Error on adding contribution: 'Bank/Building Society is a required field'
Pages: [1]

Author Topic: Error on adding contribution: 'Bank/Building Society is a required field'  (Read 651 times)

tog22

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: CiviCRM 4
  • CMS version: Drupal 7
  • MySQL version: Varies
  • PHP version: Varies
Error on adding contribution: 'Bank/Building Society is a required field'
June 20, 2012, 04:02:39 am
When I try to add a contribution (with 'Contribution Type' as 'Donation' and 'Paid By' as 'Cash' or 'Check'), I get the following error messages:

Quote
Please correct the following errors in the form fields below:
Bank/Building Society is a required field.
Name(s) of account holder(s) is a required field.
Bank/Building Society account number is a required field.
Sort Code is a required field.

There are no such fields on the form (at /civicrm/contact/view/contribution ), which makes sense as they're not needed for 'Cash' or 'Check' donations.

I've tested this on demo.civicrm.org and the same problem doesn't occur. In fact I could have sworn it didn't use to occur on our install...

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Error on adding contribution: 'Bank/Building Society is a required field'
June 20, 2012, 04:14:12 am
Quote
Bank/Building Society is a required field.
Name(s) of account holder(s) is a required field.
Bank/Building Society account number is a required field.
Sort Code is a required field.

Is this your custom data? If yes then someone might have made it required, hence you are getting above validations.

Kurund
Found this reply helpful? Support CiviCRM

tog22

  • I’m new here
  • *
  • Posts: 20
  • Karma: 0
  • CiviCRM version: CiviCRM 4
  • CMS version: Drupal 7
  • MySQL version: Varies
  • PHP version: Varies
Re: Error on adding contribution: 'Bank/Building Society is a required field'
June 27, 2012, 08:53:56 am
These are fields which are added by civicrm_direct_debit.module (see http://civicrm.org/blogs/paul/civicrm-direct-debit-integration-uk ). However, they are not and should not be added to new contribution forms, but only to new membership forms, where I can indeed see them.

Even more mysteriously, I tried to track down the error with the following results:

1) Searched for a string from the error, 'equired fie', getting the results below:

Quote
cd drupalroot/sites/all/modules/civicrm_direct_debit]
grep -nr 'equired fie' .
./CRM/Contribute/Form/Contribution/Main.php:529:                    $this->addRule( 'amount', ts('%1 is a required field.', array(1 => ts('Amount'))), 'required' );
./CRM/Contribute/Form/Contribution/Main.php:538:                    $this->addRule( 'amount_other', ts('%1 is a required field.', array(1 => $title)), 'required' );
./CRM/Contribute/Form/Contribution/Main.php:553:                    $this->addRule( 'amount', ts('%1 is a required field.', array(1 => ts('Amount'))), 'required' );
./CRM/Contribute/Form/Contribution/Main.php:895:                    $errors['amount_other'] = ts('Amount is required field.');
./CRM/Contribute/Form/Contribution/Main.php:942:                        $errors['pledge_installments'] = ts( 'Pledge Installments is required field.' );
./CRM/Contribute/Form/Contribution/Main.php:955:                        $errors['pledge_frequency_interval'] = ts( 'Pledge Frequency Interval. is required field.' );
./CRM/Contribute/Form/Contribution/Main.php:978:               # $errors[$name] = ts( '%1 is a required field.', array( 1 => $fld['title'] ) );
./CRM/Contribute/Form/Contribution/Main.php:1004:                    $errors[$customizedGreeting] = ts( 'Custom %1 is a required field if %1 is of type Customized.',
./CRM/Contribute/Form/Contribution/Main.php~:529:                    $this->addRule( 'amount', ts('%1 is a required field.', array(1 => ts('Amount'))), 'required' );
./CRM/Contribute/Form/Contribution/Main.php~:538:                    $this->addRule( 'amount_other', ts('%1 is a required field.', array(1 => $title)), 'required' );
./CRM/Contribute/Form/Contribution/Main.php~:553:                    $this->addRule( 'amount', ts('%1 is a required field.', array(1 => ts('Amount'))), 'required' );
./CRM/Contribute/Form/Contribution/Main.php~:895:                    $errors['amount_other'] = ts('Amount is required field.');
./CRM/Contribute/Form/Contribution/Main.php~:942:                        $errors['pledge_installments'] = ts( 'Pledge Installments is required field.' );
./CRM/Contribute/Form/Contribution/Main.php~:955:                        $errors['pledge_frequency_interval'] = ts( 'Pledge Frequency Interval. is required field.' );
./CRM/Contribute/Form/Contribution/Main.php~:978:                $errors[$name] = ts( '%1 is a required field.', array( 1 => $fld['title'] ) );
./CRM/Contribute/Form/Contribution/Main.php~:1004:                    $errors[$customizedGreeting] = ts( 'Custom %1 is a required field if %1 is of type Customized.',
./civicrm_direct_debit.module:212:                $errors['sort_code_part_1'] = 'Sort Code is a required field.';
./civicrm_direct_debit.module:213:                $form->assign('SortCodeError' , 'Sort Code is a required field.');
./civicrm_direct_debit.module~:212:                $errors['sort_code_part_1'] = 'Sort Code is a required field.';
./civicrm_direct_debit.module~:213:                $form->assign('SortCodeError' , 'Sort Code is a required field.');
./civicrm_direct_debit.module.orig:212:                $errors['sort_code_part_1'] = 'Sort Code is a required field.';
./civicrm_direct_debit.module.orig:213:                $form->assign('SortCodeError' , 'Sort Code is a required field.');


2) Added lines to all these places to log if they were executed
3) Saw from my log that only ./civicrm_direct_debit.module.orig:212 got executed
4) Commented out the contents on the function containing that line and still got the error 'Bank/Building Society is a required field' as described in my OP.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Error on adding contribution: 'Bank/Building Society is a required field'
June 27, 2012, 12:03:18 pm

i suspect the direct_debit module has a bug and/or your use case is a wee bit different for what it was built.

Most likely the required field error is coming from the base class: CRM/Core/Form.php

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Error on adding contribution: 'Bank/Building Society is a required field'

This forum was archived on 2017-11-26.