Skip to content

Commit

Permalink
Merge pull request #13709 from JMAConsulting/dev-core#757-rc
Browse files Browse the repository at this point in the history
Viewing Contact Note comments is broken in 5.10.4.
  • Loading branch information
colemanw authored Feb 26, 2019
2 parents 171735f + 51dd924 commit 9df02bf
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions templates/CRM/Contact/Page/View/Note.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@
function showHideComments( noteId ) {
elRow = cj('tr#cnote_'+ noteId)
elRow = cj('tr#Note-'+ noteId)
if (elRow.hasClass('view-comments')) {
cj('tr.note-comment_'+ noteId).remove()
commentRows['cnote_'+ noteId] = {};
cj('tr#cnote_'+ noteId +' span.icon_comments_show').show();
cj('tr#cnote_'+ noteId +' span.icon_comments_hide').hide();
commentRows['Note-'+ noteId] = {};
cj('tr#Note-'+ noteId +' span.icon_comments_show').show();
cj('tr#Note-'+ noteId +' span.icon_comments_hide').hide();
elRow.removeClass('view-comments');
} else {
var getUrl = {/literal}"{crmURL p='civicrm/ajax/rest' h=0}"{literal};
Expand All @@ -135,7 +135,7 @@
var urlTemplate = '{/literal}{crmURL p='civicrm/contact/view' q="reset=1&cid=" h=0 }{literal}'
if (response['values'][0] && response['values'][0].entity_id) {
var noteId = response['values'][0].entity_id
var row = cj('tr#cnote_'+ noteId);
var row = cj('tr#Note-'+ noteId);
row.addClass('view-comments');
Expand All @@ -145,20 +145,20 @@
var rowClassOddEven = 'even'
}
if ( commentRows['cnote_'+ noteId] ) {
for ( var i in commentRows['cnote_'+ noteId] ) {
if ( commentRows['Note-'+ noteId] ) {
for ( var i in commentRows['Note-'+ noteId] ) {
return false;
}
} else {
commentRows['cnote_'+ noteId] = {};
commentRows['Note-'+ noteId] = {};
}
for (i in response['values']) {
if ( response['values'][i].id ) {
if ( commentRows['cnote_'+ noteId] &&
commentRows['cnote_'+ noteId][response['values'][i].id] ) {
if ( commentRows['Note-'+ noteId] &&
commentRows['Note-'+ noteId][response['values'][i].id] ) {
continue;
}
str = '<tr id="cnote_'+ response['values'][i].id +'" class="'+ rowClassOddEven +' note-comment_'+ noteId +'">'
str = '<tr id="Note-'+ response['values'][i].id +'" class="'+ rowClassOddEven +' note-comment_'+ noteId +'">'
+ '<td></td>'
+ '<td style="padding-left: 2em">'
+ response['values'][i].note
Expand All @@ -172,13 +172,13 @@
+ response['values'][i].attachment
+ '</td><td>'+ commentAction.replace(/{cid}/g, response['values'][i].createdById).replace(/{id}/g, response['values'][i].id) +'</td></tr>'
commentRows['cnote_'+ noteId][response['values'][i].id] = str;
commentRows['Note-'+ noteId][response['values'][i].id] = str;
}
}
drawCommentRows('cnote_'+ noteId);
drawCommentRows('Note-'+ noteId);
cj('tr#cnote_'+ noteId +' span.icon_comments_show').hide();
cj('tr#cnote_'+ noteId +' span.icon_comments_hide').show();
cj('tr#Note-'+ noteId +' span.icon_comments_show').hide();
cj('tr#Note-'+ noteId +' span.icon_comments_hide').show();
} else {
CRM.alert('{/literal}{ts escape="js"}There are no comments for this note{/ts}{literal}', '{/literal}{ts escape="js"}None Found{/ts}{literal}', 'alert');
}
Expand All @@ -190,7 +190,7 @@
row = cj('tr#'+ rowId)
for (i in commentRows[rowId]) {
row.after(commentRows[rowId][i]);
row = cj('tr#cnote_'+ i);
row = cj('tr#Note-'+ i);
}
}
}
Expand Down

0 comments on commit 9df02bf

Please sign in to comment.