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

CRM_Utils_Migrate_* handles created_date badly

    Details

    • Type: Bug
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 4.7.12
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      <?xml version="1.0" encoding="iso-8859-1" ?>

      <CustomData>
      <CustomGroups>
      <CustomGroup>
      <name>Voter_Information</name>
      <title>Voter Information</title>
      <extends>Individual</extends>
      <extends_entity_column_value_option_group>contact_type</extends_entity_column_value_option_group>
      <extends_entity_column_value>Student</extends_entity_column_value>
      <style>Inline</style>
      <collapse_display>1</collapse_display>
      <help_pre></help_pre>
      <help_post></help_post>
      <weight>9</weight>
      <is_active>1</is_active>
      <table_name>civicrm_value_voter_information_11</table_name>
      <is_multiple>0</is_multiple>
      <collapse_adv_display>0</collapse_adv_display>
      <created_date>2015-12-21 22:18:44</created_date>
      <is_reserved>0</is_reserved>
      <!-- etc -->

      When the above custom xml generated by the civix custom-xml command is attempted to install, the following error is found.

      Removing created_date from the custom group results in it installing as expected.

      Dec 22 17:48:08 [info] $Fatal Error Details = Array
      (
      [callback] => Array
      (
      [0] => CRM_Core_Error
      [1] => handle
      )

      [code] => -1
      [message] => DB Error: unknown error
      [mode] => 16
      [debug_info] => INSERT INTO civicrm_custom_group (name , title , extends , extends_entity_column_value , style , collapse_display , help_pre , help_post , weight , is_active , table_name , is_multiple , collapse_adv_display , created_date , is_reserved ) VALUES ('Supporting_Information' , 'Supporting Information' , 'Activity' , 'Submit Application Form' , 'Inline' , 1 , '' , '' , 14 , 1 , 'civicrm_value_supporting_information_16' , 0 , 0 , 2015 , 0 ) [nativecode=1292 ** Incorrect datetime value: '2015' for column 'created_date' at row 1]
      [type] => DB_Error
      [user_info] => INSERT INTO civicrm_custom_group (name , title , extends , extends_entity_column_value , style , collapse_display , help_pre , help_post , weight , is_active , table_name , is_multiple , collapse_adv_display , created_date , is_reserved ) VALUES ('Supporting_Information' , 'Supporting Information' , 'Activity' , 'Submit Application Form' , 'Inline' , 1 , '' , '' , 14 , 1 , 'civicrm_value_supporting_information_16' , 0 , 0 , 2015 , 0 ) [nativecode=1292 ** Incorrect datetime value: '2015' for column 'created_date' at row 1]
      [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_custom_group (name , title , extends , extends_entity_column_value , style , collapse_display , help_pre , help_post , weight , is_active , table_name , is_multiple , collapse_adv_display , created_date , is_reserved ) VALUES ('Supporting_Information' , 'Supporting Information' , 'Activity' , 'Submit Application Form' , 'Inline' , 1 , '' , '' , 14 , 1 , 'civicrm_value_supporting_information_16' , 0 , 0 , 2015 , 0 ) [nativecode=1292 ** Incorrect datetime value: '2015' for column 'created_date' at row 1]"]
      )

      Dec 22 17:48:08 [info] $backTrace = #0 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/Error.php(235): CRM_Core_Error::backtrace("backTrace", TRUE)
      #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
      #2 /var/www/html/megat/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
      #3 /var/www/html/megat/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: unknown error", -1, 16, (Array:2), "INSERT INTO civicrm_custom_group (name , title , extends , extends_entity_col...")
      #4 /var/www/html/megat/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-1, 16, (Array:2), "INSERT INTO civicrm_custom_group (name , title , extends , extends_entity_col...")
      #5 /var/www/html/megat/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "INSERT INTO civicrm_custom_group (name , title , extends , extends_entity_col...", "DB_Error", TRUE)
      #6 /var/www/html/megat/sites/all/modules/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-1, NULL, NULL, NULL, "1292 ** Incorrect datetime value: '2015' for column 'created_date' at row 1")
      #7 /var/www/html/megat/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
      #8 /var/www/html/megat/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO civicrm_custom_group (name , title , extends , extends_entity_col...")
      #9 /var/www/html/megat/sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB_common->query("INSERT INTO civicrm_custom_group (name , title , extends , extends_entity_col...")
      #10 /var/www/html/megat/sites/all/modules/civicrm/packages/DB/DataObject.php(1060): DB_DataObject->_query("INSERT INTO civicrm_custom_group (name , title , extends , extends_entity_col...")
      #11 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/DAO.php(450): DB_DataObject->insert()
      #12 /var/www/html/megat/sites/all/modules/civicrm/CRM/Utils/Migrate/Import.php(132): CRM_Core_DAO->save()
      #13 /var/www/html/megat/sites/all/modules/civicrm/CRM/Utils/Migrate/Import.php(209): CRM_Utils_Migrate_Import->copyData(Object(CRM_Core_DAO_CustomGroup), Object(SimpleXMLElement), TRUE, "name")
      #14 /var/www/html/megat/sites/all/modules/civicrm/CRM/Utils/Migrate/Import.php(80): CRM_Utils_Migrate_Import->customGroups(Object(SimpleXMLElement), (Array:2))
      #15 /var/www/html/megat/sites/all/modules/civicrm/CRM/Utils/Migrate/Import.php(57): CRM_Utils_Migrate_Import->runXmlElement(Object(SimpleXMLElement))
      #16 /var/www/html/megat/sites/default/ext/org.skillquestntx.civicoreconfig/CRM/Civicoreconfig/Upgrader/Base.php(96): CRM_Utils_Migrate_Import->run("/var/www/html/megat/sites/default/ext/org.skillquestntx.civicoreconfig/xml/Ap...")
      #17 /var/www/html/megat/sites/default/ext/org.skillquestntx.civicoreconfig/CRM/Civicoreconfig/Upgrader/Base.php(253): CRM_Civicoreconfig_Upgrader_Base::executeCustomDataFileByAbsPath("/var/www/html/megat/sites/default/ext/org.skillquestntx.civicoreconfig/xml/Ap...")
      #18 /var/www/html/megat/sites/default/ext/org.skillquestntx.civicoreconfig/civicoreconfig.civix.php(54): CRM_Civicoreconfig_Upgrader_Base->onInstall()
      #19 /var/www/html/megat/sites/default/ext/org.skillquestntx.civicoreconfig/civicoreconfig.php(36): _civicoreconfig_civix_civicrm_install()
      #20 /var/www/html/megat/sites/all/modules/civicrm/CRM/Extension/Manager/Module.php(78): civicoreconfig_civicrm_install()
      #21 /var/www/html/megat/sites/all/modules/civicrm/CRM/Extension/Manager/Module.php(50): CRM_Extension_Manager_Module->callHook(Object(CRM_Extension_Info), "install")
      #22 /var/www/html/megat/sites/all/modules/civicrm/CRM/Extension/Manager.php(233): CRM_Extension_Manager_Module->onPreInstall(Object(CRM_Extension_Info))
      #23 /var/www/html/megat/sites/all/modules/civicrm/CRM/Admin/Form/Extensions.php(195): CRM_Extension_Manager->install((Array:1))
      #24 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/Form.php(345): CRM_Admin_Form_Extensions->postProcess()
      #25 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/StateMachine.php(164): CRM_Core_Form->mainProcess()
      #26 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Admin_Form_Extensions), "next", "Next")
      #27 /var/www/html/megat/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Admin_Form_Extensions), "next")
      #28 /var/www/html/megat/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Admin_Form_Extensions), "next")
      #29 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("next")
      #30 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/Page/Basic.php(395): CRM_Core_Controller->run()
      #31 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/Page/Basic.php(174): CRM_Core_Page_Basic->edit(1, NULL)
      #32 /var/www/html/megat/sites/all/modules/civicrm/CRM/Admin/Page/Extensions.php(125): CRM_Core_Page_Basic->run()
      #33 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/Invoke.php(312): CRM_Admin_Page_Extensions->run((Array:3), NULL)
      #34 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
      #35 /var/www/html/megat/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
      #36 /var/www/html/megat/sites/all/modules/civicrm/drupal/civicrm.module(489): CRM_Core_Invoke::invoke((Array:3))
      #37 [internal function](): civicrm_invoke("admin", "extensions")
      #38 /var/www/html/megat/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2))
      #39 /var/www/html/megat/index.php(21): menu_execute_active_handler()
      #40

      {main}

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              johnff John Kirk
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: