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

On export participants, fatal error if shared address belongs to contact with very long name

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.3.0
    • Fix Version/s: 4.3.0
    • Component/s: CiviEvent
    • Labels:

      Description

      (I'm not aware if this issue exists in 4.2; haven't tried it on the demo site.)

      Steps to reproduce:
      1. Create a new organization contact with a display name longer than 16 characters, and with a mailing address.
      2. Create a new individual contact, and have this individual share the address belonging to the organization contact.
      3. Create an event registration for the individual.
      4. Perform a "Find participants" search such that the results include the individual.
      5. Export Participants, including the individual contact. Choose the "Export PRIMARY fields" option.
      6. Click "export" and observe fatal error.

      The database error is "Data too long for column 'master_id' at row 1".

      A quick inspection reveals that in the process of populating the temporary table that drives the exported CSV, the longer-than-16-characters name of the organization contact is being given as the value for the "master_id" column, which has a maximum length of 16 characters.

      I believe this is due to the use of the display name in place of address ID for addresses which are shared. This appears to be happening around line 656-673 of CRM/Export/BAO/Export.php.

      CiviCRM backtrace output:
      #0 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Core/Error.php(148): CRM_Core_Error::backtrace()
      #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
      #2 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
      #3 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/DB.php(972): PEAR_Error->PEAR_Error("DB Error: a515ac9c2796ca0e23adbe92c68fc9fc", "a515ac9c2796ca0e23adbe92c68fc9fc", 16, (Array:2), "\nINSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civic...")
      #4 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/PEAR.php(564): DB_Error->DB_Error("a515ac9c2796ca0e23adbe92c68fc9fc", 16, (Array:2), "\nINSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civic...")
      #5 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, "a515ac9c2796ca0e23adbe92c68fc9fc", NULL, NULL, "\nINSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civic...", "DB_Error", TRUE)
      #6 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/DB/mysql.php(898): DB_common->raiseError("a515ac9c2796ca0e23adbe92c68fc9fc", NULL, NULL, NULL, "1406 ** Data too long for column 'master_id' at row 1")
      #7 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError()
      #8 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("\nINSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civic...")
      #9 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/DB/DataObject.php(2421): DB_common->query("\nINSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civic...")
      #10 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/DB/DataObject.php(1613): DB_DataObject->_query("\nINSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civic...")
      #11 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Core/DAO.php(155): DB_DataObject->query("\nINSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civic...")
      #12 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Core/DAO.php(917): CRM_Core_DAO->query("\nINSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civic...", TRUE)
      #13 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Export/BAO/Export.php(1309): CRM_Core_DAO::executeQuery("\nINSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civic...")
      #14 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Export/BAO/Export.php(1002): CRM_Export_BAO_Export::writeDetailsToTable("civicrm_export_temp_e095759a5de23e5357edd54814d5ad96", (Array:1), (Array:98))
      #15 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Export/Form/Select.php(389): CRM_Export_BAO_Export::exportComponents(FALSE, (Array:1), (Array:3), "participant_register_date desc", NULL, NULL, 4, " civicrm_participant.id IN ( 52 ) ", NULL, 0, 0, (Array:2), NULL)
      #16 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Core/Form.php(246): CRM_Export_Form_Select->postProcess()
      #17 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess()
      #18 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Core/QuickForm/Action/Next.php(60): CRM_Core_StateMachine->perform(Object(CRM_Export_Form_Select), "next", "Next")
      #19 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Export_Form_Select), "next")
      #20 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Export_Form_Select), "next")
      #21 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Core/Controller.php(316): HTML_QuickForm_Page->handle("next")
      #22 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Core/Invoke.php(292): CRM_Core_Controller->run((Array:3), NULL)
      #23 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Core/Invoke.php(70): CRM_Core_Invoke::runItem((Array:14))
      #24 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
      #25 /var/www/domains/devel/civicrm_versions/civicrm-trunk-4.3/civicrm/drupal.d6/civicrm.module(382): CRM_Core_Invoke::invoke((Array:3))
      #26 [internal function](): civicrm_invoke("event", "search")
      #27 /var/www/domains/devel/www/d6/includes/menu.inc(350): call_user_func_array("civicrm_invoke", (Array:2))
      #28 /var/www/domains/devel/www/d6/index.php(17): menu_execute_active_handler()
      #29

      {main}

      MySQL error details:
      Database Error Code: Data too long for column 'master_id' at row 1, 1406
      Additional Details:
      Array
      (
      [callback] => Array
      (
      [0] => CRM_Core_Error
      [1] => handle
      )

      [code] => a515ac9c2796ca0e23adbe92c68fc9fc
      [message] => DB Error: a515ac9c2796ca0e23adbe92c68fc9fc
      [mode] => 16
      [debug_info] =>
      INSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civicrm_primary_id,contact_type,contact_sub_type,do_not_email,do_not_phone,do_not_mail,do_not_sms,do_not_trade,is_opt_out,legal_identifier,external_identifier,sort_name,display_name,nick_name,legal_name,image_url,preferred_communication_method,preferred_language,preferred_mail_format,hash,contact_source,first_name,middle_name,last_name,job_title,birth_date,is_deceased,deceased_date,household_name,organization_name,sic_code,user_unique_id,current_employer_id,contact_is_deleted,addressee,email_greeting,postal_greeting,gender,individual_prefix,individual_suffix,current_employer,location_type,street_address,street_number,street_number_suffix,street_name,street_unit,supplemental_address_1,supplemental_address_2,city,postal_code_suffix,postal_code,geo_code_1,geo_code_2,address_name,master_id,county,state_province,country,phone,phone_ext,email,on_hold,is_bulkmail,signature_text,signature_html,im_provider,im,openid,world_region,url,phone_type_id,provider_id,event_id,event_title,event_start_date,event_end_date,event_type,participant_id,participant_status,participant_role_id,participant_note,participant_register_date,participant_source,participant_fee_level,participant_is_test,participant_is_pay_later,participant_fee_amount,participant_discount_name,participant_fee_currency,participant_registered_by_id,participant_campaign_id,participant_campaign,total_amount,contribution_status,received_date,payment_instrument,transaction_id)
      VALUES (1,'202','Individual','','','','','','','','','','tester, test','test tester','','','','','en_US','Both','52f8bc84c17accc9dbecd79fd0a83865','','test','','tester','','','','','','','','','203','','test tester','Dear test','Dear test','','','','test employer with really really long name','Home','123 w main','','','','','','','anywhere','','88888','','','','test employer with really really long name','','AL','United States','','','','','','','','','','','America South, Central, North and Caribbean','','','','1','Fall Fundraiser Dinner','2013-09-11 17:00:00','2013-09-13 17:00:00','Fundraiser','52','Registered','Attendee','','2013-03-12 01:09:00','','Single','','','50.00','','USD','','','','50.00','Completed','2013-03-12 00:00:00','','')
      [nativecode=1406 ** Data too long for column 'master_id' at row 1]
      [type] => DB_Error
      [user_info] =>
      INSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civicrm_primary_id,contact_type,contact_sub_type,do_not_email,do_not_phone,do_not_mail,do_not_sms,do_not_trade,is_opt_out,legal_identifier,external_identifier,sort_name,display_name,nick_name,legal_name,image_url,preferred_communication_method,preferred_language,preferred_mail_format,hash,contact_source,first_name,middle_name,last_name,job_title,birth_date,is_deceased,deceased_date,household_name,organization_name,sic_code,user_unique_id,current_employer_id,contact_is_deleted,addressee,email_greeting,postal_greeting,gender,individual_prefix,individual_suffix,current_employer,location_type,street_address,street_number,street_number_suffix,street_name,street_unit,supplemental_address_1,supplemental_address_2,city,postal_code_suffix,postal_code,geo_code_1,geo_code_2,address_name,master_id,county,state_province,country,phone,phone_ext,email,on_hold,is_bulkmail,signature_text,signature_html,im_provider,im,openid,world_region,url,phone_type_id,provider_id,event_id,event_title,event_start_date,event_end_date,event_type,participant_id,participant_status,participant_role_id,participant_note,participant_register_date,participant_source,participant_fee_level,participant_is_test,participant_is_pay_later,participant_fee_amount,participant_discount_name,participant_fee_currency,participant_registered_by_id,participant_campaign_id,participant_campaign,total_amount,contribution_status,received_date,payment_instrument,transaction_id)
      VALUES (1,'202','Individual','','','','','','','','','','tester, test','test tester','','','','','en_US','Both','52f8bc84c17accc9dbecd79fd0a83865','','test','','tester','','','','','','','','','203','','test tester','Dear test','Dear test','','','','test employer with really really long name','Home','123 w main','','','','','','','anywhere','','88888','','','','test employer with really really long name','','AL','United States','','','','','','','','','','','America South, Central, North and Caribbean','','','','1','Fall Fundraiser Dinner','2013-09-11 17:00:00','2013-09-13 17:00:00','Fundraiser','52','Registered','Attendee','','2013-03-12 01:09:00','','Single','','','50.00','','USD','','','','50.00','Completed','2013-03-12 00:00:00','','')
      [nativecode=1406 ** Data too long for column 'master_id' at row 1]
      [to_string] => [db_error: message="DB Error: a515ac9c2796ca0e23adbe92c68fc9fc" code=0 mode=callback callback=CRM_Core_Error::handle prefix="" info="
      INSERT INTO civicrm_export_temp_e095759a5de23e5357edd54814d5ad96 (id, civicrm_primary_id,contact_type,contact_sub_type,do_not_email,do_not_phone,do_not_mail,do_not_sms,do_not_trade,is_opt_out,legal_identifier,external_identifier,sort_name,display_name,nick_name,legal_name,image_url,preferred_communication_method,preferred_language,preferred_mail_format,hash,contact_source,first_name,middle_name,last_name,job_title,birth_date,is_deceased,deceased_date,household_name,organization_name,sic_code,user_unique_id,current_employer_id,contact_is_deleted,addressee,email_greeting,postal_greeting,gender,individual_prefix,individual_suffix,current_employer,location_type,street_address,street_number,street_number_suffix,street_name,street_unit,supplemental_address_1,supplemental_address_2,city,postal_code_suffix,postal_code,geo_code_1,geo_code_2,address_name,master_id,county,state_province,country,phone,phone_ext,email,on_hold,is_bulkmail,signature_text,signature_html,im_provider,im,openid,world_region,url,phone_type_id,provider_id,event_id,event_title,event_start_date,event_end_date,event_type,participant_id,participant_status,participant_role_id,participant_note,participant_register_date,participant_source,participant_fee_level,participant_is_test,participant_is_pay_later,participant_fee_amount,participant_discount_name,participant_fee_currency,participant_registered_by_id,participant_campaign_id,participant_campaign,total_amount,contribution_status,received_date,payment_instrument,transaction_id)
      VALUES (1,'202','Individual','','','','','','','','','','tester, test','test tester','','','','','en_US','Both','52f8bc84c17accc9dbecd79fd0a83865','','test','','tester','','','','','','','','','203','','test tester','Dear test','Dear test','','','','test employer with really really long name','Home','123 w main','','','','','','','anywhere','','88888','','','','test employer with really really long name','','AL','United States','','','','','','','','','','','America South, Central, North and Caribbean','','','','1','Fall Fundraiser Dinner','2013-09-11 17:00:00','2013-09-13 17:00:00','Fundraiser','52','Registered','Attendee','','2013-03-12 01:09:00','','Single','','','50.00','','USD','','','','50.00','Completed','2013-03-12 00:00:00','','')
      [nativecode=1406 ** Data too long for column 'master_id' at row 1]"]
      )

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              allenshaw Allen Shaw
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: