The fastest easiest way to get it right.

Constraining Updates and Deletes

Sometimes you need to 'close' a record, such as an order or a general ledger batch, and allow now further changes to it. This can be done by attaching constraint chains directly to the table.

For a complete description of chain syntax, see the prior page on general constraints, and the page on calculated values. This page shows only the specifics of preventing deletions or updates.

table ledgerbatches:
    module: ledger
    uisort: 200
    description: Ledger Batches
    
    chain delete_pre:
        test 00:
            compare: @flag_closed = Y
            return: Batch is closed, cannot delete
    chain update_pre:
        test 00:
            compare: @flag_closed = Y
            return: Batch is closed, cannot delete

In the example above we have put two constraint chains onto the table of general ledger batches. These chains work exactly like general constraints, except for these two details:

  • The specially-named chain "delete_pre" is used to prevent deletions.
  • The specially-named chain "update_pre" is used to prevent updates.

Future Required Feature

The constraints shown above actually lack a feature required to be totally complete. Although it is natural to constrain updates and deletes on closed records by regular users, sooner or later somebody has to come along and purge out the rows. In a future release of Andromeda we will support the "INGROUP" comparison operator to allow a constraint to function based on the user's group membership. This would allow a "purge" group to delete the rows, where normal users could not.

User Comments

There are no user comments yet on this page.


Add A Comment

Comments will not appear until after they are moderated. Comments are usually moderated within a few hours on weekdays, but may take longer on weekends and holidays.

Name or nickname: (This will appear with your comment)


Email (this will never be displayed)


Enter your comment here. Use [b] and [/b] for bold, [i] and [/i] for italic, and [pre] and [/pre] for code samples. All literal HTML and PHP that you enter will be escaped out and displayed as you enter it.


Home |  Documentation |  Download |  Credits |  Contact |  Login
Andromeda © Copyright 2004-2010, Licensed under the GPL Version 2