Don't throw PHP notice when rendering dedupefind template.
authorBradley Taylor <hello@brad-taylor.co.uk>
Sat, 5 Feb 2022 13:25:54 +0000 (13:25 +0000)
committerBradley Taylor <hello@brad-taylor.co.uk>
Sat, 5 Feb 2022 13:25:54 +0000 (13:25 +0000)
CRM/Contact/Form/DedupeFind.php
templates/CRM/Contact/Form/DedupeFind.tpl

index 13e2a4035f8233406cd2e26d5b70402113945d5a..04a5351161ec30c0e8e073e21b87092b0ecd38d6 100644 (file)
@@ -41,9 +41,11 @@ class CRM_Contact_Form_DedupeFind extends CRM_Admin_Form {
     $groupList = ['' => ts('- All Contacts -')] + CRM_Core_PseudoConstant::nestedGroup();
 
     $this->add('select', 'group_id', ts('Select Group'), $groupList, FALSE, ['class' => 'crm-select2 huge']);
-    if (Civi::settings()->get('dedupe_default_limit')) {
-      $this->add('text', 'limit', ts('No of contacts to find matches for '));
-    }
+    $this->add('text', 'limit', ts('No of contacts to find matches for '));
+
+    // To improve usability for smaller sites, we don't show the limit field unless a default limit has been set.
+    $this->assign('limitShown', (bool) Civi::settings()->get('dedupe_default_limit'));
+
     $this->addButtons([
       [
         'type' => 'next',
index d96ba76511c6185060428f08e631911c1ad62123..5cb53d59af9e69523a8fe3a973156eb557870663 100644 (file)
        <td class="label">{$form.group_id.label}</td>
        <td>{$form.group_id.html}</td>
      </tr>
-       <tr class="crm-dedupe-find-form-block-limit">
-        <td class="label">{$form.limit.label}</td>
-        <td>{$form.limit.html}</td>
-       </tr>
+     {if $limitShown}
+        <tr class="crm-dedupe-find-form-block-limit">
+          <td class="label">{$form.limit.label}</td>
+          <td>{$form.limit.html}</td>
+        </tr>
+      {/if}
    </table>
   <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
 </div>