AllowPostTransactions (selection)

A script handler you can implement to override standard MoneyWorks behaviour.

Automatically called:  When the user is about to (electively) post transactions.

Use for:  To implement programmatic control over whether a user is allowed to post transactions. Return 0 to abort posting. If you return 0, none of the transactions in the selection will be posted.

Notes:  Avoid iterating over the records in the selection one at a time, as this may be very time consuming if you are connected to a remote server. Where possible, make the decision based on a search of the selection using IntersectSelection.


on AllowPostTransactions(toPost)
    let notMine = IntersectSelection(toPost, `EnteredBy <> Initials`)
    if RecordsSelected(notMine) > 0
           Alert("Can't post", "You can only post transactions that you entered")
           return false
    return true

Return value:  Return 1 (or TRUE) if the selection of transactions should be allowed to be posted. Return 0 (or FALSE) to prevent the user from posting them. If you deny posting in this way, you should present some user interface (such as an alert) to explain what is happening. The default return value (for all handlers) is 1 (TRUE).