From f842cfff1bb5db48301b880a459afd9e65adf9d7 Mon Sep 17 00:00:00 2001
From: kurund <kurund@civicrm.org>
Date: Fri, 2 Aug 2013 17:39:59 +0530
Subject: [PATCH] CRM-13078, fixed error message for contact autocomplete

----------------------------------------
* CRM-13078: Batch Data Entry silently drops 'batch-valid' entries if no contact_id is associated with them
  http://issues.civicrm.org/jira/browse/CRM-13078
---
 CRM/Batch/Form/Entry.php        | 2 +-
 CRM/Contact/Form/NewContact.php | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php
index 55860d91b5..a13d974ed2 100644
--- a/CRM/Batch/Form/Entry.php
+++ b/CRM/Batch/Form/Entry.php
@@ -178,7 +178,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
     $contactTypes = array('Contact', 'Individual', 'Household', 'Organization');
     for ($rowNumber = 1; $rowNumber <= $this->_batchInfo['item_count']; $rowNumber++) {
-      CRM_Contact_Form_NewContact::buildQuickForm($this, $rowNumber, NULL, TRUE, 'primary_');
+      CRM_Contact_Form_NewContact::buildQuickForm($this, $rowNumber, NULL, TRUE, 'primary_', ts('Contact'));
 
       // special field specific to membership batch udpate
       if ($this->_batchInfo['type_id'] == 2) {
diff --git a/CRM/Contact/Form/NewContact.php b/CRM/Contact/Form/NewContact.php
index 2c4a0e43ee..c60242ea64 100644
--- a/CRM/Contact/Form/NewContact.php
+++ b/CRM/Contact/Form/NewContact.php
@@ -50,11 +50,15 @@ class CRM_Contact_Form_NewContact {
    *
    * @return void
    */
-  static function buildQuickForm(&$form, $blockNo = 1, $extraProfiles = NULL, $required = FALSE, $prefix = '') {
+  static function buildQuickForm(&$form, $blockNo = 1, $extraProfiles = NULL, $required = FALSE, $prefix = '', $label = NULL) {
     // call to build contact autocomplete
     $attributes = array('width' => '200px');
 
-    $selectContacts = $form->add('text', "{$prefix}contact[{$blockNo}]", ts('Select Contact'), $attributes, $required);
+    if (!$label) {
+      $label = ts('Select Contact');
+    }
+
+    $selectContacts = $form->add('text', "{$prefix}contact[{$blockNo}]", $label, $attributes, $required);
 
     // use submitted values to set default if form submit fails dues to form rules
     if ($selectContacts->getValue()) {
-- 
GitLab