Skip to content
Snippets Groups Projects
Commit 22f96dcf authored by Dave Greenberg's avatar Dave Greenberg
Browse files

Merge pull request #1294 from kurund/CRM-13078

CRM-13078, batch entry fixes
Tested the remaining exceptions. Form rule displays properly now and checkmark icon displayed when error condition is corrected.
parents 88f70264 eac283fc
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
......@@ -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()) {
......
......@@ -754,7 +754,9 @@ CRM.validate = CRM.validate || {
});
// Handle qf form errors
$('form :input.error', this).one('blur', function() {
$('.ui-notify-message.error a.ui-notify-close').click();
if ($(this).is('.ac_input')) {
return;
}
$(this).removeClass('error');
$(this).next('span.crm-error').remove();
$('label[for="' + $(this).attr('name') + '"], label[for="' + $(this).attr('id') + '"]')
......
......@@ -109,7 +109,9 @@ cj(function () {
};
cj("#Entry").ajaxSubmit(options);
});
cj('#crm-container').on('keyup change', '*.selector-rows', function () {
// validate rows
checkColumns(cj(this));
});
......@@ -212,10 +214,15 @@ function checkColumns(parentRow) {
inValidRow++;
}
else {
if (cj(this).val() && !cj('input[name="primary_contact_select_id[' + rowID + ']"]').val()) {
var contactIdElement = cj('input[name="primary_contact_select_id[' + rowID + ']"]');
if (cj(this).val() && !contactIdElement.val()) {
inValidRow++;
errorExists = true;
}
else if (cj(this).val() && contactIdElement.val()) {
// this is hack to remove error span because we are skipping this for autocomplete fields
cj(this).next('span.crm-error').remove();
}
}
}
else {
......@@ -223,7 +230,7 @@ function checkColumns(parentRow) {
inValidRow++;
}
else {
if (cj(this).hasClass('error') && !cj(this).hasClass('valid')) {
if (cj(this).hasClass('error') && (cj(this).hasClass('valid') || cj(this).hasClass('required'))) {
errorExists = true;
}
else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment