From: Dave Greenberg Date: Wed, 1 May 2013 00:00:28 +0000 (-0700) Subject: CRM-12482 add call to crmSetting to get autocomplete result limit to all relevant... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=401906c10fd7efb3c95df4eae455eecae114832e;p=civicrm-core.git CRM-12482 add call to crmSetting to get autocomplete result limit to all relevant tpls. ---------------------------------------- * CRM-12482: Autocomplete Search Results limit setting should be used for all autocomplete widgets http://issues.civicrm.org/jira/browse/CRM-12482 --- diff --git a/templates/CRM/Activity/Form/Activity.tpl b/templates/CRM/Activity/Form/Activity.tpl index c90145beb7..3264fcdfda 100644 --- a/templates/CRM/Activity/Form/Activity.tpl +++ b/templates/CRM/Activity/Form/Activity.tpl @@ -76,7 +76,7 @@ var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name of an existing contact.{/ts}{literal}"; cj( "#assignee_contact_id").tokenInput( tokenDataUrl_assignee, { prePopulate: assignee_contact, theme: 'facebook', hintText: hintText }); cj( 'ul.token-input-list-facebook, div.token-input-dropdown-facebook' ).css( 'width', '450px' ); - cj('#source_contact_id').autocomplete( sourceDataUrl, { width : 180, selectFirst : false, hintText: hintText, matchContains: true, minChars: 1 + cj('#source_contact_id').autocomplete( sourceDataUrl, { width : 180, selectFirst : false, hintText: hintText, matchContains: true, minChars: 1, max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} }).result( function(event, data, formatted) { cj( "#source_contact_qid" ).val( data[1] ); }).bind( 'click', function( ) { cj( "#source_contact_qid" ).val(''); }); }); diff --git a/templates/CRM/Contact/Form/CurrentEmployer.tpl b/templates/CRM/Contact/Form/CurrentEmployer.tpl index 94632174ae..501feaea78 100644 --- a/templates/CRM/Contact/Form/CurrentEmployer.tpl +++ b/templates/CRM/Contact/Form/CurrentEmployer.tpl @@ -33,7 +33,8 @@ width : 250, selectFirst : false, matchCase : true, - matchContains: true + matchContains: true, + max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} }).result( function(event, data, formatted) { var foundContact = ( parseInt( data[1] ) ) ? cj( "#current_employer_id" ).val( data[1] ) : cj( "#current_employer_id" ).val(''); if ( ! foundContact.val() ) { diff --git a/templates/CRM/Contact/Form/NewContact.tpl b/templates/CRM/Contact/Form/NewContact.tpl index c5520d0b32..6dbc3ecc5b 100644 --- a/templates/CRM/Contact/Form/NewContact.tpl +++ b/templates/CRM/Contact/Form/NewContact.tpl @@ -127,7 +127,7 @@ var contactElement = '#' + prefix + 'contact_' + blockNo; var contactHiddenElement = 'input[name="{/literal}{$prefix}{literal}contact_select_id[' + blockNo +']"]'; cj( contactElement ).autocomplete( contactUrl, { - selectFirst : false, matchContains: true, minChars: 1 + selectFirst : false, matchContains: true, minChars: 1, max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} }).result( function(event, data, formatted) { cj( contactHiddenElement ).val(data[1]); {/literal} diff --git a/templates/CRM/Contact/Form/OnBehalfOf.tpl b/templates/CRM/Contact/Form/OnBehalfOf.tpl index f2c4295d4a..618979bf7e 100644 --- a/templates/CRM/Contact/Form/OnBehalfOf.tpl +++ b/templates/CRM/Contact/Form/OnBehalfOf.tpl @@ -247,7 +247,7 @@ {* Javascript method to populate the location fields when a different existing related contact is selected *} {literal} var dataUrl = "{/literal}{$employerDataURL}{literal}"; - cj('#organization_id').autocomplete( dataUrl, { width : 180, selectFirst : false, matchContains: true + cj('#organization_id').autocomplete( dataUrl, { width : 180, selectFirst : false, matchContains: true, max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} }).result( function(event, data, formatted) { cj('#organization_name').val( data[0] ); cj('#onbehalfof_id').val( data[1] ); diff --git a/templates/CRM/Contact/Form/Relationship.tpl b/templates/CRM/Contact/Form/Relationship.tpl index 069bca5d83..5c7e5a20bc 100644 --- a/templates/CRM/Contact/Form/Relationship.tpl +++ b/templates/CRM/Contact/Form/Relationship.tpl @@ -166,7 +166,7 @@ var relContact = cj('#contact_1'); if ( relType ) { var dataUrl = {/literal}'{crmURL p="civicrm/ajax/rest" h=0 q="className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=relationship&rel="}'{literal} + relType; - relContact.autocomplete( dataUrl, { width : 180, selectFirst : false, matchContains: true }); + relContact.autocomplete( dataUrl, { width : 200, selectFirst : false, matchContains: true, max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} }); relContact.result(function( event, data ) { cj("input[name='contact_select_id[1]']").val(data[1]); cj('#relationship-refresh-save').show( ); diff --git a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl index a3aece0358..a9e4f05f27 100644 --- a/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl +++ b/templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl @@ -278,7 +278,8 @@ function selectCreateOrg( orgOption, reset ) { cj('#onbehalf_organization_name').autocomplete( dataUrl, { width : 180, selectFirst : false, - matchContains : true + matchContains : true, + max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} }).result( function( event, data, formatted ) { cj('#onbehalf_organization_name').val( data[0] ); cj('#onbehalfof_id').val( data[1] ); diff --git a/templates/CRM/Custom/Form/AutoComplete.tpl b/templates/CRM/Custom/Form/AutoComplete.tpl index b69b35f727..548547135f 100644 --- a/templates/CRM/Custom/Form/AutoComplete.tpl +++ b/templates/CRM/Custom/Form/AutoComplete.tpl @@ -35,7 +35,7 @@ cj( function( ) { if ( !customObj.hasClass('ac_input') ) { customObj.autocomplete( url, - { width : 250, selectFirst : false, matchContains: true + { width : 250, selectFirst : false, matchContains: true, max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} }).result( function(event, data ) { customIdObj.val( data[1] ); diff --git a/templates/CRM/Custom/Form/ContactReference.tpl b/templates/CRM/Custom/Form/ContactReference.tpl index e1ba1557cc..bef9a4bcb7 100644 --- a/templates/CRM/Custom/Form/ContactReference.tpl +++ b/templates/CRM/Custom/Form/ContactReference.tpl @@ -35,7 +35,7 @@ cj( function( ) { if ( !customObj.hasClass('ac_input') ) { customObj.autocomplete( url, - { width : 250, selectFirst : false, elementId: custom, matchContains: true, formatResult: {/literal}validate{$element_name|replace:']':''|replace:'[':'_'|replace:'-':'_'}{literal} + { width : 250, selectFirst : false, elementId: custom, matchContains: true, formatResult: {/literal}validate{$element_name|replace:']':''|replace:'[':'_'|replace:'-':'_'}{literal}, max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} }).result( function(event, data ) { customIdObj.val( data[1] ); diff --git a/templates/CRM/Financial/Form/FinancialAccount.tpl b/templates/CRM/Financial/Form/FinancialAccount.tpl index a5b06994a9..80ae5bed32 100644 --- a/templates/CRM/Financial/Form/FinancialAccount.tpl +++ b/templates/CRM/Financial/Form/FinancialAccount.tpl @@ -104,7 +104,8 @@ cj('#contact_name').autocomplete( dataUrl, { width : 250, selectFirst : false, matchCase : true, - matchContains: true + matchContains: true, + max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} }).result( function(event, data, formatted) { ( parseInt( data[1] ) ) ? cj( "#contact_id" ).val( data[1] ) : cj( "#contact_id" ).val(''); }); diff --git a/templates/CRM/Member/Form/MembershipType.tpl b/templates/CRM/Member/Form/MembershipType.tpl index 6e013f8d59..9f7c098a66 100644 --- a/templates/CRM/Member/Form/MembershipType.tpl +++ b/templates/CRM/Member/Form/MembershipType.tpl @@ -164,7 +164,7 @@ cj(function(){ var orgDataUrl = "{/literal}{$dataUrl}{literal}"; var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name of an existing contact.{/ts}{literal}"; cj('#member_of_contact').autocomplete( orgDataUrl, - { width : 180, selectFirst : false, hintText: hintText, matchContains: true, minChars: 1 + { width : 200, selectFirst : false, hintText: hintText, matchContains: true, minChars: 1, max: {/literal}{crmSetting name="search_autocomplete_count" group="Search Preferences"}{literal} }).result( function(event, data, formatted) { ( parseInt( data[1] ) ) ? cj( "#member_of_contact_id" ).val( data[1] ) : cj( "#member_of_contact_id" ).val('');