Add a flag "Must be validated" for medals instead of hard-coding this
[platal.git] / include / validations / medals.inc.php
index 14f0b87..d2c8ec5 100644 (file)
@@ -60,7 +60,7 @@ class MedalReq extends Validate
     function _mail_body($isok)
     {
         if ($isok) {
-            return "  La décoration ".$this->medal_name()." que tu avais demandée vient d'être acceptée.";
+            return "  La décoration ".$this->medal_name()." vient d'être ajoutée à ta fiche.";
         } else {
             return "  La demande que tu avais faite pour la décoration ".$this->medal_name()." a été refusée.";
         }
@@ -81,6 +81,21 @@ class MedalReq extends Validate
     }
 
     // }}}
+    // {{{ function submit()
+
+    function submit()
+    {
+        $res = XDB::query("SELECT  FIND_IN_SET(flags, 'validation')
+                             FROM  profile_medals
+                            WHERE  id = {?}", $this->mid);
+        if ($res->fetchOneCell()) {
+            parent::submit();
+        } else {
+            $this->commit();
+        }
+    }
+    
+    // }}}
     // {{{ function commit()
 
     function commit ()