Display expanded customer name
authorJoey Schulze <joey@infodrom.org>
Mon, 13 May 2013 10:46:22 +0000 (10:46 +0000)
committerJoey Schulze <joey@infodrom.org>
Mon, 13 May 2013 10:46:22 +0000 (10:46 +0000)
src/InfoCon/stempel/common.inc
src/InfoCon/stempel/index.wml
src/InfoCon/stempel/status.wml

index 9d10db0..bcfa427 100644 (file)
@@ -1,4 +1,4 @@
-<?
+<?php
 
   function min2hour($minutes)
   {
     return $a;
   }
 
+  function load_customers()
+  {
+    global $dbh;
+    $info = array();
+
+    $sth = pg_exec ($dbh, 'SELECT short,name FROM stempel_customer');
+    while ($row = pg_fetch_array ($sth))
+      $info[$row['short']] = $row['name'];
+
+    return $info;
+  }
+
 ?>
index 5006347..0ab3996 100644 (file)
@@ -27,6 +27,8 @@
 <page func=InfoCon title="Stempeluhr">
 
 <?
+  $name = load_customers();
+
   $table_head = '<h3 class="bar">Kunde: %s</h3>
 <table class="smallfont border" width="100%%" cellpadding=0 cellspacing=1>
 <tr class="head">
@@ -54,7 +56,9 @@
        printf($table_sum, $color, min2hour($sum));
         echo($table_foot);
       }
-      printf($table_head, $row['customer']);
+      $cname = $name[$row['customer']];
+      if (!strlen($cname)) $cname = ucfirst($row['customer']);
+      printf($table_head, $cname);
       $customer = $row['customer'];
       $sum = 0;
       $color = 0;
index b7e548d..dd84a6f 100644 (file)
     return sprintf("<br>%d records updated.", $count);
   }
 
-  function load_customers()
-  {
-    global $dbh;
-    $info = array();
-
-    $sth = pg_exec ($dbh, 'SELECT short,name FROM stempel_customer');
-    while ($row = pg_fetch_array ($sth))
-      $info[$row['short']] = $row['name'];
-
-    return $info;
-  }
-
   $stati = false;
   function display_tables()
   {