Skip to content

[Bug]: AC0032 - false positive #243

Description

@guidorobben

Analyzer

ApplicationCop

Issue type

False positive (diagnostic fires when it shouldn't)

Rule ID

AC0032

Description

The rule reports that the table is not used, but as you can see in the code below, this is not true

AL code to reproduce

 Access = Internal;
    Permissions = 
        tabledata "Purch. Cr. Memo Hdr." = Rm;

    [EventSubscriber(ObjectType::Page, Page::"Pstd. Purch. Cr.Memo - Update", OnAfterRecordChanged, '', false, false)]
    local procedure OnAfterRecordChanged(var PurchCrMemoHdr: Record "Purch. Cr. Memo Hdr."; xPurchCrMemoHdr: Record "Purch. Cr. Memo Hdr."; var IsChanged: Boolean; xPurchCrMemoHdrGlobal: Record "Purch. Cr. Memo Hdr.")
    begin
        IsChanged := IsChanged or
            (PurchCrMemoHdr."Purchaser Code" <> xPurchCrMemoHdrGlobal."Purchaser Code") or
            (PurchCrMemoHdr."Approver WBLC" <> xPurchCrMemoHdrGlobal."Approver WBLC") or
            (PurchCrMemoHdr."On Hold" <> xPurchCrMemoHdrGlobal."On Hold");
    end;

    [EventSubscriber(ObjectType::Codeunit, Codeunit::"Purch. Cr. Memo. Hdr. - Edit", OnBeforePurchCrMemoHdrModify, '', false, false)]
    local procedure OnBeforePurchCrMemoHdrModify(var PurchCrMemoHdr: Record "Purch. Cr. Memo Hdr."; PurchCrMemoHdrRec: Record "Purch. Cr. Memo Hdr.")
    begin
        if PurchCrMemoHdrRec."Status WBLC" = PurchCrMemoHdrRec."Status WBLC"::Released then
            exit;

        if PurchCrMemoHdrRec."Status WBLC" = PurchCrMemoHdrRec."Status WBLC"::"Pending Approval" then begin
            PurchCrMemoHdrRec.CancelApprovalRequestWBLC();
            PurchCrMemoHdr."Status WBLC" := PurchCrMemoHdr."Status WBLC"::Open;
        end;

        PurchCrMemoHdr.UpdateVendorLedgerEntriesWBLC(PurchCrMemoHdr, PurchCrMemoHdrRec);
        PurchCrMemoHdr."Purchaser Code" := PurchCrMemoHdrRec."Purchaser Code";
        PurchCrMemoHdr."Approver WBLC" := PurchCrMemoHdrRec."Approver WBLC";
        PurchCrMemoHdr."On Hold" := PurchCrMemoHdrRec."On Hold";
    end;

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions