Hopefully my last question for a while (not likely though

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!