diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index b12a481c65878ebef867dab7974aba1e56404a75..94115311a59145aaa9e334568f0d3cd547f924aa 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -364,12 +364,15 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { CRM_Utils_Address_USPS::checkAddress($params); // do street parsing again if enabled, since street address might have changed - $parseStreetAddress = CRM_Utils_Array::value('street_address_parsing', - CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'address_options' - ), - FALSE - ); + $parseStreetAddress = + CRM_Utils_Array::value( + 'street_address_parsing', + CRM_Core_BAO_Setting::valueOptions( + CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + 'address_options' + ), + FALSE + ); if ($parseStreetAddress && !empty($params['street_address'])) { foreach (array( @@ -875,9 +878,11 @@ ORDER BY civicrm_address.is_primary DESC, civicrm_address.location_type_id DESC, static function validateAddressOptions($fields) { static $addressOptions = NULL; if (!$addressOptions) { - $addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'address_options', TRUE, NULL, TRUE - ); + $addressOptions = + CRM_Core_BAO_Setting::valueOptions( + CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, + 'address_options' + ); } if (is_array($fields) && !empty($fields)) { diff --git a/CRM/Core/Region.php b/CRM/Core/Region.php index 4f03c9e613023ca2fe1ae7f4ca4fafb879d90ee8..bc125a42817a20171cafdd14e14ca75970fd1a82 100644 --- a/CRM/Core/Region.php +++ b/CRM/Core/Region.php @@ -166,7 +166,7 @@ class CRM_Core_Region { $smarty->assign('snippet', $tmp); break; case 'callback': - $args = is_array($snippet['arguments']) ? $snippet['arguments'] : array(&$snippet, &$html); + $args = isset($snippet['arguments']) ? $snippet['arguments'] : array(&$snippet, &$html); $html .= call_user_func_array($snippet['callback'], $args); break; case 'scriptUrl': diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index a86cfab4679ac3ab3cd270c012af86261217032f..5b247f00b0567e1c569a97cfd384d84698c6e1b8 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -202,10 +202,11 @@ class CRM_Core_Resources { $this->settings = $this->mergeSettings($this->settings, $settings); if (!$this->addedSettings) { $resources = $this; - CRM_Core_Region::instance('settings')->add(array( + CRM_Core_Region::instance('html-header')->add(array( 'callback' => function(&$snippet, &$html) use ($resources) { $html .= "\n" . $resources->renderSetting(); - } + }, + 'weight' => -100000, )); $this->addedSettings = TRUE; } @@ -219,7 +220,8 @@ class CRM_Core_Resources { * @return CRM_Core_Resources */ public function addSettingsFactory($callable) { - $this->addSetting(array()); // ensure that 'settings' region is created, even if empty + // Make sure our callback has been registered + $this->addSetting(array()); $this->settingsFactories[] = $callable; return $this; } @@ -260,7 +262,8 @@ class CRM_Core_Resources { * @return string */ public function renderSetting() { - return 'CRM = cj.extend(true, ' . json_encode($this->getSettings()) . ', CRM);'; + $js = 'var CRM = ' . json_encode($this->getSettings()) . ';'; + return sprintf("<script type=\"text/javascript\">\n%s\n</script>\n", $js); } /** @@ -425,7 +428,9 @@ class CRM_Core_Resources { $jsWeight = -9999; foreach ($files as $file => $type) { if ($type == 'js') { - $this->addScriptFile('civicrm', $file, $jsWeight++, $region, FALSE); + // Don't bother looking for ts() calls in packages, there aren't any + $translate = (substr($file, 0, 9) != 'packages/'); + $this->addScriptFile('civicrm', $file, $jsWeight++, $region, $translate); } elseif ($type == 'css') { $this->addStyleFile('civicrm', $file, -100, $region); @@ -443,6 +448,18 @@ class CRM_Core_Resources { } } + // Initialize CRM.url + $url = CRM_Utils_System::url('civicrm/example', 'placeholder', FALSE, NULL, FALSE); + $js = "CRM.url('init', '$url');"; + $this->addScript($js, $jsWeight++, $region); + + // Add global settings + $settings = array( + 'userFramework' => json_encode($config->userFramework), + 'resourceBase' => json_encode($config->resourceBase), + ); + $this->addSetting(array('config' => $settings)); + // Give control of jQuery back to the CMS - this loads last $this->addScriptFile('civicrm', 'js/noconflict.js', 9999, $region, FALSE); diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php index 7703f7a4bbbbcf09c73b9c155bdbffb7de044a33..de98f711e7b77dab1aa0a16a1013afb1b26ad759 100644 --- a/CRM/Event/Form/ManageEvent/Registration.php +++ b/CRM/Event/Form/ManageEvent/Registration.php @@ -529,37 +529,41 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent else { $isPreError = FALSE; } - //check for additional custom post profile - $additionalCustomPostId = CRM_Utils_Array::value('additional_custom_post_id', $values); - if (!empty($additionalCustomPostId)) { - if (!($additionalCustomPostId == 'none')) { - $customPostId = $additionalCustomPostId; + + // We don't have required Individual fields in the pre-custom profile, so now check the post-custom profile + if ($isPreError) { + $additionalCustomPostId = CRM_Utils_Array::value('additional_custom_post_id', $values); + if (!empty($additionalCustomPostId)) { + if (!($additionalCustomPostId == 'none')) { + $customPostId = $additionalCustomPostId; + } + else { + $isPostError = FALSE; + } } else { - $isPostError = FALSE; + $customPostId = CRM_Utils_Array::value('custom_post_id', $values) ? $values['custom_post_id'] : NULL; } - } - else { - $customPostId = CRM_Utils_Array::value('custom_post_id', $values) ? $values['custom_post_id'] : NULL; - } - //check whether the additional custom post profile is of type 'Individual' and its subtypes - if (!empty($customPostId)) { - $profileTypes = CRM_Core_BAO_UFGroup::profileGroups($customPostId); - foreach ($types as $individualTypes) { - if (in_array($individualTypes, $profileTypes)) { - $isPostError = FALSE; - break; + //check whether the additional custom post profile is of type 'Individual' and its subtypes + if (!empty($customPostId)) { + $profileTypes = CRM_Core_BAO_UFGroup::profileGroups($customPostId); + foreach ($types as $individualTypes) { + if (in_array($individualTypes, $profileTypes)) { + $isPostError = FALSE; + break; + } } } - } - else { - $isPostError = FALSE; - } - if ($isPreError || (empty($customPreId) && empty($customPostId))) { - $errorMsg['additional_custom_pre_id'] = ts("Allow multiple registrations from the same email address requires a profile of type 'Individual'"); - } - if ($isPostError) { - $errorMsg['additional_custom_post_id'] = ts("Allow multiple registrations from the same email address requires a profile of type 'Individual'"); + else { + $isPostError = FALSE; + } + + if (empty($customPreId) && empty($customPostId)) { + $errorMsg['additional_custom_pre_id'] = ts("Allow multiple registrations from the same email address requires a profile of type 'Individual'"); + } + if ($isPostError) { + $errorMsg['additional_custom_post_id'] = ts("Allow multiple registrations from the same email address requires a profile of type 'Individual'"); + } } } if (!$isProfileComplete) { diff --git a/CRM/Event/Form/Registration/AdditionalParticipant.php b/CRM/Event/Form/Registration/AdditionalParticipant.php index ed4d73528495b9b52e63cbf617f3ff64f6857911..6dc4850862e304992beb8950e8dea4698ac4f803 100644 --- a/CRM/Event/Form/Registration/AdditionalParticipant.php +++ b/CRM/Event/Form/Registration/AdditionalParticipant.php @@ -440,8 +440,8 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R } else { // check with first_name and last_name for additional participants - if ((CRM_Utils_Array::value('first_name',$value) == $fields['first_name']) && - (CRM_Utils_Array::value('last_name',$value) == $fields['last_name']) + if (!empty($value['first_name']) && ($value['first_name'] == CRM_Utils_Array::value('first_name', $fields)) && + (CRM_Utils_Array::value('last_name',$value) == CRM_Utils_Array::value('last_name', $fields)) ) { $errors['first_name'] = ts('The first name and last name must be unique for each participant.'); break; diff --git a/CRM/Extension/Browser.php b/CRM/Extension/Browser.php index 8458b87e75b5fb577f6ff8da29147dcd793829eb..c8e37223c996e695d59b86a0a9dd360e7850b885 100644 --- a/CRM/Extension/Browser.php +++ b/CRM/Extension/Browser.php @@ -187,7 +187,7 @@ class CRM_Extension_Browser { $files = scandir($cachedPath); foreach ($files as $dc => $fname) { if (substr($fname, -4) == '.xml') { - $result[] = array('key' => trim($fname, '.xml')); + $result[] = array('key' => substr($fname, 0, -4)); } } return $result; @@ -231,7 +231,7 @@ class CRM_Extension_Browser { $extsRaw[] = $out; $key = strip_tags($out[1]); if (substr($key, -4) == '.xml') { - $exts[] = array('key' => trim($key, '.xml')); + $exts[] = array('key' => substr($key, 0, -4)); } } } diff --git a/CRM/UF/Page/Group.php b/CRM/UF/Page/Group.php index 60de77c1de2b775190740875c0a811f3dec83f04..d3515ee31a423129c58e8d8a9538d4a2c93eff0b 100644 --- a/CRM/UF/Page/Group.php +++ b/CRM/UF/Page/Group.php @@ -235,21 +235,18 @@ class CRM_UF_Page_Group extends CRM_Core_Page { } $profile = str_replace('civicrm/admin/uf/group', $urlReplaceWith, $profile); - // FIXME: (CRM-3587) hack to make standalone profile in joomla work - // without administrator login + // FIXME: (CRM-3587) hack to make standalone profile work + // in wordpress and joomla without administrator login if ($config->userFramework == 'Joomla') { $profile = str_replace('/administrator/', '/index.php', $profile); } - else { - if ($config->userFramework == 'WordPress') { - $profile = str_replace('/wp-admin/admin.php', '/index.php', $profile); - } + elseif ($config->userFramework == 'WordPress') { + $profile = str_replace('/wp-admin/admin.php', '/index.php', $profile); } // add jquery files $profile = CRM_Utils_String::addJqueryFiles($profile); - // prevent jquery conflict $this->assign('profile', htmlentities($profile, ENT_NOQUOTES, 'UTF-8')); //get the title of uf group if ($gid) { diff --git a/CRM/Upgrade/Incremental/php/FourThree.php b/CRM/Upgrade/Incremental/php/FourThree.php index b9634bbd23f17033a94850e1a4a85102c03e3456..d03447e1658a498d3b3939008226ced3c9bb0d1a 100644 --- a/CRM/Upgrade/Incremental/php/FourThree.php +++ b/CRM/Upgrade/Incremental/php/FourThree.php @@ -382,14 +382,13 @@ AND ceft.entity_table = 'civicrm_contribution' ); $accountType = key(CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name = 'Asset' ")); - $financialAccountId = - $query = " + $query = " SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = {$accountType} "; - CRM_Core_DAO::singleValueQuery($query); + $financialAccountId = CRM_Core_DAO::singleValueQuery($query); $accountRelationsips = CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL); @@ -444,15 +443,14 @@ AND con.contribution_status_id = {$pendingStatus} //create a temp table to hold financial account id related to payment instruments $tempTableName1 = CRM_Core_DAO::createTempTableName(); - $sql = "CREATE TEMPORARY TABLE {$tempTableName1}"; - CRM_Core_DAO::executeQuery($sql); - - $sql = " + $sql = " +CREATE TEMPORARY TABLE {$tempTableName1} SELECT ceft.financial_account_id financial_account_id, cov.value as instrument_id FROM civicrm_entity_financial_account ceft INNER JOIN civicrm_option_value cov ON cov.id = ceft.entity_id AND ceft.entity_table = 'civicrm_option_value' INNER JOIN civicrm_option_group cog ON cog.id = cov.option_group_id -WHERE cog.name = 'payment_instrument'"; +WHERE cog.name = 'payment_instrument' +"; CRM_Core_DAO::executeQuery($sql); //CRM-12141 @@ -461,10 +459,8 @@ WHERE cog.name = 'payment_instrument'"; //create temp table to process completed / cancelled contribution $tempTableName2 = CRM_Core_DAO::createTempTableName(); - $sql = "CREATE TEMPORARY TABLE {$tempTableName2}"; - CRM_Core_DAO::executeQuery($sql); - $sql = " +CREATE TEMPORARY TABLE {$tempTableName2} SELECT con.id as contribution_id, con.payment_instrument_id, IF(con.currency IN ('{$validCurrencyCodes}'), con.currency, '{$defaultCurrency}') as currency, con.total_amount, con.net_amount, con.fee_amount, con.trxn_id, con.contribution_status_id, @@ -509,7 +505,8 @@ SELECT tempI.contribution_id, tempI.payment_instrument_id, tempI.currency, tem tempI.fee_amount, tempI.trxn_id, tempI.contribution_status_id, tempI.check_number, tempI.to_financial_account_id, tempI.from_financial_account_id, tempI.trxn_date FROM {$tempTableName2} tempI -WHERE tempI.action = 'insert';"; +WHERE tempI.action = 'insert' +"; CRM_Core_DAO::executeQuery($sql); //update of existing records @@ -714,13 +711,6 @@ LEFT JOIN civicrm_email ce ON ce.id = clb.email_id ; ' ; $dao = CRM_Core_DAO::executeQuery($query); while($dao->fetch()) { - $params = array( - 'sort_name' => $dao->name, - 'display_name' => $dao->name, - 'legal_name' => $dao->name, - 'organization_name' => $dao->name, - 'contact_type' => 'Organization' - ); $query = " SELECT cc.id FROM civicrm_contact cc LEFT JOIN civicrm_email ce ON ce.contact_id = cc.id @@ -734,6 +724,13 @@ WHERE cc.contact_type = 'Organization' AND cc.organization_name = %1 $contactID = CRM_Core_DAO::singleValueQuery($query, $params); $context[1] = $dao->name; if (empty($contactID)) { + $params = array( + 'sort_name' => $dao->name, + 'display_name' => $dao->name, + 'legal_name' => $dao->name, + 'organization_name' => $dao->name, + 'contact_type' => 'Organization' + ); $contact = CRM_Contact_BAO_Contact::add($params); $contactID = $contact->id; $context[0] = 'added'; diff --git a/CRM/Utils/System/Joomla.php b/CRM/Utils/System/Joomla.php index d644e1bbbc89d48ba24f5ae95c7c082e23d3557f..518d85f439c79ab9abbd660a86ad82323017fdf6 100644 --- a/CRM/Utils/System/Joomla.php +++ b/CRM/Utils/System/Joomla.php @@ -261,11 +261,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { * @access public */ public function addScriptUrl($url, $region) { - if ($region == 'html-header') { - $document = JFactory::getDocument(); - $document->addScript($url); - return TRUE; - } return FALSE; } @@ -282,11 +277,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { * @access public */ public function addScript($code, $region) { - if ($region == 'html-header') { - $document = JFactory::getDocument(); - $document->addScriptDeclaration($code); - return TRUE; - } return FALSE; } diff --git a/js/Common.js b/js/Common.js index bf4273c74e0c1af82131c6b2ae151f0378416a92..c9f76c912aa0a061c1953d69f6d4b008d095061c 100644 --- a/js/Common.js +++ b/js/Common.js @@ -763,8 +763,8 @@ CRM.validate = CRM.validate || { }); } - $(document).ready(function() { - if (CRM && CRM.config && CRM.config.urlIsPublic === false) { + $(function() { + if ($('#crm-notification-container').length) { // Initialize notifications $('#crm-notification-container').notify(); messagesFromMarkup.call($('#crm-container')); diff --git a/templates/CRM/Case/Form/CaseView.tpl b/templates/CRM/Case/Form/CaseView.tpl index dba987f36189f0d4ab433d6fc045f984d017b417..c6694293bc5137e9ce0f9a93adda0e2811bd88c9 100644 --- a/templates/CRM/Case/Form/CaseView.tpl +++ b/templates/CRM/Case/Form/CaseView.tpl @@ -208,8 +208,8 @@ ); } ,{ - title: ts('Delete case role'), - message: ts('Are you sure you want to delete this case role.') + title: '{/literal}{ts escape="js"}Delete case role{/ts}{literal}', + message: '{/literal}{ts escape="js"}Are you sure you want to delete this case role?{/ts}{literal}' }); return false; }); diff --git a/templates/CRM/Core/APIDoc.tpl b/templates/CRM/Core/APIDoc.tpl index 914448a2505b7e6710e83aa4cceed78a4c5fab3e..ac08b2bb356033635696e6676b946b962a9b25d5 100644 --- a/templates/CRM/Core/APIDoc.tpl +++ b/templates/CRM/Core/APIDoc.tpl @@ -10,7 +10,6 @@ h2.entity {cursor:pointer} {/literal} </style> -{include file="CRM/common/scripts.tpl"} <script> if (!jQuery) {ldelim} var head= document.getElementsByTagName('head')[0]; diff --git a/templates/CRM/Form/validate.tpl b/templates/CRM/Form/validate.tpl index e5a5df0e51848b6c6a3128bfa7c17d2cb608540c..e78fb11c05f4d5ad9a132b7261278843916acaac 100644 --- a/templates/CRM/Form/validate.tpl +++ b/templates/CRM/Form/validate.tpl @@ -56,14 +56,13 @@ cj(function($) { // use civicrm notifications when there are errors params.invalidHandler = function(form, validator) { var errors = validator.errorList; - if (CRM && CRM.config && CRM.config.urlIsPublic === false) { + {/literal}{if !$urlIsPublic}{literal} for (var i in errors) { $(errors[i].element).crmError(errors[i].message); } - } - else { - alert({/literal}"{ts escape='js'}Please review and correct the highlighted fields before continuing.{/ts}"{literal}); - } + {/literal}{else} + alert("{ts escape='js'}Please review and correct the highlighted fields before continuing.{/ts}"); + {/if}{literal} }; CRM.validate.params = CRM.validate.params || {}; diff --git a/templates/CRM/common/Navigation.tpl b/templates/CRM/common/Navigation.tpl index 824c70ba2f606586c01bdbff6b7fad0685e35b7c..799acb6b14965f8c5198af9dcc6c4d443dbead43 100644 --- a/templates/CRM/common/Navigation.tpl +++ b/templates/CRM/common/Navigation.tpl @@ -70,9 +70,8 @@ cj(function( ) { minChars: 1, matchContains: true, delay: 400, - max: CRM.config.search_autocomplete_count, + max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal}, extraParams:{ - limit: CRM.config.search_autocomplete_count, fieldName:function () { return cj('input[name=quickSearchField]:checked').val(); }, diff --git a/templates/CRM/common/drupal.tpl b/templates/CRM/common/drupal.tpl index 951f6623aa862038896a96299a0af14b3ca6ca14..2875ee8173c4640202947938e3dad80743756997 100644 --- a/templates/CRM/common/drupal.tpl +++ b/templates/CRM/common/drupal.tpl @@ -23,7 +23,6 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{include file="CRM/common/scripts.tpl"} {if $config->debug} {include file="CRM/common/debug.tpl"} {/if} diff --git a/templates/CRM/common/drupal6.tpl b/templates/CRM/common/drupal6.tpl index 59bd454f2d4c06d2400b7d2c64f3637b4604d7f0..33fe217d337ed0cdded61f38fd0e197276c16c88 100644 --- a/templates/CRM/common/drupal6.tpl +++ b/templates/CRM/common/drupal6.tpl @@ -23,7 +23,6 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{include file="CRM/common/scripts.tpl"} {if $config->debug} {include file="CRM/common/debug.tpl"} {/if} diff --git a/templates/CRM/common/joomla.tpl b/templates/CRM/common/joomla.tpl index b2751cd7c52bd1e8c2c901b2ddbd3458ec1dde04..a408259c84d39d55ad81dc1f0fcaf550e4ec6689 100644 --- a/templates/CRM/common/joomla.tpl +++ b/templates/CRM/common/joomla.tpl @@ -23,7 +23,6 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{include file="CRM/common/scripts.tpl"} {if $config->debug} {include file="CRM/common/debug.tpl"} {/if} diff --git a/templates/CRM/common/print.tpl b/templates/CRM/common/print.tpl index 6633dc62b0767df1140f207f0cc133f3359fb04b..058ccee91e01e3526e0bc9975867c1b37c60bda0 100644 --- a/templates/CRM/common/print.tpl +++ b/templates/CRM/common/print.tpl @@ -35,7 +35,6 @@ </head> <body> -{include file="CRM/common/scripts.tpl"} {if $config->debug} {include file="CRM/common/debug.tpl"} {/if} diff --git a/templates/CRM/common/scripts.tpl b/templates/CRM/common/scripts.tpl deleted file mode 100644 index 625d13c65021ec516e8b88ffc18c2f678cca75e9..0000000000000000000000000000000000000000 --- a/templates/CRM/common/scripts.tpl +++ /dev/null @@ -1,66 +0,0 @@ -{* - +--------------------------------------------------------------------+ - | CiviCRM version 4.3 | - +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2013 | - +--------------------------------------------------------------------+ - | This file is a part of CiviCRM. | - | | - | CiviCRM is free software; you can copy, modify, and distribute it | - | under the terms of the GNU Affero General Public License | - | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | - | | - | CiviCRM is distributed in the hope that it will be useful, but | - | WITHOUT ANY WARRANTY; without even the implied warranty of | - | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | - | See the GNU Affero General Public License for more details. | - | | - | You should have received a copy of the GNU Affero General Public | - | License and the CiviCRM Licensing Exception along | - | with this program; if not, contact CiviCRM LLC | - | at info[AT]civicrm[DOT]org. If you have questions about the | - | GNU Affero General Public License or the licensing of CiviCRM, | - | see the CiviCRM license FAQ at http://civicrm.org/licensing | - +--------------------------------------------------------------------+ -*} - -<script type="text/javascript"> - {* Initialize CRM.url *} - CRM.url('init', '{crmURL p="civicrm/example" q="placeholder" h=0 }'); - -{*/* - * Here we define the CRM object, - * A single global variable to hold everything that needs to be accessed from the global scope - * Translated strings are stored in the CRM.strings object, and can be accessed via ts() in javascript - * Very common strings are included here for convenience. Others should be added dynamically per-page. - * - * To extend this object from php: - * CRM_Core_Resources::singleton()->addSetting(array('myNamespace' => array('foo' => 'bar'))); - * It can then be accessed client-side via CRM.myNamespace.foo - */ - *} - {literal} - var CRM = CRM || {}; - CRM = cj.extend(true, { - strings: {{/literal} - '- select -': '{ts escape="js"}- select -{/ts}', - Ok: '{ts escape="js"}Ok{/ts}', - Cancel: '{ts escape="js"}Cancel{/ts}', - Yes: '{ts escape="js"}Yes{/ts}', - No: '{ts escape="js"}No{/ts}', - Saved: '{ts escape="js"}Saved{/ts}', - Error: '{ts escape="js"}Error{/ts}', - Removed: '{ts escape="js"}Removed{/ts}' - {literal}}, - config: {{/literal} - urlIsPublic: {if $urlIsPublic}true{else}false{/if}, - userFramework: '{$config->userFramework}', - resourceBase: '{$config->resourceBase}', - search_autocomplete_count: {crmSetting name="search_autocomplete_count" group="Search Preferences"} - {literal}}, - }, CRM); - {/literal} - {* Dynamically add server-side variables to the CRM object *} - {crmRegion name='settings'} - {/crmRegion} -</script> diff --git a/templates/CRM/common/wordpress.tpl b/templates/CRM/common/wordpress.tpl index fdb0231abd4586d999ffa4f2984ceb41f756e8f7..8187f5759e4f8fee1a3cb2f616d60923d8ee616e 100644 --- a/templates/CRM/common/wordpress.tpl +++ b/templates/CRM/common/wordpress.tpl @@ -23,7 +23,6 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{include file="CRM/common/scripts.tpl"} {if $config->debug} {include file="CRM/common/debug.tpl"} {/if} diff --git a/tests/phpunit/CRM/Core/ResourcesTest.php b/tests/phpunit/CRM/Core/ResourcesTest.php index a698cec4648925fb6575cb6942649ef68eb24304..720ce60ee6fb75c813c1c2d68560a927b2eec88a 100644 --- a/tests/phpunit/CRM/Core/ResourcesTest.php +++ b/tests/phpunit/CRM/Core/ResourcesTest.php @@ -134,8 +134,8 @@ class CRM_Core_ResourcesTest extends CiviUnitTestCase { $this->res->getSettings() ); $actual = $this->res->renderSetting(); - $expected = 'CRM = cj.extend(true, ' . json_encode(array('fruit' => array('yours' => 'orange', 'mine' => 'apple'))) . ', CRM);'; - $this->assertEquals($expected, $actual); + $expected = json_encode(array('fruit' => array('yours' => 'orange', 'mine' => 'apple'))); + $this->assertTrue(strpos($actual, $expected) !== FALSE); } function testAddSettingFactory() {