projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix SU on account.
[platal.git]
/
include
/
validations
/
medals.inc.php
diff --git
a/include/validations/medals.inc.php
b/include/validations/medals.inc.php
index
a2a5dc1
..
16f5b99
100644
(file)
--- a/
include/validations/medals.inc.php
+++ b/
include/validations/medals.inc.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-20
08
Polytechnique.org *
+ * Copyright (C) 2003-20
10
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-36,6
+36,9
@@
class MedalReq extends Validate
parent::__construct($_user, false, 'medal', $_stamp);
$this->mid = $_idmedal;
$this->gid = $_subidmedal;
parent::__construct($_user, false, 'medal', $_stamp);
$this->mid = $_idmedal;
$this->gid = $_subidmedal;
+ if (is_null($this->gid)) {
+ $this->gid = 0;
+ }
}
// }}}
}
// }}}
@@
-74,8
+77,8
@@
class MedalReq extends Validate
//var_dump($this);
$r = XDB::query("
SELECT IF (g.text IS NOT NULL, CONCAT(m.text,' - ', g.text), m.text)
//var_dump($this);
$r = XDB::query("
SELECT IF (g.text IS NOT NULL, CONCAT(m.text,' - ', g.text), m.text)
- FROM profile_medal
s
AS m
- LEFT JOIN profile_medal
s
_grades AS g ON(g.mid = m.id AND g.gid = {?})
+ FROM profile_medal
_enum
AS m
+ LEFT JOIN profile_medal
_enum
_grades AS g ON(g.mid = m.id AND g.gid = {?})
WHERE m.id = {?}", $this->gid, $this->mid);
return $r->fetchOneCell();
}
WHERE m.id = {?}", $this->gid, $this->mid);
return $r->fetchOneCell();
}
@@
-86,7
+89,7
@@
class MedalReq extends Validate
public function submit()
{
$res = XDB::query("SELECT FIND_IN_SET('validation', flags)
public function submit()
{
$res = XDB::query("SELECT FIND_IN_SET('validation', flags)
- FROM profile_medal
s
+ FROM profile_medal
_enum
WHERE id = {?}", $this->mid);
if ($res->fetchOneCell()) {
parent::submit();
WHERE id = {?}", $this->mid);
if ($res->fetchOneCell()) {
parent::submit();
@@
-100,11
+103,10
@@
class MedalReq extends Validate
public function commit ()
{
public function commit ()
{
- require_once 'notifs.inc.php';
- register_watch_op($this->user->id(), WATCH_FICHE, '', 'medals');
- return XDB::execute('REPLACE INTO profile_medals_sub
+ return XDB::execute('REPLACE INTO profile_medals
VALUES ({?}, {?}, {?})',
VALUES ({?}, {?}, {?})',
- $this->user->id(), $this->mid, $this->gid);
+ $this->user->profile()->id(), $this->mid,
+ is_null($this->gid) ? 0 : $this->gid);
}
// }}}
}
// }}}