Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-4601

Integer Radio field with value 0 breaks Advanced Search

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.2.5
    • Fix Version/s: 2.2.6
    • Component/s: CiviCRM Search
    • Labels:
      None

      Description

      See http://forum.civicrm.org/index.php/topic,8368.0.html

      I've replicated the following problem on demo, with the "Checkbox Test" custom group. It also occurred on a client's site running Civi 2.2.5 .

      (1) Create custom group for Contacts with some "Yes or No" fields (Young, Free and Single in my example) and an Integer Radio field with two options, having values 0 and 1 (Liar in my example.). All fields searchable.
      (2) Create some data for the "Yes or No" fields.
      (3) In Advanced Search -> Custom Fields, select Yes for one of the "Yes or No" fields and click Search.
      (4a) Above results, expand Search Criteria.
      => the 0 option for the Integer Radio field is now incorrectly set, in addition to the "Yes or No" field.

      Other manifestations: after (1) to (3) above,

      (4b) Select All X Records, choose Mailing Labels, hit Go, select label, uncheck Do not print..., click Make Mailing Labels.
      => Empty sheet produced, even though search returns results.
      I suspect in this case the Integer Radio field is being included in the query generating the labels.

      (4c) Select All X Records, choose Export Contacts, hit Go, Export PRIMARY fields, Continue.
      => I got a .csv containing all records from the demo db. In our client's example, they got a subset of the desired records, apparently those where the Integer Radio field was 0.
      (5c) On clicking Cancel after completeing the export, on demo I got this warning:
      "warning: Invalid argument supplied for foreach() in /var/www/drupal-6.civicrm.org/public/sites/drupal.demo.civicrm.org/modules/civicrm/CRM/Export/BAO/Export.php on line 195."
      On the client's site, there was no error but the qill showed the Integer Radio field (= 0) in addition to the "Yes or No" field, which is what alerted me to the underlying cause of their export misbehaving.

      Maybe related to CRM-3186 (Member search selects option value=0 for custom field even if it is not the default value) ?

      Dave J

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              davej Dave Jenkins
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: