CRM-12482 add call to crmSetting to get autocomplete result limit to all relevant...
authorDave Greenberg <dave@civicrm.org>
Wed, 1 May 2013 00:00:28 +0000 (17:00 -0700)
committerDave Greenberg <dave@civicrm.org>
Wed, 1 May 2013 00:00:28 +0000 (17:00 -0700)
----------------------------------------
* CRM-12482: Autocomplete Search Results limit setting should be used for all autocomplete widgets
  http://issues.civicrm.org/jira/browse/CRM-12482

templates/CRM/Activity/Form/Activity.tpl
templates/CRM/Contact/Form/CurrentEmployer.tpl
templates/CRM/Contact/Form/NewContact.tpl
templates/CRM/Contact/Form/OnBehalfOf.tpl
templates/CRM/Contact/Form/Relationship.tpl
templates/CRM/Contribute/Form/Contribution/OnBehalfOf.tpl
templates/CRM/Custom/Form/AutoComplete.tpl
templates/CRM/Custom/Form/ContactReference.tpl
templates/CRM/Financial/Form/FinancialAccount.tpl
templates/CRM/Member/Form/MembershipType.tpl

index c90145beb72d6dc71c455e0ae02c076d44e654ae..3264fcdfdab7284c8001be2965bc0eab3df84cb7 100644 (file)
@@ -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(''); });
   });
index 94632174aef6fe28fa5686727e52fd74556d6f72..501feaea7872de33d98d89dae0c4fa8d90e1865c 100644 (file)
@@ -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() ) {
index c5520d0b32b998d7ae024d31e9dc61595fde3bbf..6dbc3ecc5bf55b1234c5c5662b58465c1898f6ad 100644 (file)
     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}
index f2c4295d4a6699e4f96d4b4330fbbcd604ec6e52..618979bf7e58a70a523d30909224c7309216020f 100644 (file)
 {* 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] );
index 069bca5d837d8b54a9091f696193c28d0ffb52c2..5c7e5a20bcf6e555a280f5ad53dec86f38e9fcda 100644 (file)
                         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( );
index a3aece0358cac10a5ad73ce39c23c0f28414ebf0..a9e4f05f27e2d00fd665103d9f3b9ee85e0f5f06 100644 (file)
@@ -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] );
index b69b35f727093edf8a407957a46cee32686f84cf..548547135f618c2afb6442ea0b4e9505e40ac16d 100644 (file)
@@ -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] );
index e1ba1557cc8280948cc1b17dfa5d6ed4d8f0a613..bef9a4bcb79c4e58dbc73a07fae0313ba2280875 100644 (file)
@@ -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] );
index a5b06994a915ccedc795caa092bfe3d6d1deec45..80ae5bed3201e9265426b9b2adc44d18f49ff045 100644 (file)
@@ -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('');
 });
index 6e013f8d59bac35095c5588c4082caeada7488d3..9f7c098a660b441d3614b42f3be9330130b74ad0 100644 (file)
@@ -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('');