/** * create a new member and let it become participant of the supplied ballot * * @param Period $period * @param mixed $ballot Ballot, true or null * @param integer $case * @param string $i */ function add_participant(Period $period, $ballot, $case, $i) { global $date, $password; Login::$member = new Member; Login::$member->invite = Login::generate_token(24); Login::$member->eligible = true; Login::$member->verified = true; Login::$member->create(); Login::$member->username = "******".$date."c".$case."p".(is_object($ballot)?$ballot->id:$ballot).$i; Login::$member->password = $password; $update_fields = array('username', 'password', 'eligible'); // Enable this only in local development environment, because it may lead to a lot if notification mails! //Login::$member->mail = ERROR_MAIL; //$update_fields[] = "mail"; Login::$member->update($update_fields, 'activated=now()'); Login::$member->update_ngroups([1]); if ($ballot) { if (is_object($ballot)) $period->select_ballot($ballot); else $period->select_postal(); } }
redirect(); } if ($period->state=="ballot_assignment" and !$ballot->approved) { warning(_("In ballot assignment phase it is only allowed to select approved ballots.")); redirect(); } $period->select_ballot($ballot); redirect(); break; case "select_postal": Login::access_action("entitled", $_SESSION['ngroup']); if ($period->state=="ballot_preparation") { warning(_("In ballot preparation phase it is not allowed anymore to select postal voting.")); redirect(); } $period->select_postal(); redirect(); break; case "unselect": Login::access_action("entitled", $_SESSION['ngroup']); if ($period->state=="ballot_preparation") { warning(_("In ballot preparation phase it is not allowed anymore to change the ballot choice.")); redirect(); } $period->unselect_ballot(); redirect(); break; case "save_approved": Login::access_action("admin"); action_required_parameters('approved_id'); if ($period->state!="ballot_application") {