InstallationMicrosoft Dynamics NAV Changes

Microsoft Dynamics NAV Changes

Code Changes on Standard Objects

In this chapter an overview of the code changes made to the standard NAV objects that have been changed by Sana Commerce is given. Note, that these changes are also included in the Sana Commerce fob files, therefore these changes only have to be made manually, when other third party components are installed in the same objects.
 
Codeunit 1 - Application management 
 
New global variable: 
Name Type Subtype
SCLNAS Codeunit SCL - NAS Message Handler 
 
NASHandler method
New local variable:
Name Type Subtype
SCLOptions Record SCL - Options
 
 
The NASHandler method code changes:
 
After the following line of code in the NASHandler method:
    IF CGNASStartedinLoop = FALSE THEN

Add the following line:
    SCLOptions.GET('SCL');

After this block of code in the NASHandler method:
   CASE Parameter OF
     'OSYNCH','JOBQUEUE':
        BEGIN
          IF NOT JobQueueSetup.GET THEN BEGIN
            JobQueueSetup.INIT;
            JobQueueSetup.INSERT;
        END;
         IF NOT JobQueueSetup."Job Queue Active" THEN BEGIN
           JobQueueSetup.VALIDATE("Job Queue Active",TRUE);
           JobQueueSetup.MODIFY;
        END;
        CODEUNIT.RUN(CODEUNIT::"Job Queue Dispacher");
     END;
 
Add the following lines: 
      'SCL':
      BEGIN
       SCLNAS.SetConnectionOptions(SCLOptions.SingleServicePort,SCLOptions.SingleServiceSecure);
       SCLNAS.RUN;
      END;
 
      'SCLCATALOG':
      BEGIN
       SCLNAS.SetConnectionOptions(SCLOptions.CatalogServicePort,SCLOptions.CatalogServiceSecure);
       SCLNAS.RUN;
      END;
    
      'SCLCUSTOMER':
      BEGIN
       SCLNAS.SetConnectionOptions(SCLOptions.CustomerServicePort,SCLOptions.CustomerServiceSecure);
       SCLNAS.RUN;
      END;
 
      'SCLORDER':
      BEGIN
       SCLNAS.SetConnectionOptions(SCLOptions.OrderServicePort,SCLOptions.OrderServiceSecure);
       SCLNAS.RUN;
      END;
  
Table 27 - Item 
 
Function Code
Field 11123303 "Main Navigation Code" - OnLookup VAR
  SCLNavigationForm : Form 11123308;
BEGIN
  CLEAR(SCLNavigationForm);
  IF "Main Navigation Code" <> '' THEN
    SCLNavigationForm.SetCurrentCode("Main Navigation Code");
  SCLNavigationForm.LOOKUPMODE := TRUE;
  IF SCLNavigationForm.RUNMODAL = ACTION::LookupOK THEN
    "Main Navigation Code" := SCLNavigationForm.GetCurrentCode;
END;
OnModify() "Scl Last Date Modified" := CURRENTDATETIME; // 03/25/2010,SCL
UpdateSCLastDateModified() //START,03/25/2010,SCL
"SC Last Date Modified" := CURRENTDATETIME;
MODIFY;
//END,03/25/2010,SCL
 
Table 30 - Item Translation
 
Function Code
OnInsert() //START,03/25/2010,SCL
IF Item.GET("Item No.") THEN
  Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
OnModify() //START,03/25/2010,SCL
IF Item.GET("Item No.") THEN
  Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
OnDelete() //START,03/25/2010,SCL
IF Item.GET("Item No.") THEN
  Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
 
Table 37 - Sales Line
 
New global variables: 
Name Type
TemporarySalesHeaderUsed Bool
DoNotUpdateUnitPrice Bool
DoNotCheckItemAvailability Bool
 
New methods: 
SetTemporarySalesHeader(useTemporarySalesHeader : Boolean)
TemporarySalesHeaderUsed := useTemporarySalesHeader;
 
IsTemporarySalesHeader() : Boolean
EXIT(TemporarySalesHeaderUsed);
 
SetDoNotUpdateUnitPrice(UpdateUnitPrice : Boolean)
DoNotUpdateUnitPrice := UpdateUnitPrice;
 
SetDoNotCheckItmeAvailability(CheckItemAvailability : Boolean)
DoNotCheckItemAvailability := CheckItemAvailability;
 
Changed methods: 
Method Code changes
Field 6 No. - onValidate Change:
SalesHeader.GET("Document Type","Document No.");
 
