| ACCEPTED
| REJECTED
| ADDED
+ | BEING_ADDED
val statusFromInt =
fn 0 => CONFIRMING
| 2 => ACCEPTED
| 3 => REJECTED
| 4 => ADDED
+ | 5 => BEING_ADDED
| _ => raise C.Sql "Bad status"
val statusToInt =
| ACCEPTED => 2
| REJECTED => 3
| ADDED => 4
+ | BEING_ADDED => 5
fun statusFromSql v = statusFromInt (C.intFromSql v)
fun statusToSql s = C.intToSql (statusToInt s)
SOME row => mkAppRow row
| NONE => raise Fail "Membership application not found"
-fun listApps status =
+fun listApps statuses =
C.map (getDb ()) mkAppRow ($`SELECT id, name, rname, gname, email, forward, uses, other, passwd, status, applied, ipaddr, confirmed, decided,
msg, unix_passwd, paypal, checkout
FROM MemberApp
- WHERE status = ^(statusToSql status)
+ WHERE status IN (^(String.concatWith "," (map statusToSql statuses)))
AND NOT (status = 2 AND decided < CURRENT_TIMESTAMP - INTERVAL '1 MONTH')
ORDER BY applied`)
OS.Process.isSuccess (Mail.mclose mail)
end
-fun add app =
+fun preAdd app =
let
val _ = C.dml (getDb ()) ($`UPDATE MemberApp
- SET status = 3
+ SET status = 5
WHERE id = ^(C.intToSql app)`)
val app = lookupApp app
val outf = TextIO.openOut (Config.passwordFiles ^ #name app)
in
TextIO.output (outf, #unix_passwd app);
+ TextIO.output1 (outf, #"\n");
TextIO.closeOut outf
end
+fun add app =
+ ignore (C.dml (getDb ()) ($`UPDATE MemberApp
+ SET status = 4
+ WHERE id = ^(C.intToSql app)`))
+
fun welcome app =
let
val app = lookupApp app