2012年11月8日星期四

How to using code changed comment in AX2012



EditorScripts\LAST_comment


void LAST_comment(Editor editor)
{
    xppSource xppSource = new xppSource(editor.columnNo());
    Source template = xppSource.comment();
    ;
    editor.insertLines(template);
}


xppSource\comment
// VAR Changed on 08 Nov 2012 at 13:55:27 by JXie7519
Source comment()
{
    UserInfo    UserInfo;
    Name        name;
;
    /* Original
    source += strfmt("// #! INCIDENT !#.LAST.%1.%2:", date2str(systemdateget(), 123,2,2,2,2,2, DateFlags::None), curuserId());
    */

    // VAR Changed on 08 Nov 2012 at 13:55:27 by JXie7519 - start
    select firstOnly UserInfo where UserInfo.id == curUserId();

    name = subStr(UserInfo.networkAlias, strLen(UserInfo.networkAlias) - 3, strlen(UserInfo.networkAlias));
    name = Global::isInteger(name) ? name : UserInfo.id;
    
    source += "// " + strUpr(enum2str(currentAOLayer())) + " Changed on " + date2str(today(),321,2,3,2,3,4, DateFlags::FormatAll ) + " at " + time2str(timenow(), 1, 1) + " by " + name + " - start" + '\n' +
       "\t" + "// " + strUpr(enum2str(currentAOLayer())) + " Changed on " + date2str(today(),321,2,3,2,3,4, DateFlags::FormatAll ) + " at " + time2str(timenow(), 1, 1) + " by " + name + " - end" + '\n';
    // VAR Changed on 08 Nov 2012 at 13:55:27 by JXie7519 - end

    return source;
}


没有评论:

发表评论