To:
IF SalesHeader.GET("Document Type","Document No.") THEN BEGIN
//  SalesHeader.GET("Document Type","Document No.");

END;
CalcVatAmountLines Change:
  IF SalesSetup."Invoice Rounding" THEN BEGIN
    SalesLine3.COPYFILTERS(SalesLine);
    RoundingLineInserted := (SalesLine3.COUNT <> SalesLine.COUNT) AND NOT SalesLine."Prepayment Line";
  END;
 
To:
  IF SalesSetup."Invoice Rounding" THEN BEGIN
    SalesLine3.COPYFILTERS(SalesLine);
    RoundingLineInserted := (SalesLine3.COUNT <> SalesLine.COUNT) AND NOT SalesLine."Prepayment Line";
    IF IsTemporarySalesHeader() THEN
      RoundingLineInserted := FALSE;
  END;
PfsCreatePrepackLines Change:
IF (NOT CombinedWarning) AND (PrepackValue <> 0) THEN
    CombinedWarning := PfsMatrixControl.CombineItemCheckAvail(TargetRec);
 
To:
IF (NOT PfsCalledFromReplacement) AND (NOT CombinedWarning) AND (PrepackValue <> 0) THEN
    CombinedWarning := PfsMatrixControl.CombineItemCheckAvail(TargetRec);
 
Added code to the methods:
Method Code
UpdateUnitPrice //START,10/20/2009,SCL
IF DoNotUpdateUnitPrice THEN
  EXIT;
//END,10/20/2009,SCL
CheckItemAvailable //START,10/20/2009,SCL
IF DoNotCheckItemAvailability THEN
  EXIT;
//END,10/20/2009,SCL
 
Table 5715 - Item Substitution
 
Function Code
OnInsert() //START,03/25/2010,SCL
IF Type = Type::Item THEN
  IF Item.GET("No.") THEN
    Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
OnModify() //START,03/25/2010,SCL
IF Type = Type::Item THEN
  IF Item.GET("No.") THEN
    Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
OnDelete() IF Interchangeable THEN
  IF CONFIRM(Text001 + Text002) THEN
    DeleteInterchangeableItem(Type,"No.","Variant Code","Substitute Type","Substitute No.","Substitute Variant Code")
  ELSE
    IF ItemSub.GET(
      "Substitute Type",
      "Substitute No.",
      "Substitute Variant Code",
      Type,
      "No.",
      "Variant Code")
    THEN BEGIN
      ItemSub.Interchangeable := FALSE;
      //START,03/25/2010,SCL
      //ItemSub.MODIFY;
      ItemSub.MODIFY(TRUE);
      //END,03/25/2010,SCL
    END;
...
//START,03/25/2010,SCL
IF Type = Type::Item THEN
  IF Item.GET("No.") THEN
    Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
 
Table 5722 - Item Category
 
New text constant:
Name ConstValue
Text001 You cannot delete %1 because there are one or more items that include this item category.
 
Function Code
OnDelete()
...
//START,03/25/2010,SCL
Item.RESET;
Item.SETCURRENTKEY("Item Category Code","Product Group Code");
Item.SETRANGE("Item Category Code",Code);
IF NOT Item.ISEMPTY THEN
  ERROR(Text001,Code);
//END,03/25/2010,SCL
OnRename() //START,03/25/2010,SCL
Item.RESET;
Item.SETCURRENTKEY("Item Category Code","Product Group Code");
Item.SETRANGE("Item Category Code",xRec.Code);
IF Item.FINDSET THEN
  REPEAT
    Item.UpdateSclLastDateModified;
  UNTIL Item.NEXT = 0;
//END,03/25/2010,SCL
 
Table 5723 - Product Group
 
New text constant:
Name ConstValue
Text001 You cannot delete %1 because there are one or more items that include this product group.
 
Function Code
OnDelete() //START,03/25/2010,SCL
Item.RESET;
Item.SETCURRENTKEY("Item Category Code","Product Group Code");
Item.SETRANGE("Item Category Code","Item Category Code");
Item.SETRANGE("Product Group Code",Code);
IF NOT Item.ISEMPTY THEN
  ERROR(Text001,Code);
