trimble
19-04-05, 05:13 AM
I'm attempting to change the sort order for my Contacts page and believe I've found the section of code in contacts/index.php which controls this (lines 27-49):
$orderby = 'contact_order_by';
//$orderby = 'contact_last_name';
// Pull First Letters
$let = ":";
$q = new DBQuery;
$q->addTable('contacts');
$q->addQuery("DISTINCT UPPER(SUBSTRING($orderby,1,1)) as L");
$q->addWhere("contact_private=0 OR (contact_private=1 AND contact_owner=$AppUI->user_id)
OR contact_owner IS NULL OR contact_owner = 0");
$arr = $q->loadList();
foreach( $arr as $L ) {
$let .= $L['L'];
}
// optional fields shown in the list (could be modified to allow breif and verbose, etc)
$showfields = array(
// "test" => "concat(contact_first_name,' ',contact_last_name) as test", why do we want the name repeated?
"company_name" => "company_name",
"contact_phone" => "contact_phone",
"contact_email" => "contact_email"
);
As you can see, I've tried changing the $orderby value to 'contact_last_name', but this has no discernable affect on the page. I'm sure this is due to the
$q->addQuery("DISTINCT UPPER(SUBSTRING($orderby,1,1)) as L");
line, but at this point I don't yet understand what this line is doing and why.
Any help appreciated!
$orderby = 'contact_order_by';
//$orderby = 'contact_last_name';
// Pull First Letters
$let = ":";
$q = new DBQuery;
$q->addTable('contacts');
$q->addQuery("DISTINCT UPPER(SUBSTRING($orderby,1,1)) as L");
$q->addWhere("contact_private=0 OR (contact_private=1 AND contact_owner=$AppUI->user_id)
OR contact_owner IS NULL OR contact_owner = 0");
$arr = $q->loadList();
foreach( $arr as $L ) {
$let .= $L['L'];
}
// optional fields shown in the list (could be modified to allow breif and verbose, etc)
$showfields = array(
// "test" => "concat(contact_first_name,' ',contact_last_name) as test", why do we want the name repeated?
"company_name" => "company_name",
"contact_phone" => "contact_phone",
"contact_email" => "contact_email"
);
As you can see, I've tried changing the $orderby value to 'contact_last_name', but this has no discernable affect on the page. I'm sure this is due to the
$q->addQuery("DISTINCT UPPER(SUBSTRING($orderby,1,1)) as L");
line, but at this point I don't yet understand what this line is doing and why.
Any help appreciated!