restrict related record

A place for users and developers of the Xataface to discuss and receive support.

restrict related record

Postby cookie720 » Tue Jun 19, 2012 9:33 pm

Hi all,
Hopefully my last question for a while (not likely though :mrgreen: )
I need to restrict clients in my orders, ONE client per order,
When looking up related records in my orders, in my clients tab, I want to disable that add new clients record button. If not then upon creating the record, disallow it.

Im guessing a function in my delegate class, something to do with triggers, beforesave, or beforeAddRelatedRecord?

Ill have a go:


Code: Select all
function beforeInsert(&$record){
        $response =& Dataface_Application::getResponse();
        if ( there is no record ){
            insert client
        } else {
            return PEAR::raiseError(
                        "Cannot have more than one client per Order.  Record could not be inserted",
                        DATAFACE_E_NOTICE);
        }
    }



Thanks!
cookie720
 
Posts: 69
Joined: Mon Jun 04, 2012 9:22 pm

Re: restrict related record

Postby shannah » Wed Jun 20, 2012 10:20 am

Hard to comment as I don't know how you are adding the clients. Using the grid widget on the new record form, or adding clients individually with the add related record form?
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: restrict related record

Postby cookie720 » Thu Jun 21, 2012 5:00 am

Yes the add related record
cookie720
 
Posts: 69
Joined: Mon Jun 04, 2012 9:22 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved