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
• Approval Limits
• Credit Limits
Installation information
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.
• 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.
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.
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;
...