The system does not clean the customer bill card reference from the original invoice when you apply a Dishonored transaction in the Italian version of Microsoft Dynamics NAV 5.0 Service Pack 1

This article applies to Microsoft Dynamics NAV for the Italian (it) language locale.

Symptoms

Consider the following scenario in the Italian version of Microsoft Dynamics NAV 5.0 Service Pack 1 (SP1):
  • You apply a Dishonored transaction.
  • You post the transaction to a corresponding issued bank receipt.
  • You set the payment as an applying entry instead of the dishonored posted transaction.
In this scenario, the system does not clean the customer bill card reference from the original invoice.

Resolution

Hotfix information

A supported hotfix is now available from Microsoft. However, it is only intended to correct the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft Dynamics NAV 5.0 service pack or the next Microsoft Dynamics NAV version that contains this hotfix.

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Technical Support Professional for Microsoft Dynamics and related products determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.




Installation information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Note Before you install this hotfix, verify that all Microsoft Navision client users are logged off the system. This includes Microsoft Navision Application Services (NAS) client users. You should be the only client user who is logged on when you implement this hotfix.

To implement this hotfix, you must have a developer license.

We recommend that the user account in the Windows Logins window or in the Database Logins window be assigned the "SUPER" role ID. If the user account cannot be assigned the "SUPER" role ID, you must verify that the user account has the following permissions:
  • The Modify permission for the object that you will be changing.
  • The Execute permission for the System Object ID 5210 object and for the System Object ID 9015 object.


Note You do not have to have rights to the data stores unless you have to perform data repair.

Code changes

Note Always test code fixes in a controlled environment before you apply the fixes to your production computers.
To resolve this problem, follow these steps:
  1. Change the code in the CustPostApplyCustLedgEntry function in the Gen. Jnl.-Post Line codeunit (12) as follows:
    Existing code
    ...
    CVLedgEntryBuf,DtldCVLedgEntryBuf,GenJnlLine,GLSetup."Appln. Rounding Precision");
    TransferCustLedgEntry(CVLedgEntryBuf,CustLedgEntry,FALSE);
    CustLedgEntry.MODIFY;

    // Delete the following line.
    IF (CustLedgEntry."Document Type" = CustLedgEntry."Document Type"::Dishonored) THEN

    ApplyBill(CustLedgEntry,OldCustLedgEntry);

    PostDtldCustLedgEntries(
    ...
    Replacement code
    ...
    CVLedgEntryBuf,DtldCVLedgEntryBuf,GenJnlLine,GLSetup."Appln. Rounding Precision");
    TransferCustLedgEntry(CVLedgEntryBuf,CustLedgEntry,FALSE);
    CustLedgEntry.MODIFY;

    // Add the following lines.
    IF (CustLedgEntry."Document Type" = CustLedgEntry."Document Type"::Dishonored) OR
    (CustLedgEntry."Document Type" = CustLedgEntry."Document Type"::Payment) THEN
    // End of the lines.

    ApplyBill(CustLedgEntry,OldCustLedgEntry);

    PostDtldCustLedgEntries(
    ...
  2. Change the code in the UnapplyCustLedgEntry function in the Gen. Jnl.-Post Line codeunit (12) as follows:
    Existing code 1
    ...
    CreditAddjustment@1016 : Decimal;
    CreditAddjustmentAddCurr@1015 : Decimal;
    OldCustLedgEntry@1130000 : Record 21;

    // Delete the following line.
    BEGIN

    GenJnlLine.TRANSFERFIELDS(GenJnlLine2);
    IF GenJnlLine."Document Date" = 0D THEN
    GenJnlLine."Document Date" := GenJnlLine."Posting Date";
    ...
    Replacement code 1
    ...
    CreditAddjustment@1016 : Decimal;
    CreditAddjustmentAddCurr@1015 : Decimal;
    OldCustLedgEntry@1130000 : Record 21;

    // Add the following lines.
    UnAppliedBill@1130001 : Boolean;
    BEGIN
    UnAppliedBill := FALSE;
    // End of the lines.

    GenJnlLine.TRANSFERFIELDS(GenJnlLine2);
    IF GenJnlLine."Document Date" = 0D THEN
    GenJnlLine."Document Date" := GenJnlLine."Posting Date";
    ...
    Existing code 2
    ...
    IF DtldCustLedgEntry2."Entry Type" = DtldCustLedgEntry2."Entry Type"::Application THEN BEGIN
    CustLedgEntry.GET(DtldCustLedgEntry2."Cust. Ledger Entry No.");

    // Delete the following lines.
    IF (CustLedgEntry."Document Type" = CustLedgEntry."Document Type"::Dishonored) THEN
    UnApplyBill(CustLedgEntry,OldCustLedgEntry);
    // End of the lines.

    CustLedgEntry."Remaining Pmt. Disc. Possible" := DtldCustLedgEntry2."Remaining Pmt. Disc. Possible";
    CustLedgEntry."Max. Payment Tolerance" := DtldCustLedgEntry2."Max. Payment Tolerance";
    CustLedgEntry."Accepted Payment Tolerance" := 0;
    ...
    Replacement code 2
    ...
    IF DtldCustLedgEntry2."Entry Type" = DtldCustLedgEntry2."Entry Type"::Application THEN BEGIN
    CustLedgEntry.GET(DtldCustLedgEntry2."Cust. Ledger Entry No.");

    // Add the following lines.
    IF ((CustLedgEntry."Document Type" = CustLedgEntry."Document Type"::Dishonored) OR
    (CustLedgEntry."Document Type" = CustLedgEntry."Document Type"::Payment)) AND
    NOT UnAppliedBill
    THEN BEGIN
    UnApplyBill(CustLedgEntry,OldCustLedgEntry);
    UnAppliedBill := TRUE;
    END;
    // End of the lines.

    CustLedgEntry."Remaining Pmt. Disc. Possible" := DtldCustLedgEntry2."Remaining Pmt. Disc. Possible";
    CustLedgEntry."Max. Payment Tolerance" := DtldCustLedgEntry2."Max. Payment Tolerance";
    CustLedgEntry."Accepted Payment Tolerance" := 0;
    ...
  3. Change the code in the ApplyBill function in the Gen. Jnl.-Post Line codeunit (12) as follows:
    Existing code 1
    ...
    END;

    PROCEDURE ApplyBill@1130004(VAR NewCustLedgEntry@1130001 : Record 21;VAR OldCustLedgEntry@1130000 : Record 21);

    // Delete the following lines.
    VAR
    OldCustLedgEntry2@1130002 : Record 21;
    DetCustLedgEntry@1130003 : Record 379;
    BEGIN
    OldCustLedgEntry.RESET;
    OldCustLedgEntry.SETCURRENTKEY("Closed by Entry No.");
    OldCustLedgEntry.SETRANGE("Closed by Entry No.",NewCustLedgEntry."Entry No.");
    IF OldCustLedgEntry.FIND('-') THEN
    REPEAT
    OldCustLedgEntry2.SETCURRENTKEY("Document Type","Document No.","Document Occurrence","Customer No.",Open);
    OldCustLedgEntry2.SETRANGE("Document Type",OldCustLedgEntry."Document Type to Close");
    OldCustLedgEntry2.SETRANGE("Document No.",OldCustLedgEntry."Document No. to Close");
    OldCustLedgEntry2.SETRANGE("Document Occurrence",OldCustLedgEntry."Document Occurrence to Close");
    OldCustLedgEntry2.SETRANGE("Customer No.",OldCustLedgEntry."Customer No.");
    OldCustLedgEntry2.SETRANGE(Open,TRUE);
    IF OldCustLedgEntry2.FIND('-') THEN BEGIN
    OldCustLedgEntry."Bank Receipt Issued" := OldCustLedgEntry2."Bank Receipt Issued";
    OldCustLedgEntry."Bank Receipt Temp. No." := OldCustLedgEntry2."Bank Receipt Temp. No.";
    OldCustLedgEntry."Bank Receipts List No." := OldCustLedgEntry2."Bank Receipts List No.";
    OldCustLedgEntry."Customer Bill No." := OldCustLedgEntry2."Customer Bill No.";
    OldCustLedgEntry.MODIFY;

    OldCustLedgEntry2."Bank Receipt Issued" := FALSE;
    OldCustLedgEntry2."Bank Receipt Temp. No." := '';
    OldCustLedgEntry2."Bank Receipts List No." := '';
    OldCustLedgEntry2."Customer Bill No." := '';
    OldCustLedgEntry2."Allow Issue" := FALSE;
    OldCustLedgEntry2.MODIFY;

    DetCustLedgEntry.SETCURRENTKEY("Cust. Ledger Entry No.","Entry Type","Posting Date");
    DetCustLedgEntry.SETRANGE("Cust. Ledger Entry No.",OldCustLedgEntry2."Entry No.");
    DetCustLedgEntry.SETRANGE("Entry Type",DetCustLedgEntry."Entry Type" :: "Initial Entry");
    IF DetCustLedgEntry.FIND('-') THEN BEGIN
    DetCustLedgEntry."Bank Receipt Issued" := FALSE;
    DetCustLedgEntry.MODIFY;
    END;
    END;
    UNTIL OldCustLedgEntry.NEXT = 0;
    // End of the lines.

    END;

    PROCEDURE SetCheckDim@1130005(CheckDimTmp@1130000 : Boolean);
    ...
    Replacement code 1
    ...
    END;

    PROCEDURE ApplyBill@1130004(VAR NewCustLedgEntry@1130001 : Record 21;VAR OldCustLedgEntry@1130000 : Record 21);

    // Add the following lines.
    BEGIN
    IF NewCustLedgEntry."Document Type" = NewCustLedgEntry."Document Type"::Dishonored THEN BEGIN
    OldCustLedgEntry.RESET;
    OldCustLedgEntry.SETCURRENTKEY("Closed by Entry No.");
    OldCustLedgEntry.SETRANGE("Closed by Entry No.",NewCustLedgEntry."Entry No.");
    IF OldCustLedgEntry.FINDSET THEN
    REPEAT
    HandleApplyBill(OldCustLedgEntry,FALSE);
    UNTIL OldCustLedgEntry.NEXT = 0;
    END ELSE
    IF NOT NewCustLedgEntry.Open THEN
    HandleApplyBill(NewCustLedgEntry,FALSE);
    // End of the lines.

    END;

    PROCEDURE SetCheckDim@1130005(CheckDimTmp@1130000 : Boolean);
    ...
    Existing code 2
    ...
    END;

    PROCEDURE UnApplyBill@1130006(VAR NewCustLedgEntry@1130001 : Record 21;VAR OldCustLedgEntry@1130000 : Record 21);

    // Delete the following lines.
    VAR
    OldCustLedgEntry2@1130002 : Record 21;
    DetCustLedgEntry@1130003 : Record 379;
    BEGIN
    OldCustLedgEntry.RESET;
    OldCustLedgEntry.SETCURRENTKEY("Closed by Entry No.");
    OldCustLedgEntry.SETRANGE("Closed by Entry No.",NewCustLedgEntry."Entry No.");
    IF OldCustLedgEntry.FIND('-') THEN
    REPEAT
    OldCustLedgEntry2.SETCURRENTKEY("Document Type","Document No.","Document Occurrence","Customer No.",Open);
    OldCustLedgEntry2.SETRANGE("Document Type",OldCustLedgEntry."Document Type to Close");
    OldCustLedgEntry2.SETRANGE("Document No.",OldCustLedgEntry."Document No. to Close");
    OldCustLedgEntry2.SETRANGE("Document Occurrence",OldCustLedgEntry."Document Occurrence to Close");
    OldCustLedgEntry2.SETRANGE("Customer No.",OldCustLedgEntry."Customer No.");
    OldCustLedgEntry2.SETRANGE(Open,TRUE);
    IF OldCustLedgEntry2.FIND('-') THEN BEGIN
    OldCustLedgEntry2."Bank Receipt Issued" := OldCustLedgEntry."Bank Receipt Issued";
    OldCustLedgEntry2."Bank Receipt Temp. No." := OldCustLedgEntry."Bank Receipt Temp. No.";
    OldCustLedgEntry2."Bank Receipts List No." := OldCustLedgEntry."Bank Receipts List No.";
    OldCustLedgEntry2."Customer Bill No." := OldCustLedgEntry."Customer Bill No.";
    OldCustLedgEntry2."Allow Issue" := TRUE;
    OldCustLedgEntry2.MODIFY;

    OldCustLedgEntry."Bank Receipt Issued" := FALSE;
    OldCustLedgEntry."Bank Receipt Temp. No." := '';
    OldCustLedgEntry."Bank Receipts List No." := '';
    OldCustLedgEntry."Customer Bill No." := '';
    OldCustLedgEntry.MODIFY;

    DetCustLedgEntry.SETCURRENTKEY("Cust. Ledger Entry No.","Entry Type","Posting Date");
    DetCustLedgEntry.SETRANGE("Cust. Ledger Entry No.",OldCustLedgEntry2."Entry No.");
    DetCustLedgEntry.SETRANGE("Entry Type",DetCustLedgEntry."Entry Type" :: "Initial Entry");
    IF DetCustLedgEntry.FIND('-') THEN BEGIN
    DetCustLedgEntry."Bank Receipt Issued" := TRUE;
    DetCustLedgEntry.MODIFY;
    END;
    END;
    UNTIL OldCustLedgEntry.NEXT = 0;
    // End of the lines.

    END;
    ...
    Replacement code 2
    ...
    END;

    PROCEDURE UnApplyBill@1130006(VAR NewCustLedgEntry@1130001 : Record 21;VAR OldCustLedgEntry@1130000 : Record 21);

    // Add the following lines.
    BEGIN
    IF NewCustLedgEntry."Document Type" = NewCustLedgEntry."Document Type"::Dishonored THEN BEGIN
    OldCustLedgEntry.RESET;
    OldCustLedgEntry.SETCURRENTKEY("Closed by Entry No.");
    OldCustLedgEntry.SETRANGE("Closed by Entry No.",NewCustLedgEntry."Entry No.");
    IF OldCustLedgEntry.FINDSET THEN
    REPEAT
    HandleApplyBill(OldCustLedgEntry,TRUE);
    UNTIL OldCustLedgEntry.NEXT = 0;
    END ELSE
    HandleApplyBill(NewCustLedgEntry,TRUE);
    // End of the lines.

    END;
    ...
  4. Change the code of the Documentation in the Gen. Jnl.-Post Line codeunit (12) as follows:
    Existing code
    ...
    END;

    BEGIN
    END.
    }
    }
    ...
    Replacement code
    ...
    END;

    // Add the following lines.
    LOCAL PROCEDURE HandleApplyBill@1130007(VAR CustLedgEntry@1130001 : Record 21;IsUnApply@1130000 : Boolean);
    VAR
    OldCustLedgEntry2@1130002 : Record 21;
    DetCustLedgEntry@1130003 : Record 379;
    BEGIN
    OldCustLedgEntry2.SETCURRENTKEY("Document Type","Document No.","Document Occurrence","Customer No.",Open);
    OldCustLedgEntry2.SETRANGE("Document Type",CustLedgEntry."Document Type to Close");
    OldCustLedgEntry2.SETRANGE("Document No.",CustLedgEntry."Document No. to Close");
    OldCustLedgEntry2.SETRANGE("Document Occurrence",CustLedgEntry."Document Occurrence to Close");
    OldCustLedgEntry2.SETRANGE("Customer No.",CustLedgEntry."Customer No.");
    OldCustLedgEntry2.SETRANGE(Open,TRUE);
    IF IsUnApply THEN BEGIN
    IF OldCustLedgEntry2.FINDFIRST AND CustLedgEntry."Bank Receipt Issued" THEN BEGIN
    OldCustLedgEntry2."Bank Receipt Issued" := CustLedgEntry."Bank Receipt Issued";
    OldCustLedgEntry2."Bank Receipt Temp. No." := CustLedgEntry."Bank Receipt Temp. No.";
    OldCustLedgEntry2."Bank Receipts List No." := CustLedgEntry."Bank Receipts List No.";
    OldCustLedgEntry2."Customer Bill No." := CustLedgEntry."Customer Bill No.";
    OldCustLedgEntry2."Allow Issue" := TRUE;
    OldCustLedgEntry2.MODIFY;

    CustLedgEntry."Bank Receipt Issued" := FALSE;
    CustLedgEntry."Bank Receipt Temp. No." := '';
    CustLedgEntry."Bank Receipts List No." := '';
    CustLedgEntry."Customer Bill No." := '';
    CustLedgEntry.MODIFY;

    DetCustLedgEntry.SETCURRENTKEY("Cust. Ledger Entry No.","Entry Type","Posting Date");
    DetCustLedgEntry.SETRANGE("Cust. Ledger Entry No.",OldCustLedgEntry2."Entry No.");
    DetCustLedgEntry.SETRANGE("Entry Type",DetCustLedgEntry."Entry Type" :: "Initial Entry");
    IF DetCustLedgEntry.FINDFIRST THEN BEGIN
    DetCustLedgEntry."Bank Receipt Issued" := TRUE;
    DetCustLedgEntry.MODIFY;
    END;
    END;
    END ELSE BEGIN
    IF OldCustLedgEntry2.FINDFIRST THEN BEGIN
    CustLedgEntry."Bank Receipt Issued" := OldCustLedgEntry2."Bank Receipt Issued";
    CustLedgEntry."Bank Receipt Temp. No." := OldCustLedgEntry2."Bank Receipt Temp. No.";
    CustLedgEntry."Bank Receipts List No." := OldCustLedgEntry2."Bank Receipts List No.";
    CustLedgEntry."Customer Bill No." := OldCustLedgEntry2."Customer Bill No.";
    CustLedgEntry.MODIFY;

    OldCustLedgEntry2."Bank Receipt Issued" := FALSE;
    OldCustLedgEntry2."Bank Receipt Temp. No." := '';
    OldCustLedgEntry2."Bank Receipts List No." := '';
    OldCustLedgEntry2."Customer Bill No." := '';
    OldCustLedgEntry2."Allow Issue" := FALSE;
    OldCustLedgEntry2.MODIFY;

    DetCustLedgEntry.SETCURRENTKEY("Cust. Ledger Entry No.","Entry Type","Posting Date");
    DetCustLedgEntry.SETRANGE("Cust. Ledger Entry No.",OldCustLedgEntry2."Entry No.");
    DetCustLedgEntry.SETRANGE("Entry Type",DetCustLedgEntry."Entry Type" :: "Initial Entry");
    IF DetCustLedgEntry.FINDFIRST THEN BEGIN
    DetCustLedgEntry."Bank Receipt Issued" := FALSE;
    DetCustLedgEntry.MODIFY;
    END;
    END;
    END;
    END;
    // End of the lines.

    BEGIN
    END.
    }
    }
    ...

Prerequisites

You must have the Italian version of Microsoft Dynamics NAV 5.0 Service Pack 1 installed to apply this hotfix.

Removal information

You cannot remove this hotfix.

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 2620728 - Last Review: Oct 19, 2011 - Revision: 1

Microsoft Dynamics NAV 5.0 Service Pack 1

Feedback