I need a way to have the contact log table which is the child of the contact logs table to have a sort other than the primary key of the logs table. I have tried the addition to the relationships.ini file:
[contact_log]
contact_log.contact_id = "$Contact_Id"
metafields: order = log_date desc
as well as the ApplicationDelegate.php:
<?php
class conf_ApplicationDelegate {
function getPermissions(&$record){
// $record is a Dataface_Record object
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();
if ( $user ) return Dataface_PermissionsTool::ALL();
else return Dataface_PermissionsTool::NO_ACCESS();
}
function beforeHandleRequest(){
//$query =& Dataface_Application::getInstance()->getQuery();
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
//if ( $query['-table'] == 'tbl_jobs' and !@$query['-sort'] and !$_POST ){
// $query['-sort'] = 'job_id desc';
//}
if( !$_POST and $query['-table'] == 'contacts' and !isset($query['-sort']) ){
$query['-sort'] = 'Last_Name asc, First_Name asc';
}
if( !$_POST and $query['-table'] == 'contact_log' and !isset($query['-sort']) ){
$query['-sort'] = 'log_date desc';
}
}
}
Neither works. What is the correct technique? This should be a common and simple task.
Thanks,
Mike