Add a vote type to the TU proposal form

There are only four valid reasons for starting a TU vote, so instead of
letting the user choose a vote length, let her pick a reason and set
vote length and quorum based on that selection.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2013-08-04 17:27:41 +02:00
parent 64bfa6e828
commit d41e40d9d6
2 changed files with 38 additions and 15 deletions

View file

@ -615,7 +615,7 @@ function open_user_proposals($user) {
*
* @return void
*/
function add_tu_proposal($agenda, $user, $votelength, $submitteruid) {
function add_tu_proposal($agenda, $user, $votelength, $quorum, $submitteruid) {
$dbh = DB::connect();
$q = "SELECT COUNT(*) FROM Users WHERE AccountTypeID = 2";
@ -623,11 +623,12 @@ function add_tu_proposal($agenda, $user, $votelength, $submitteruid) {
$row = $result->fetch(PDO::FETCH_NUM);
$active_tus = $row[0];
$q = "INSERT INTO TU_VoteInfo (Agenda, User, Submitted, End, ";
$q = "INSERT INTO TU_VoteInfo (Agenda, User, Submitted, End, Quorum, ";
$q.= "SubmitterID, ActiveTUs) VALUES ";
$q.= "(" . $dbh->quote($agenda) . ", " . $dbh->quote($user) . ", ";
$q.= "UNIX_TIMESTAMP(), UNIX_TIMESTAMP() + " . $dbh->quote($votelength);
$q.= ", " . $submitteruid . ", " . $active_tus . ")";
$q.= ", " . $dbh->quote($quorum) . ", " . $submitteruid . ", ";
$q.= $active_tus . ")";
$result = $dbh->exec($q);
}