microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
770 stars 610 forks source link

page 5222 "Human Resource Comment Sheet" - OnBeforeCaption - Event Request #13850

Closed ZacRyon closed 3 years ago

ZacRyon commented 3 years ago

page 5222 "Human Resource Comment Sheet" { AutoSplitKey = true; Caption = 'Comment Sheet'; DataCaptionExpression = Caption(Rec); DelayedInsert = true; LinksAllowed = false; MultipleNewLines = true; PageType = List; SourceTable = "Human Resource Comment Line";

layout
{
    area(content)
    {
        repeater(Control1)
        {
            ShowCaption = false;
            field(Date; Date)
            {
                ApplicationArea = BasicHR;
                ToolTip = 'Specifies the date the comment was created.';
            }
            field(Comment; Comment)
            {
                ApplicationArea = Comments;
                ToolTip = 'Specifies the comment itself.';
            }
            field("Code"; Code)
            {
                ApplicationArea = BasicHR;
                ToolTip = 'Specifies a code for the comment.';
                Visible = false;
            }
        }
    }
}

actions
{
}

trigger OnNewRecord(BelowxRec: Boolean)
begin
    SetUpNewLine;
end;

var
    Text000: Label 'untitled';
    Employee: Record Employee;
    EmployeeAbsence: Record "Employee Absence";
    EmployeeQualification: Record "Employee Qualification";
    EmployeeRelative: Record "Employee Relative";
    MiscArticleInfo: Record "Misc. Article Information";
    ConfidentialInfo: Record "Confidential Information";

procedure Caption(HRCommentLine: Record "Human Resource Comment Line"): Text
//NPO begin
var
    IsHandled: Boolean;
    ReturnValue: Text;
//NPO end
begin
    //NPO begin
    OnBeforeCaption(HRCommentLine, Employee, EmployeeQualification, ConfidentialInfo, IsHandled, ReturnValue);
    if IsHandled then begin
        exit(ReturnValue);
    end;
    //NPO end
    case HRCommentLine."Table Name" of
        HRCommentLine."Table Name"::"Employee Absence":
            if EmployeeAbsence.Get(HRCommentLine."Table Line No.") then begin
                Employee.Get(EmployeeAbsence."Employee No.");
                exit(
                  Employee."No." + ' ' + Employee.FullName + ' ' +
                  EmployeeAbsence."Cause of Absence Code" + ' ' +
                  Format(EmployeeAbsence."From Date"));
            end;
        HRCommentLine."Table Name"::Employee:
            if Employee.Get(HRCommentLine."No.") then
                exit(HRCommentLine."No." + ' ' + Employee.FullName);
        HRCommentLine."Table Name"::"Alternative Address":
            if Employee.Get(HRCommentLine."No.") then
                exit(
                  HRCommentLine."No." + ' ' + Employee.FullName + ' ' +
                  HRCommentLine."Alternative Address Code");
        HRCommentLine."Table Name"::"Employee Qualification":
            if EmployeeQualification.Get(HRCommentLine."No.", HRCommentLine."Table Line No.") and
               Employee.Get(HRCommentLine."No.")
            then
                exit(
                  HRCommentLine."No." + ' ' + Employee.FullName + ' ' +
                  EmployeeQualification."Qualification Code");
        HRCommentLine."Table Name"::"Employee Relative":
            if EmployeeRelative.Get(HRCommentLine."No.", HRCommentLine."Table Line No.") and
               Employee.Get(HRCommentLine."No.")
            then
                exit(
                  HRCommentLine."No." + ' ' + Employee.FullName + ' ' +
                  EmployeeRelative."Relative Code");
        HRCommentLine."Table Name"::"Misc. Article Information":
            if MiscArticleInfo.Get(
                 HRCommentLine."No.", HRCommentLine."Alternative Address Code", HRCommentLine."Table Line No.") and
               Employee.Get(HRCommentLine."No.")
            then
                exit(
                  HRCommentLine."No." + ' ' + Employee.FullName + ' ' +
                  MiscArticleInfo."Misc. Article Code");
        HRCommentLine."Table Name"::"Confidential Information":
            if ConfidentialInfo.Get(HRCommentLine."No.", HRCommentLine."Table Line No.") and
               Employee.Get(HRCommentLine."No.")
            then
                exit(
                  HRCommentLine."No." + ' ' + Employee.FullName + ' ' +
                  ConfidentialInfo."Confidential Code");
    end;
    exit(Text000);
end;

//NPO begin
[IntegrationEvent(false, false)]
local procedure OnBeforeCaption(HRCommentLine: Record "Human Resource Comment Line"; Employee: Record Employee; EmployeeQualification: Record "Employee Qualification"; ConfidentialInfo: Record "Confidential Information"; var IsHandled: Boolean; var ReturnValue: Text)
begin
end;
//NPO end

}

JesperSchulz commented 3 years ago

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.