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 Profiles (Moderator: Dave Greenberg) »
  • 'Undefined index' error message on membership profile page
Pages: [1]

Author Topic: 'Undefined index' error message on membership profile page  (Read 773 times)

JAL

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.4.0
  • CMS version: Drupal 7
  • MySQL version: 5.5.34-cll
  • PHP version: 5.4.23
'Undefined index' error message on membership profile page
February 11, 2014, 03:35:59 pm
Hi
I've just set up a new installation of CiviCRM, and created the first contribution page, a membership form. In the initial configuration I removed 'state_province' from the address fields, and used 'county' instead. On setting up the profile form, 'county' merely gave a drop-down menu that offered 'select' and nothing else. I then went back to my configuration and put 'state_province' back in, and redid the form with the state_province field added but named as 'County' in the profile. The membership page now looks great, and because I've set the default country as the UK, the 'county' field now offers all the counties of the UK. So far so good. I then tested the form online by filling in the first member, myself, and everything worked, I got sent to the correct payment processor, my membership profile shows up when I search for it. However, on returning to the membership page it now flags up the error message:
Notice: Undefined index: state_province_id in CRM_Core_BAO_UFGroup::setProfileDefaults() (line 2364 of .../drupal/sites/all/modules/civicrm/CRM/Core/BAO/UFGroup.php).
What should I do about this please? I'm sure there's a connection between my not setting up 'state_province' to begin with and the field now not working properly, but I'm not technical enough to see what exactly I've mucked up. For the record, the PHP file referenced has at that place:
 // fixed for CRM-665
                if (is_numeric($locTypeId)) {
                  if ($primaryLocationType || $locTypeId == CRM_Utils_Array::value('location_type_id', $value)) {
                    if (CRM_Utils_Array::value($fieldName, $value)) {
                      //to handle stateprovince and country
                      if ($fieldName == 'state_province') {
                        $defaults[$fldName] = $value['state_province_id'];
                      }
                      elseif ($fieldName == 'county') {
                        $defaults[$fldName] = $value['county_id'];
                      }
                      elseif ($fieldName == 'country') {
                        $defaults[$fldName] = $value['country_id'];
                        if (!isset($value['country_id']) || !$value['country_id']) {
                          $config = CRM_Core_Config::singleton();
                          if ($config->defaultContactCountry) {
                            $defaults[$fldName] = $config->defaultContactCountry;
                          }
                        }
                      }
Should the field name for state_province be 'county' in the PHP code? That's just a guess...
Thanks
JAL

pkeogan

  • I post frequently
  • ***
  • Posts: 130
  • Karma: 4
    • BackOffice Thinking
Re: 'Undefined index' error message on membership profile page
February 19, 2014, 07:59:54 pm
When you say "In the initial configuration I removed 'state_province' from the address fields, and used 'county' instead."  where did you do this in the profile?

I am not sure I am following you, but do you know that the civi-county table there is a reference (foreign key) to the state_province table? if you somehow managed to get data into the county field and that county field can't reference a state-province I would expect you get an error.

if you have access to the database, I'd check there.  I really don't think you should be able to do that... but if you did it may be bug.

JAL

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 4.4.0
  • CMS version: Drupal 7
  • MySQL version: 5.5.34-cll
  • PHP version: 5.4.23
Re: 'Undefined index' error message on membership profile page
February 19, 2014, 09:27:19 pm
Thanks for your reply
Just tonight I've found that (it seems) I'd made a trivial beginner's error. When defining address fields it says 'Use {contact.state_province} for state/province abbreviation or {contact.state_province_name} for state province name.' I had put state_province not state_province_name in the field, then tried to write state/province names to the database. I changed the field definition and the error message has gone. So I think that's solved it... but I'll be back on this thread if it hasn't!
JAL

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • 'Undefined index' error message on membership profile page

This forum was archived on 2017-11-26.