From e0fdf425049ee89f81dcfe91246bb9697353ec45 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 29 Sep 2014 16:59:53 +0100 Subject: [PATCH] Fixed - When given wrong criteria empty popup is shown --- templates/CRM/Core/Form/RecurringEntity.tpl | 92 +++++++++++---------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/templates/CRM/Core/Form/RecurringEntity.tpl b/templates/CRM/Core/Form/RecurringEntity.tpl index e9ad71d2aa..6aa60e7b5c 100644 --- a/templates/CRM/Core/Form/RecurringEntity.tpl +++ b/templates/CRM/Core/Form/RecurringEntity.tpl @@ -274,57 +274,61 @@ data: formData, url: ajaxurl, success: function (result) { - var errors = []; - var participantData = []; - var html = 'Based on your repeat configuration here is the list of event dates, Do you wish to proceed creating events for these dates?
'; - var count = 1; - for(var i in result) { - if(i != 'errors'){ - if(i == 'participantData'){ - participantData = result.participantData; - break; - } - var start_date = result[i].start_date; - var end_date = result[i].end_date; + if(Object.keys(result).length > 0){ + var errors = []; + var participantData = []; + var html = 'Based on your repeat configuration here is the list of event dates, Do you wish to proceed creating events for these dates?
Sr NoStart dateEnd date
'; + var count = 1; + for(var i in result) { + if(i != 'errors'){ + if(i == 'participantData'){ + participantData = result.participantData; + break; + } + var start_date = result[i].start_date; + var end_date = result[i].end_date; - var end_date_text = ''; - if(end_date !== undefined){ - end_date_text = ''; + var end_date_text = ''; + if(end_date !== undefined){ + end_date_text = ''; + } + html += ''+end_date_text+''; + count = count + 1; + }else{ + errors = result.errors; } - html += ''+end_date_text+''; - count = count + 1; - }else{ - errors = result.errors; } - } - html += '
Sr NoStart dateEnd date
'+end_date+''+end_date+'
'+count+''+start_date+'
'+count+''+start_date+'
'; - var warningHtml = ''; - if(Object.keys(participantData).length > 0){ - warningHtml += '
 There are registrations for the repeating events already present in the set, continuing with the process would unlink them and repeating events without registration would be trashed.
'; - for (var id in participantData) { - for(var data in participantData[id]){ - warningHtml += ''; + html += '
Event IDEventParticipant Count
'+id+' '+data+''+participantData[id][data]+'
'; + var warningHtml = ''; + if(Object.keys(participantData).length > 0){ + warningHtml += '
 There are registrations for the repeating events already present in the set, continuing with the process would unlink them and repeating events without registration would be trashed.
'; + for (var id in participantData) { + for(var data in participantData[id]){ + warningHtml += ''; + } } + warningHtml += '
Event IDEventParticipant Count
'+id+' '+data+''+participantData[id][data]+'

'; } - warningHtml += '
'; - } - if(errors.length > 0){ - html = ''; - for (var j = 0; j < errors.length; j++) { - html += '* ' + errors[j] + '
'; + if(errors.length > 0){ + html = ''; + for (var j = 0; j < errors.length; j++) { + html += '* ' + errors[j] + '
'; + } + } + if(warningHtml != ""){ + cj('#generated_dates').append(warningHtml).append(html); + }else{ + cj('#generated_dates').html(html); + } + if(end_date_text == ""){ + cj('#th-end-date').hide(); + } + if(cj("#preview-dialog").height() >= 300){ + cj('#preview-dialog').css('height', '300'); + cj('#preview-dialog').css('overflow-y', 'auto'); } - } - if(warningHtml != ""){ - cj('#generated_dates').append(warningHtml).append(html); }else{ - cj('#generated_dates').html(html); - } - if(end_date_text == ""){ - cj('#th-end-date').hide(); - } - if(cj("#preview-dialog").height() >= 300){ - cj('#preview-dialog').css('height', '300'); - cj('#preview-dialog').css('overflow-y', 'auto'); + cj('#generated_dates').append("Sorry, no dates could be generated for the given criteria!"); } }, complete: function(){ -- 2.25.1