//END,03/25/2010,SCL
OnRename() //START,03/25/2010,SCL
Item.RESET;
Item.SETCURRENTKEY("Item Category Code","Product Group Code");
Item.SETRANGE("Item Category Code","Item Category Code");
Item.SETRANGE("Product Group Code",xRec.Code);
IF Item.FINDSET THEN
  REPEAT
    Item.UpdateSclLastDateModified;
  UNTIL Item.NEXT = 0;
//END,03/25/2010,SCL

Table 7002 - Sales Price
 
Function Code
OnInsert() ...
//START,03/25/2010,SCL
IF Item.GET("Item No.") THEN
  Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
OnModify() //START,03/25/2010,SCL
IF Item.GET("Item No.") THEN
  Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
OnDelete() //START,03/25/2010,SCL
IF Item.GET("Item No.") THEN
  Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
 
Form(Page) 41 - Sales Quote
 
New global variable:
Name Type
SanaCustomerNo Text[50]
 
Function Code
Form - OnAfterGetRecord() ...
//START,17/03/2010,SCL
IF "Sell-to Customer No." <> '' THEN
  IF Customer.GET("Sell-to Customer No.") THEN
    SanaCustomerNo := Customer."Sana Customer No.";
//END,17/03/2010,SCL
 
Form(Page) 42 - Sales Order
 
New global variable:
Name Type
SanaCustomerNo Text[50]
 
Function Code
Form - OnAfterGetRecord() ...
//START,17/03/2010,SCL
IF "Sell-to Customer No." <> '' THEN
  IF Customer.GET("Sell-to Customer No.") THEN
    SanaCustomerNo := Customer."Sana Customer No.";
//END,17/03/2010,SCL
 
Form(Page) 5401 - Item Variants
 
New procedure added:
Function Code
UpdateItemDate() //START,03/25/2010,SCL
IF Item.GET("Item No.") THEN
  Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
Form - OnInsertRecord(BelowxRec : Boolean) : Boolean UpdateItemDate; //03/25/2010,SCL
Form - OnModifyRecord() : Boolean UpdateItemDate; //03/25/2010,SCL
 
 
Pebblestone Fashion module specific change
 
Table 11006173 - PfsTranslation
 
New procedure added:
Function Code
UpdateItem() //START,03/25/2010,SCL
IF Table = DATABASE::Item THEN
  IF Item.GET("Key 1") THEN
    Item.UpdateSclLastDateModified;
IF Table = DATABASE::"PfsItem Vert Component" THEN
  IF Item.GET("Key 1") THEN
    Item.UpdateSclLastDateModified;
IF Table = DATABASE::"PfsItem Horz Component" THEN
  IF Item.GET("Key 1") THEN
    Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
OnInsert() UpdateItem; //03/25/2010,SCL
OnModify() UpdateItem; //03/25/2010,SCL
OnDelete() UpdateItem; //03/25/2010,SCL

Form(Page) 11006110 - PfsItem Vert components
 
New procedure added:
Function Code
UpdateItemDate() //START,03/25/2010,SCL
IF Item.GET("Item No.") THEN
  Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
Form - OnInsertRecord(BelowxRec : Boolean) : Boolean UpdateItemDate; //03/25/2010,SCL
Form - OnModifyRecord() : Boolean UpdateItemDate; //03/25/2010,SCL
Form - OnDeleteRecord() : Boolean UpdateItemDate; //03/25/2010,SCL
 
Form(Page) 11006111 - PfsItem Horz components
 
New procedure added:
Function Code
UpdateItemDate() //START,03/25/2010,SCL
IF Item.GET("Item No.") THEN
  Item.UpdateSclLastDateModified;
//END,03/25/2010,SCL
Form - OnInsertRecord(BelowxRec : Boolean) : Boolean UpdateItemDate; //03/25/2010,SCL
Form - OnModifyRecord() : Boolean UpdateItemDate; //03/25/2010,SCL
Form - OnDeleteRecord() : Boolean UpdateItemDate; //03/25/2010,SCL

 
NAV 2009 SP1 (Standard or PFS) specific change
 
Table 37 - Sales Line
 
The CalcVATAmountLines method code changes:
Method Code
CalcVATAmountLines IF SalesSetup."Invoice Rounding" THEN BEGIN
   //START,12/21/2009,SCL
   CustPostingGroup.GET(SalesHeader."Customer Posting Group");
   //Original code is commented
   //Cust.GET(SalesHeader."Bill-to Customer No.");
   //CustPostingGroup.GET(Cust."Customer Posting Group");
   //END,12/21/2009,SCL
 END;
InstallationMicrosoft Dynamics NAV Changes