Avoid null gids.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 21 Feb 2009 08:23:20 +0000 (09:23 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sat, 21 Feb 2009 08:23:20 +0000 (09:23 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
core
include/validations/medals.inc.php

diff --git a/core b/core
index adc69ce..e94c4a1 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit adc69ced9c75421c5ee596fbd0a3426fffb9940c
+Subproject commit e94c4a1713cc0d63508a5d0ecd2d572f047975fb
index a2a5dc1..dd58bbd 100644 (file)
@@ -36,6 +36,9 @@ class MedalReq extends Validate
         parent::__construct($_user, false, 'medal', $_stamp);
         $this->mid = $_idmedal;
         $this->gid = $_subidmedal;
+        if (is_null($this->gid)) {
+            $this->gid = 0;
+        }
     }
 
     // }}}
@@ -104,7 +107,8 @@ class MedalReq extends Validate
         register_watch_op($this->user->id(), WATCH_FICHE, '', 'medals');
         return XDB::execute('REPLACE INTO  profile_medals_sub
                                    VALUES  ({?}, {?}, {?})',
-                            $this->user->id(), $this->mid, $this->gid);
+                            $this->user->id(), $this->mid,
+                            is_null($this->gid) ? 0 : $this->gid);
     }
 
     // }}}