[Vtigercrm-developers] Cannot add comments on 7.1

Mark mclarke4 at gmail.com
Mon Apr 8 15:58:07 GMT 2019


Hi all,

We upgraded from 7.0 to 7.1 We have also applied hotfix3. We are unable to
capture comments. A javascript error is thrown

===================
Uncaught TypeError: Cannot read property 'id' of undefined
at Object. (Detail.js?v=7.1.0:2817)
at Object. (jquery.min.js?v=7.1.0:2)
at j (jquery.min.js?v=7.1.0:2)
at Object.fireWith [as resolveWith] (jquery.min.js?v=7.1.0:2)
at Object.e.(/anonymous function) [as resolve] (
https://crm.abc.com/layouts/v7/lib/jquery/jquery.min.js?v=7.1.0:2:28929)
at Object. (Detail.js?v=7.1.0:1997)
at Object. (jquery.min.js?v=7.1.0:2)
at j (jquery.min.js?v=7.1.0:2)
at Object.fireWith [as resolveWith] (jquery.min.js?v=7.1.0:2)
at Object.e.(/anonymous function) [as resolve] (
https://crm.abc.com/layouts/v7/lib/jquery/jquery.min.js?v=7.1.0:2:28929)
========================

This error is generated in the function detailed below as data is undefined
when saving a new comment.

    detailContentsHolder.on('click','.saveComment', function(e){
        var element = jQuery(e.currentTarget);
        if(!element.is(":disabled")) {
            var currentTarget = jQuery(e.currentTarget);
            var mode = currentTarget.data('mode');
            var dataObj = self.saveComment(e);
            dataObj.then(function(data){
                var closestAddCommentBlock =
currentTarget.closest('.addCommentBlock');
                var commentTextAreaElement =
closestAddCommentBlock.find('.commentcontent');
                var commentInfoBlock = currentTarget.closest('.singleComment');
                commentTextAreaElement.val('');

closestAddCommentBlock.find('#is_private').removeAttr('checked');
                if(mode == "add"){
                    var commentId = data['id'];  //
<======================== data is undefined.
                    var commentHtml = self.getCommentUI(commentId);
                    commentHtml.then(function(data){
                        var html;
                        if(jQuery(data).hasClass('privateComment')) {
                            html = '<ul class="unstyled"><li
class="commentDetails" style="background:
#fff9ea;">'+data+'</li></ul>';
                        } else {
                            html = '<ul class="unstyled"><li
class="commentDetails">'+data+'</li></ul>';
                        }
                        var commentBlock =
closestAddCommentBlock.closest('.commentDetails');
                        var detailContentsHolder = self.getContentHolder();
                        var noCommentsMsgContainer =
jQuery('.noCommentsMsgContainer',detailContentsHolder);
                        noCommentsMsgContainer.remove();
                        if(commentBlock.length > 0){
                            closestAddCommentBlock.remove();
                            var childComments = commentBlock.find('ul');
                            if(childComments.length <= 0){
                                var currentChildCommentsCount =
commentInfoBlock.find('.viewThreadBlock').data('childCommentsCount');
                                var newChildCommentCount =
currentChildCommentsCount + 1;

commentInfoBlock.find('.childCommentsCount').text(newChildCommentCount);
                                var parentCommentId =
commentInfoBlock.find('.commentInfoHeader').data('commentid');

self.getChildComments(parentCommentId).then(function(responsedata){
                                    jQuery(responsedata).appendTo(commentBlock);

commentInfoBlock.find('.viewThreadBlock').hide();

commentInfoBlock.find('.hideThreadBlock').show();
                                });
                            }else {
                                jQuery(html).appendTo(commentBlock);
                            }
                        } else {

jQuery(html).prependTo(closestAddCommentBlock.closest('.commentContainer').find('.commentsList'));
                            commentTextAreaElement.css({height : '71px'});
                        }

commentInfoBlock.find('.commentActionsContainer').show();
                    });
                }else if(mode == "edit"){
                    var modifiedTime =
commentInfoBlock.find('.commentModifiedTime');
                    var commentInfoContent =
commentInfoBlock.find('.commentInfoContent');
                    var commentEditStatus =
commentInfoBlock.find('[name="editStatus"]');
                    var commentReason =
commentInfoBlock.find('[name="editReason"]');
                    commentInfoContent.html(data.commentcontent);
                    commentReason.html(data.reasontoedit);
                    modifiedTime.text(data.modifiedtime);
                    modifiedTime.attr('title',data.modifiedtimetitle)
                    if(commentEditStatus.hasClass('hide')){
                        commentEditStatus.removeClass('hide');
                    }
                    if(data.reasontoedit != ""){
                        commentInfoBlock.find('.editReason').removeClass('hide')
                    }
                    commentInfoContent.show();
                    commentInfoBlock.find('.commentActionsContainer').show();
                    closestAddCommentBlock.remove();
                }
                element.removeAttr('disabled');
                var indexInstance = Vtiger_Index_Js.getInstance();
                indexInstance.registerMultiUpload();
            });
        }
    });
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20190408/9f5d76dd/attachment.html>


More information about the vtigercrm-developers mailing list