From c20ca2c861c4ce82f84fa8215bca44fd03f9aeef Mon Sep 17 00:00:00 2001 From: CiviCRM Date: Sat, 27 Jul 2013 21:32:34 +0530 Subject: [PATCH] CRM-13078, js fixes to show correct row icon ---------------------------------------- * 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 --- templates/CRM/Batch/Form/Entry.tpl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/templates/CRM/Batch/Form/Entry.tpl b/templates/CRM/Batch/Form/Entry.tpl index eed756c631..cc1d057c35 100644 --- a/templates/CRM/Batch/Form/Entry.tpl +++ b/templates/CRM/Batch/Form/Entry.tpl @@ -183,8 +183,21 @@ var validRow = 0; var inValidRow = 0; var errorExists = false; + var rowID = parentRow.closest('div.crm-grid-row').attr('entity_id'); + parentRow.find('div .required').each(function(){ - if ( !cj(this).val( ) ) { + //special case to handle contact autocomplete select + var fieldId = cj(this).attr('id'); + if (fieldId.substring(0, 16) == 'primary_contact_') { + // if display value is set then make sure we also check if contact id is set + if ( !cj(this).val( ) ) { + inValidRow++; + } + else if (cj(this).val( ) && !cj('input[name="primary_contact_select_id[' + rowID + ']"]').val()) { + inValidRow++; + errorExists = true; + } + } else if ( !cj(this).val( ) ) { inValidRow++; } else if ( cj(this).hasClass('error') && !cj(this).hasClass('valid') ) { errorExists = true; @@ -193,7 +206,7 @@ } }); - // this means use has entered some data + // this means user has entered some data if ( errorExists ) { parentRow.find("div:first span").prop('class', 'batch-invalid'); } else if ( inValidRow == 0 && validRow > 0 ) { -- 2.25.1