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

Mappings from search builder saved with mapping_type_id = NULL

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.10
    • Fix Version/s: 4.7.14
    • Component/s: None
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      Using the search builder to create a dedicated smart group (or hidden for mailings) creates a mapping and the assiciated mapping fields.
      Since the mapping_type_id is NULL it shows up as a deletable empty row in http://dmaster.demo.civicrm.org/civicrm/admin/mapping?reset=1
      Deleting it results in a non-working smart group without the ability to modify the mapping fields for the group due to a DB Error:

      [info] $Fatal Error Details = Array
      (
      [callback] => Array
      (
      [0] => CRM_Core_Error
      [1] => handle
      )

      [code] => -3
      [message] => DB Error: constraint violation
      [mode] => 16
      [debug_info] => INSERT INTO civicrm_mapping_field (mapping_id , name , contact_type , column_number , grouping , operator , value ) VALUES ( 53 , 'group' , 'Contact' , 0 , 1 , '=' , '229' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civicrm`.`civicrm_mapping_field`, CONSTRAINT `FK_civicrm_mapping_field_mapping_id` FOREIGN KEY (`mapping_id`) REFERENCES `civicrm_mapping` (`id`))]
      [type] => DB_Error
      [user_info] => INSERT INTO civicrm_mapping_field (mapping_id , name , contact_type , column_number , grouping , operator , value ) VALUES ( 53 , 'group' , 'Contact' , 0 , 1 , '=' , '229' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civicrm`.`civicrm_mapping_field`, CONSTRAINT `FK_civicrm_mapping_field_mapping_id` FOREIGN KEY (`mapping_id`) REFERENCES `civicrm_mapping` (`id`))]
      [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_mapping_field (mapping_id , name , contact_type , column_number , grouping , operator , value ) VALUES ( 53 , 'group' , 'Contact' , 0 , 1 , '=' , '229' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civicrm`.`civicrm_mapping_field`, CONSTRAINT `FK_civicrm_mapping_field_mapping_id` FOREIGN KEY (`mapping_id`) REFERENCES `civicrm_mapping` (`id`))]"]
      )

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              tschuettler Thomas Schüttler
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: