CRM-9990 Multi-lingual: adding a language is broken in 4.2-trunk

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.0
    • Fix Version/s: 4.2.0
    • Component/s: Internationalisation
    • Labels:
      None

      Description

      In CiviCRM 4.2, when we enable multi-lingual mode, adding a language causes fatal errors.

      To reproduce:

      • enable backtrace/debug
      • enable multi-lingual
      • add another language (ex: French)

      It will then display a fatal error:

      "Database Error Code: 'foo.civicrm_location_type_en_US' is not BASE TABLE, 1347"

      Backtrace:

      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 161
      , handle,
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 931
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/DB.php, PEAR_Error, 968
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/PEAR.php, DB_Error, 564
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/DB/common.php, raiseError, 1903
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/DB/mysql.php, raiseError, 898
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/DB/mysql.php, mysqlRaiseError, 327
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/DB/common.php, simpleQuery, 1216
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/DB/DataObject.php, query, 2428
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/DB/DataObject.php, _query, 1614
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 162
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/DAO.php, query, 900
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/DAO.php, executeQuery, 1545
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/DAO.php, createTriggers, 1439
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/I18n/Schema.php, triggerRebuild, 252
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Admin/Form/Setting/Localization.php, addLocale, 275
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/Form.php, postProcess, 246
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/StateMachine.php, mainProcess, 162
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Next.php, perform, 63
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 203
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 103
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 279
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Utils/Wrapper.php, run, 115
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 193
      /var/aegir/platforms/civicrm-4.2-trunk/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 477
      , civicrm_invoke,
      /var/aegir/platforms/civicrm-4.2-trunk/includes/menu.inc, call_user_func_array, 517
      /var/aegir/platforms/civicrm-4.2-trunk/index.php, menu_execute_active_handler, 21

      There are also warnings that may be related:

      Warning: substr() expects parameter 1 to be string, array given in CRM_Core_DAO::createTriggers() (line 1480 of civicrm/CRM/Core/DAO.php).
      Warning: trim() expects parameter 1 to be string, array given in CRM_Core_DAO::createTriggers() (line 1500 of civicrm/CRM/Core/DAO.php).
      Notice: Undefined index: variables in CRM_Core_DAO::createTriggers() (line 1504 of civicrm/CRM/Core/DAO.php).

        Attachments

          Activity

          [CRM-9990] Multi-lingual: adding a language is broken in 4.2-trunk
          Mathieu Lutfy added a comment -

          The $triggers created in the function createTriggers() looks like this (i.e. mostly empty):

          Array (
          [civicrm_location_type] => Array (
          [update] => Array (
          [before] => Array (
          [variables] => Array ()
          [sql] => Array ( [0] => )
          )
          )
          [insert] => Array (
          [before] => Array (
          [variables] => Array ()
          [sql] => Array ( [0] => )
          )
          )
          )
          [...]

          I wrote a small patch to temporarily solve the issue, but it might be necessary to fix it higher up in the code.

          Mathieu Lutfy added a comment -

          Related to CRM-9716 ?

          Note that my patch does not work well, because when I go to CiviEvent, it gives me the following SQL query:

          SELECT id, label
          FROM civicrm_participant_status_type
          WHERE ( is_counted = 1 ) AND ( civicrm_participant_status_type.is_active = 1 )
          ORDER BY weight;

          It causes an error because the query should be against "civicrm_participant_status_type_fr_CA" or the field "label_fr_CA"

          Donald A. Lobo added a comment -

          I fixed this issue. BGM: can u please update and test

          However i'm getting an issue with currency option group which i'll try to fix now. I commented out that code to fix this issue, but reverted that change

          Mathieu Lutfy added a comment -

          Tested with latest 4.2 trunk and seems to be working fine.

          I added another language and created an event which I then translated.

            People

            • Assignee:
              Donald A. Lobo
              Reporter:
              Mathieu Lutfy

              Dates

              • Created:
                Updated:
                Resolved: