Dokumentgodkendelse funktionalitet i Navision 5.0

DKK 100,00

Dokumentgodkendelse funktionalitet i Navision 5.0 SP1

Dokumentgodkendelse funktionalitet kan utilsigtet godkende og frigive en salgsordre selvom salgsordre beløbet overstiger kreditmaksimum for kunden i Microsoft Dynamics NAV 5.0 SP1 
 

Læs mere om fejlen nedenfor. Guldmedlemmer kan downloade selve hotfixen.
 
Symtoms
In Microsoft Dynamics NAV 5.0 SP1, the Document Approval functionality may automatically approve and release a sales order even if the sales order amount is more than the credit limit of the customer. This problem occurs if you use both of the following types of the approval template for the sales orders:
• Approval Limits
• Credit Limits
If you only use the Credit Limits type, this problem does not occur. 
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 informationer og download

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

Prerequisites
You must have Microsoft Dynamics NAV 5.0 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.

Applies to
• Microsoft Dynamics NAV 5.0 SP1 

 
Note Always test code fixes in a controlled environment before you apply the fixes to your production computers.
To apply this hotfix, change the code in the Approvals Management codeunit (439). To do this, follow these steps:

 
1. Remove the following global variable:
DispMessage
 
 
2. Change the code in the SendSalesApprovalRequest procedure. To do this, follow these steps:a.  Add the following new local variable, and then specify the variable as follows:
• Name: MessageType
• DataType: Option
• Option String: ,AutomaticPrePayment,AutomaticRelease,RequiresApproval
 
b.  Change the code as follows.
 
 
Existing code
...
  TemplateRec.SETCURRENTKEY("Table ID","Document Type",Enabled);
  TemplateRec.SETRANGE("Table ID",DATABASE::"Sales Header");
  TemplateRec.SETRANGE("Document Type","Document Type");
  TemplateRec.SETRANGE(Enabled,TRUE);
  IF TemplateRec.FIND('-') THEN BEGIN
    REPEAT
      IF NOT FindApproverSales(SalesHeader,ApprovalSetup,TemplateRec) THEN
        ERROR(Text010);
    UNTIL TemplateRec.NEXT = 0;
    IF DispMessage THEN
      MESSAGE(Text001,"Document Type","No.");
  END ELSE
...

Replacement code
...
  TemplateRec.SETCURRENTKEY("Table ID","Document Type",Enabled);
  TemplateRec.SETRANGE("Table ID",DATABASE::"Sales Header");
  TemplateRec.SETRANGE("Document Type","Document Type");
  TemplateRec.SETRANGE(Enabled,TRUE);
  IF TemplateRec.FIND('-') THEN BEGIN
    REPEAT
      IF NOT FindApproverSales(SalesHeader,ApprovalSetup,TemplateRec,MessageType) THEN
        ERROR(Text010);
    UNTIL TemplateRec.NEXT = 0;
    CASE MessageType OF
      MessageType::AutomaticPrePayment:MESSAGE(Text128,SalesHeader."Document Type",SalesHeader."No.");
      MessageType::AutomaticRelease:MESSAGE(Text003,SalesHeader."Document Type",SalesHeader."No.");
      MessageType::RequiresApproval: MESSAGE(Text001,"Document Type","No.");
    END;
  END ELSE
...


 
3. Change the code in the SendPurchaseApprovalRequest procedure. To do this, follow these steps:a.  Add the following new local variables:
ShowMessage@1002 : Boolean;
 
b.  Add the following new local variable, and then specify the variable as follows:
• Name: MessageType
• DataType: Option
• Option String: ,AutomaticPrePayment,AutomaticRelease,RequiresApproval

 
c.  Change the code as follows.

Existing code
...
  TemplateRec.SETCURRENTKEY("Table ID","Document Type",Enabled);
  TemplateRec.SETRANGE("Table ID",DATABASE::"Purchase Header");
  TemplateRec.SETRANGE("Document Type","Document Type");
  TemplateRec.SETRANGE(Enabled,TRUE);
  IF TemplateRec.FIND('-') THEN BEGIN
    REPEAT
      IF TemplateRec."Limit Type" = TemplateRec."Limit Type"::"Credit Limits" THEN BEGIN
        ERROR(STRSUBSTNO(Text025,FORMAT(TemplateRec."Limit Type"),FORMAT("Document Type"),
            "No."));
      END ELSE BEGIN
        IF NOT FindApproverPurchase(PurchaseHeader,ApprovalSetup,TemplateRec) THEN
          ERROR(Text010);
      END;
    UNTIL TemplateRec.NEXT = 0;
    IF DispMessage THEN
      MESSAGE(Text001,FORMAT("Document Type"),"No.");
  END ELSE
...

Replacement code
...
  TemplateRec.SETCURRENTKEY("Table ID","Document Type",Enabled);
  TemplateRec.SETRANGE("Table ID",DATABASE::"Purchase Header");
  TemplateRec.SETRANGE("Document Type","Document Type");
  TemplateRec.SETRANGE(Enabled,TRUE);
  IF TemplateRec.FIND('-') THEN BEGIN
    REPEAT
      IF TemplateRec."Limit Type" = TemplateRec."Limit Type"::"Credit Limits" THEN BEGIN
        ERROR(STRSUBSTNO(Text025,FORMAT(TemplateRec."Limit Type"),FORMAT("Document Type"),
            "No."));
      END ELSE BEGIN
        IF NOT FindApproverPurchase(PurchaseHeader,ApprovalSetup,TemplateRec,MessageType) THEN
          ERROR(Text010);
      END;
    UNTIL TemplateRec.NEXT = 0;
    CASE MessageType OF
      MessageType::AutomaticPrePayment:MESSAGE(Text128,PurchaseHeader."Document Type",PurchaseHeader."No.");
      MessageType::AutomaticRelease:MESSAGE(Text003,PurchaseHeader."Document Type",PurchaseHeader."No.");
      MessageType::RequiresApproval: MESSAGE(Text001,"Document Type","No.");
    END;
  END ELSE
...


4. Change the code in the FindApproverSales procedure. To do this, follow these steps:a.  Add a new parameter, and then specify the parameter as follows
• The Var check box is selected.
• The parameter name is MessageID.
• The date type of the parameter is Option.
• The option string is ,AutomaticPrePayment,AutomaticRelease,RequiresApproval
 
b.  Change the code as follows.
Existing code
...
  IF EntryApproved THEN
    DocReleased := ApproveApprovalRequest(ApprovalEntry);
  DispMessage := FALSE;
  IF NOT DocReleased THEN BEGIN
    SalesHeader.Status := SalesHeader.Status::"Pending Approval";
    SalesHeader.MODIFY(TRUE);
    DispMessage := TRUE;
  END;
  IF DocReleased THEN
    IF TestSalesPrepayment(SalesHeader) AND
       (SalesHeader."Document Type" = SalesHeader."Document Type"::Order) THEN BEGIN
      SalesHeader.Status := SalesHeader.Status::"Pending Prepayment";
      SalesHeader.MODIFY(TRUE);
      MESSAGE(Text128,SalesHeader."Document Type",SalesHeader."No.");
    END ELSE
      MESSAGE(Text003,SalesHeader."Document Type",SalesHeader."No.");
  EXIT(TRUE);
END;
...

Replacement code
...
  IF EntryApproved THEN
    DocReleased := ApproveApprovalRequest(ApprovalEntry);
  IF NOT DocReleased THEN BEGIN
    SalesHeader.Status := SalesHeader.Status::"Pending Approval";
    SalesHeader.MODIFY(TRUE);
    MessageID := MessageID::RequiresApproval;
  END;
  IF DocReleased THEN
    IF TestSalesPrepayment(SalesHeader) AND
       (SalesHeader."Document Type" = SalesHeader."Document Type"::Order) THEN BEGIN
      SalesHeader.Status := SalesHeader.Status::"Pending Prepayment";
      SalesHeader.MODIFY(TRUE);
      MessageID := MessageID::AutomaticPrePayment;
    END ELSE
      MessageID := MessageID::AutomaticRelease;
  EXIT(TRUE);
END;
...


 
5. Change the code in the FindApproverPurchase procedure. To do this, follow these steps:a.  Add a new parameter, and then specify the parameter as follows
• The Var check box is selected.
• The parameter name is MessageID.
• The date type of the parameter is Option.
• The option string is ,AutomaticPrePayment,AutomaticRelease,RequiresApproval
 
b.  Change the code as follows.
Existing code
...
  IF EntryApproved THEN
    DocReleased := ApproveApprovalRequest(ApprovalEntry);
  DispMessage := FALSE;
  IF NOT DocReleased THEN BEGIN
    PurchaseHeader.Status := PurchaseHeader.Status::"Pending Approval";
    PurchaseHeader.MODIFY(TRUE);
    DispMessage := TRUE;
  END;
  IF DocReleased THEN
    IF TestPurchasePrepayment(PurchaseHeader) AND
       (PurchaseHeader."Document Type" = PurchaseHeader."Document Type"::Order) THEN BEGIN
      PurchaseHeader.Status := PurchaseHeader.Status::"Pending Prepayment";
      PurchaseHeader.MODIFY(TRUE);
      MESSAGE(Text128,PurchaseHeader."Document Type",PurchaseHeader."No.");
    END ELSE BEGIN
      MESSAGE(Text003,PurchaseHeader."Document Type",PurchaseHeader."No.");
    END;
...

Replacement code
...
  IF EntryApproved THEN
    DocReleased := ApproveApprovalRequest(ApprovalEntry);
  IF NOT DocReleased THEN BEGIN
    PurchaseHeader.Status := PurchaseHeader.Status::"Pending Approval";
    PurchaseHeader.MODIFY(TRUE);
    MessageID := MessageID::RequiresApproval;
  END;
  IF DocReleased THEN
    IF TestPurchasePrepayment(PurchaseHeader) AND
       (PurchaseHeader."Document Type" = PurchaseHeader."Document Type"::Order) THEN BEGIN
      PurchaseHeader.Status := PurchaseHeader.Status::"Pending Prepayment";
      PurchaseHeader.MODIFY(TRUE);
      MessageID := MessageID::AutomaticPrePayment;
    END ELSE BEGIN
      MessageID := MessageID::AutomaticRelease;
    END;
...