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

Settings cannot be overriden when $name not specified in getItem() call

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.6
    • Fix Version/s: 4.6
    • Component/s: Core CiviCRM
    • Labels:
    • Documentation Required?:
      None

      Description

      In CRM_Core_BAO_Setting::getItem(), the second parameter, $name, is optional. When not present, and array containing all settings for the given $group is returned.

      And in this case, the settings override through the $civicrm_setting variable does not work - see CRM_Core_BAO_Setting::getOverride:
      if ($group && $name && isset($civicrm_setting[$group][$name]))

      There is some extra code dealing with this at the bottom of the getItem() function, but it presupposes that the setting already exists in the database - which is certainly not the case for non-core items - mostly extensions.

      When no $name is present, the getItem() function should return an array consisting of the sum of all override settings + all settings present in the database for the given $group (with the overrides taking precedence, and applying even if the setting is not defined in the database).

        Attachments

          Activity

            People

            • Assignee:
              atif.shaikh Atif Shaikh
              Reporter:
              nganivet Nicolas Ganivet
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: