some client tweaks
Bo Daley <[email protected]>
| Newsgroups | gmane.comp.horde.whups |
|---|---|
| Message-ID | <[email protected]> |
the attached patch allows the administrator to select some additional details from the client source to be displayed on the ticket details page alongside the client's name. this is in response to a request from some people here that they needed basic info (like the client's email address and phone number) in front of them when they're looking at tickets. might be useful to someone else? bo. -- Whups mailing list Frequently Asked Questions: http://horde.org/faq/ To unsubscribe, mail: [email protected]
whups_client_tweaks.diff
(text/diff, 6.7 KB)
Index: lib/Config.php
===================================================================
RCS file: /repository/horde/lib/Config.php,v
retrieving revision 1.30
diff -u -r1.30 Config.php
--- lib/Config.php 5 Oct 2003 16:57:39 -0000 1.30
+++ lib/Config.php 13 Oct 2003 08:46:31 -0000
@@ -510,6 +510,18 @@
global $registry;
return $this->_makeKeyValuePairs($registry->listApps(array('hidden', 'notoolbar', 'active')));
break;
+ case 'list-client-fields':
+ global $registry;
+ $f = array();
+ if ($registry->hasMethod('clients/getClientSource')) {
+ $addressbook = $registry->call('clients/getClientSource');
+ $fields = $registry->call('clients/fields', array($addressbook));
+ foreach ($fields as $field) {
+ $f[$field['name']] = $field['label'];
+ }
+ }
+ return $f;
+ break;
}
return array();
Index: turba/lib/api.php
===================================================================
RCS file: /repository/turba/lib/api.php,v
retrieving revision 1.65
diff -u -r1.65 api.php
--- turba/lib/api.php 3 Oct 2003 19:59:51 -0000 1.65
+++ turba/lib/api.php 13 Oct 2003 08:46:32 -0000
@@ -248,13 +248,11 @@
}
$seen[$seen_key] = true;
}
- $results[$name][] = array(
- 'name' => $att['name'],
- 'email' => $email,
- '__type' => 'Object',
- 'id' => $att['__key'],
- 'source' => $source
- );
+ $results[$name][] = array_merge($att,
+ array('id' => $att['__key'],
+ 'email' => $email,
+ '__type' => 'Object',
+ 'source' => $source));
} else {
/* Is a distribution list. */
$listatt = $ob->getAttributes();
Index: whups/config/conf.xml
===================================================================
RCS file: /repository/whups/config/conf.xml,v
retrieving revision 1.8
diff -u -r1.8 conf.xml
--- whups/config/conf.xml 5 Oct 2003 17:07:35 -0000 1.8
+++ whups/config/conf.xml 13 Oct 2003 08:46:32 -0000
@@ -122,4 +122,17 @@
</values>
</configmultienum>
</configsection>
+
+ <configsection name="clients">
+ <configheader>
+ Client Settings
+ </configheader>
+
+ <configmultienum name="details" desc="Additional client details to display on tickets">
+ <values>
+ <configspecial name="list-client-fields" />
+ </values>
+ </configmultienum>
+ </configsection>
+
</configuration>
Index: whups/lib/Driver.php
===================================================================
RCS file: /repository/whups/lib/Driver.php,v
retrieving revision 1.73
diff -u -r1.73 Driver.php
--- whups/lib/Driver.php 20 Sep 2003 20:40:57 -0000 1.73
+++ whups/lib/Driver.php 13 Oct 2003 08:46:32 -0000
@@ -75,19 +75,30 @@
'resolved' => _("Resolved"));
}
- function getClients($module = null, $ticket = null)
+ function getClients($module = null, $ticket = null, $details = false)
{
$clients = array();
if ($GLOBALS['registry']->hasMethod('clients/clientSearch')) {
- /* Get client data from the clients API provider. */
+ // Get client data from the clients API provider.
$args = array('addresses' => array(''),
'fields' => array('name'));
$results = $GLOBALS['registry']->call('clients/clientSearch', $args);
$clientlist = $results[''];
if (!empty($clientlist)) {
foreach ($clientlist as $client) {
- $clients[$client['id']] = $client['name'];
+ if ($details) {
+ $clientdetails = '';
+ foreach ($GLOBALS['conf']['clients']['details'] as $d) {
+ if (!empty($client[$d])) {
+ $clientdetails .= empty($clientdetails) ? $client[$d] : ', ' . $client[$d];
+ }
+ }
+ $clientdetails = !empty($clientdetails) ? ' (' . $clientdetails . ')' : '';
+ $clients[$client['id']] = $client['name'] . $clientdetails;
+ } else {
+ $clients[$client['id']] = $client['name'];
+ }
}
}
if (!empty($module)) {
@@ -102,6 +113,8 @@
}
}
+
+ asort($clients);
return $clients;
}
Index: whups/lib/Whups.php
===================================================================
RCS file: /repository/whups/lib/Whups.php,v
retrieving revision 1.74
diff -u -r1.74 Whups.php
--- whups/lib/Whups.php 22 Sep 2003 14:00:10 -0000 1.74
+++ whups/lib/Whups.php 13 Oct 2003 08:46:32 -0000
@@ -481,16 +481,16 @@
return implode(', ', $results);
}
- function getClients($module = null, $ticket = null, $returnformat = 'list')
+ function getClients($module = null, $ticket = null, $returnformat = 'list', $details = false)
{
global $whups;
- $clients = $whups->getClients($module, $ticket);
+ $clients = $whups->getClients($module, $ticket, $details);
if (is_a($clients, 'PEAR_Error')) {
Horde::logMessage($clients, __FILE__, __LINE__, PEAR_LOG_ERR);
return $clients->getMessage();
}
if ($returnformat == 'list') {
- return implode(', ', $clients);
+ return implode("\n", $clients);
} else {
return $clients;
}
Index: whups/details.php
===================================================================
RCS file: /repository/whups/details.php,v
retrieving revision 1.58
diff -u -r1.58 details.php
--- whups/details.php 16 Sep 2003 23:08:49 -0000 1.58
+++ whups/details.php 13 Oct 2003 08:46:32 -0000
@@ -377,7 +377,7 @@
$form->addAttributes($attributes);
$details['user_id_requester'] = Whups::formatUser($details['user_id_requester']);
$details['user_id_owner'] = Whups::getOwners($ticket);
- $client_name = Whups::getClients($details['module'], $ticket);
+ $client_name = Whups::getClients($details['module'], $ticket, 'list', true);
if (!empty($client_name)) {
$details['client_name'] = $client_name;
}