Displays grade if any in medal validation process (Closes #1403).
authorStéphane Jacob <sj@m4x.org>
Tue, 1 Mar 2011 14:29:27 +0000 (15:29 +0100)
committerStéphane Jacob <sj@m4x.org>
Tue, 1 Mar 2011 14:29:27 +0000 (15:29 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
ChangeLog
include/validations/medals.inc.php

index 16f815d..4c9d4bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@ Bug/Wish:
     * Admin:
         - #1399: Displays all similar entreprises only on demand           -JAC
         - #1362: List last profile modifications for secretary             -JAC
+        - #1403: Displays grade if any in medal validation process         -JAC
 
     * Core:
         - #1352: Fixes csv downloading with IE8.                           -JAC
index 92b821d..0d29063 100644 (file)
@@ -74,10 +74,17 @@ class MedalReq extends ProfileValidate
 
     public function medal_name()
     {
-        $res = XDB::query('SELECT  m.text
-                             FROM  profile_medal_enum AS m
-                            WHERE  m.id = {?}', $this->mid);
-        return $res->fetchOneCell();
+        $name = XDB::fetchOneCell('SELECT  text
+                                     FROM  profile_medal_enum
+                                    WHERE  id = {?}', $this->mid);
+        $grade = XDB::fetchOneCell('SELECT  text
+                                      FROM  profile_medal_grade_enum
+                                     WHERE  mid = {?} AND gid = {?}',
+                                   $this->mid, $this->gid);
+        if (is_null($grade)) {
+            return $name;
+        }
+        return $name . ' (' . $grade . ')';
     }
 
     // }}}