ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Moving code from NAVBE localization to an extension

Open BertDeTemmerman opened this issue 8 years ago • 6 comments

We created enhancements for a standard NAV BE localization functionality called CODA (processing of electronic bank statements) by modifying and supplementing the standard NAV code. This enhancement is necessary since the standard NAV functionality is too limited for our customers. Now we want to move our code into an extension.

Since there is no possibility to make use of events (because there aren’t any publishers), it’s impossible to move our enhancements to an extension.

These enhancements occur in Codeunit 2000042 Post Coded Bank Statement. (There are also other enhancements related to the CODA processing, but these are possible to create in table- and pageextensions and via events.)

There we added changes like:

WITH CodBankStmtLine DO BEGIN
        CASE "Type Standard Format Message" OF
           ...
          //103:  //TFS4292 
          103,111,114,121 :  //TFS4292 
           BEGIN
              DecodeNumber;
              CodeFound := TRUE
            END;
           ...

But specially more search options for the correct Customer Ledger Entry to equalize the payment with the CLE in NAV.

Other enhancements are like:

    LOCAL PROCEDURE SearchCustomer@1010022() : Boolean;
    VAR
      CustBankAcc@1011000 : Record 287;
      DomiciliationNo@1011001 : Text[12];
      BankAccNo@1011002 : Text[30];
    BEGIN
      CLEAR(Cust);
      WITH CodBankStmtLine DO BEGIN
        IF "Type Standard Format Message" = 107 THEN BEGIN
          IF Cust.SETCURRENTKEY("Domiciliation No.") THEN;
          DomiciliationNo := COPYSTR("Statement Message",1,12);
          Cust.SETRANGE("Domiciliation No.",DomiciliationNo);
          EXIT(Cust.FINDFIRST);
        END ELSE
          IF "Bank Account No. Other Party" <> '' THEN BEGIN
            CLEAR(CustBankAcc);
            //TFS4292 Start Try to find customer based on IBAN No
            IF COPYSTR("Bank Account No. Other Party",1,1) IN ['A'..'Z','a'..'z'] THEN BEGIN
              IF CustBankAcc.SETCURRENTKEY(IBAN) THEN ;
              CustBankAcc.SETRANGE(IBAN,"Bank Account No. Other Party");
              IF NOT CustBankAcc.FINDFIRST THEN BEGIN
                BankAccNo :=
                  COPYSTR("Bank Account No. Other Party",1,4) +
                  ' ' + COPYSTR("Bank Account No. Other Party",5,4) +
                  ' ' + COPYSTR("Bank Account No. Other Party",9,4) +
                  ' ' + COPYSTR("Bank Account No. Other Party",13,4);
                CustBankAcc.SETRANGE(IBAN,BankAccNo);
                IF NOT CustBankAcc.FINDFIRST THEN
                  IF CodedTrans."Account Type" = CodedTrans."Account Type"::Customer THEN
                    CustBankAcc."Customer No." := CodedTrans."Account No.";
              END;
            END ELSE BEGIN
            //TFS4292 Stop
            // It would be nice to have an index, but we can search without
            // The semicolon after THEN does matter
            IF CustBankAcc.SETCURRENTKEY("Bank Account No.") THEN;
            CustBankAcc.SETRANGE("Bank Account No.","Bank Account No. Other Party");

            // Maybe the bank account no is formatted xxx-xxxxxxx-xx
            IF NOT CustBankAcc.FINDFIRST THEN BEGIN
              BankAccNo :=
                COPYSTR("Bank Account No. Other Party",1,3) +
                '-' + COPYSTR("Bank Account No. Other Party",4,7) +
                '-' + COPYSTR("Bank Account No. Other Party",11,2);
              CustBankAcc.SETRANGE("Bank Account No.",BankAccNo);
              IF NOT CustBankAcc.FINDFIRST THEN
                IF CodedTrans."Account Type" = CodedTrans."Account Type"::Customer THEN
                  CustBankAcc."Customer No." := CodedTrans."Account No.";
              //TFS4292 Start
              END;
              //TFS4292 Stop
            END;
            EXIT(Cust.GET(CustBankAcc."Customer No."));
          END;
      END;
    END;

Adding these enhancements on the normal insert/modify events of CodBankStmtLine, is near impossible. Much code would have to be copied from standard NAV BE in order to get the desired functionality.

So possible solutions are: A) We rework these enhancements with normal insert/modify events and after the standard NAV BE code has run. But this is a humongous work. B) MS adds events to these functions and we rework these enhancements with events. Which is still a large work. C) We copy the standard NAV BE objects that work around this codeunit and modify them within our own application as new objects. This leads to creation of code and object duplication and losing touch with standard NAV BE upgrades. D) MS BE reworks this codeunit with our enhancements.

Any thoughts?

BertDeTemmerman avatar Mar 02 '18 08:03 BertDeTemmerman

Hi @SirBETE , MSFT has a 5th option in mind. How can we discuss it?

AndreiPanko avatar May 18 '18 16:05 AndreiPanko

Can you share the 5th option?

fvet avatar Jun 01 '18 13:06 fvet

If there is a reasonable code suggestion we are ready to add it to the standard product. We have a framework for it. So it's a kind of modification of option D.

AndreiPanko avatar Jun 01 '18 14:06 AndreiPanko

Sorry, I completely lost this thread out of sight. I'm forwarding this thread to the relevant consultant, so we can discuss it internally.

Meanwhile we have chosen for option C.

BertDeTemmerman avatar Jun 04 '18 06:06 BertDeTemmerman

You can contact me directly by mail: [email protected]

AndreiPanko avatar Jun 08 '18 07:06 AndreiPanko

Closing issue, as the issue seems to have been taken "offline".

JesperSchulz avatar Nov 02 '18 09:11 JesperSchulz