ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Several issues with T1230 Direct Debit Mandate

Open Bleika opened this issue 7 years ago • 1 comments

Hi,

I'm afraid I have several issues concerning this table...

At least in Spain, it's common to only want a single Mandate pr. Customer. The practical workaround is to use the VAT Registration No. of the Account Holder as a Mandate ID instead of a Number Series. It must also be kept in mind that you might Rename the Customer rec, for any internal reason and that fact should invalidate the mandate as such (T18.OnRename doesn't consider that possibility). Obviously, others may want a relationship of 1:N, but the wish for 1:1 should be catered for.

1) Trigger OnInsert() - Please add a new Event: OnBeforeInsert with a Handled Pattern so that the call to InsertNoSeries may be avoided

Furthermore, Mandates have no actual value unless signed. In this context it translates into that a valid "Signature Date" should be introduced. Therefore, Mandates should be editable although blocked so that they may be confectioned.

2) Trigger OnModify() - Please add a new Event: OnBeforeModify with a Handled Pattern so that the default error check may be avoided (and Mandate can be confectioned although blocked)

Lastly, when you establish a business relationship, you hope it'll be prosperous ;-) Therefore, unless the customer signs a OneOff Mandate, in most cases it doesn't make much sense to control the "Expected Number of Debits". However, standard code is full of error checks against this number and even has a bug in the OnValidate trigger for "Type of Payment" that sets this field as 1 for all payment types.

If all these checks are maintained against Recurrent types, at least closing the mandate automatically should be optional/avoidable. If not, IsMandateActive will return false, just because of this counter. I can think of at least 4 workaround options:

  • if "Type of Payment" is recurrent, automatically set "Expected Number of Debits" to a high number (1000 or higher). (Hardcoding - might not be accepted by all).
  • if "Type of Payment" is recurrent, ignore the "Expected Number of Debits" in checks. (Practical but might not be accepted by all).
  • add a settings field, i.e. "Close Mandate if Expected Number of Debits is reached" in "General Ledger Setup" to allow companies to choose if they want mandates closed automatically and check that mark in code. (The "ultimate NAV way").
  • add events with Handled Pattern to allow for personalization of this behaviour. (Perhaps an unnecessary mess).

In consequence, please consider the following to avoid all the errors related to "Expected Number of Debits" (if unwanted):

3) Type of Payment - OnValidate(). Expected Number of Debits should never be automatically set to 1 unless "Type of Payment" is OneOff. Please correct the following code:

BEFORE: IF ("Type of Payment" = "Type of Payment"::OneOff) AND ("Debit Counter" > 1) THEN ERROR(MandateChangeErr); "Expected Number of Debits" := 1;

AFTER: IF ("Type of Payment" = "Type of Payment"::OneOff) then begin if ("Debit Counter" > 1) THEN ERROR(MandateChangeErr); "Expected Number of Debits" := 1; end;

4) Function GetSequenceType - please allow for a means to avoid sending a "Last" instruction automatically (either by a new boolean setting or with a new event that allows avoid closing). If Payment Type is recurrent you'll never send a "Last" unless the customer expresses that he recalls the Mandate: Problematic Code: IF "Debit Counter" >= "Expected Number of Debits" - 1 THEN EXIT(DirectDebitCollectionEntry."Sequence Type"::Last);

5) Debit Counter - OnValidate() - please allow for a means to avoid the error message: Problematic Code: IF "Expected Number of Debits" < "Debit Counter" THEN BEGIN MESSAGE(InvalidNumberOfDebitsTxt); FIELDERROR("Debit Counter"); END;

6) Function RollBackSequenceType - please allow for a means to avoid "Closing" mandates automatically: Problematic Code: Closed := "Debit Counter" >= "Expected Number of Debits";

7) Function UpdateCounter() - please allow for a means to avoid "Closing" mandates automatically: Problematic Code: Closed := "Debit Counter" >= "Expected Number of Debits";

Bleika avatar Feb 03 '19 22:02 Bleika

Table 1203 Direct Debit Mandate will get:

  • new field 13 "Ignore Exp. Number of Debits"; Boolean - it disables handling of situations when "Debit Count" exceeds "Expected Number of Debits"
  • event OnBeforeInsert - to avoid OnInsert code
  • event OnBeforeModify - to avoid OnModify code

StanPesotskiy avatar Jun 04 '19 06:06 StanPesotskiy