From 4fd1c237d18269bfd86643590828fb12f91cdc32 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 4 Feb 2002 23:44:14 +0000 Subject: [PATCH] warn-skript, euro-umstellungsfehler --- scripts/register/confirm.py | 9 ++++---- scripts/register/payment.py | 10 ++++----- scripts/register/vinyambar.py | 2 +- scripts/register/warn.py | 42 +++++++++++++++++++++++++++++++++++ scripts/register/zat.py | 1 + 5 files changed, 53 insertions(+), 11 deletions(-) create mode 100755 scripts/register/warn.py diff --git a/scripts/register/confirm.py b/scripts/register/confirm.py index 0a0dd4dfd..33c39c4c1 100755 --- a/scripts/register/confirm.py +++ b/scripts/register/confirm.py @@ -11,17 +11,17 @@ From="accounts@vinyambar.de" server=smtplib.SMTP('localhost') cursor=db.cursor() -records=cursor.execute("SELECT users.id, users.password, users.email, users.balance, "+ +records=cursor.execute("SELECT u.id, u.password, u.email, "+ "races.name, "+ "games.name, games.info, subscriptions.id "+ - "from users, games, subscriptions, races "+ - "where users.id = subscriptions.user AND games.id = subscriptions.game "+ + "from users u, games, subscriptions, races "+ + "where u.id = subscriptions.user AND games.id = subscriptions.game "+ "AND races.race = subscriptions.race AND races.locale='de' "+ "AND subscriptions.status='NEW'") while (records>0): records = records - 1 - customerid, passwd, email, balance, race, gamename, gameinfo, subscription = cursor.fetchone() + customerid, passwd, email, race, gamename, gameinfo, subscription = cursor.fetchone() Msg = ("From: "+From+"\nTo: "+email+"\nSubject: Vinyambar Anmeldung angenommen.\n\n"+ "Deine Anmeldung für '"+gamename+"' wurde akzeptiert.\n" @@ -31,7 +31,6 @@ while (records>0): "Auftragsnummer: " + str(int(subscription)) + "\n"+ "Passwort: " + passwd + "\n" + "Rasse: " + race + "\n\n"+ - "Kontostand: " + str(balance) + " DEM\n\n"+ "Bitte bewahre diese Mail sorgfältig auf, da Du deine Kundennummer und das\n"+ "Passwort für das Spiel benötigst. Solltest Du noch Fragen zu Deiner \n"+ "Anmeldung haben, wende Dich bitte an accounts@vinyambar.de.\n\n"+ diff --git a/scripts/register/payment.py b/scripts/register/payment.py index c520db1cc..956117bc2 100755 --- a/scripts/register/payment.py +++ b/scripts/register/payment.py @@ -23,7 +23,7 @@ i=cursor.execute('SELECT sum(balance) from transactions WHERE user='+str(userid) balance=cursor.fetchone()[0] if balance==None: balance=0.0 -print 'Balance for '+firstname+' '+lastname+' is '+str(balance)+' DEM' +print 'Balance for '+firstname+' '+lastname+' is '+str(balance)+' EUR' if len(sys.argv)>4: cash=float(sys.argv[3]) @@ -47,9 +47,9 @@ if len(sys.argv)>4: "Kundennummer: "+str(userid)+"\n"+ "Eingangsdatum: "+date+"\n"+ "Transaktionsnummer: "+str(lastid)+"\n"+ - "Alter Kontostand: "+str(balance)+" DEM\n"+ - "Zahlungseingang: "+str(cash)+" DEM\n"+ - "Neuer Kontostand: "+str(balance+cash)+" DEM\n"+ + "Alter Kontostand: "+str(balance)+" EUR\n"+ + "Zahlungseingang: "+str(cash)+" EUR\n"+ + "Neuer Kontostand: "+str(balance+cash)+" EUR\n"+ "Verwendungszweck: "+reason+"\n"+ "\n"+ "Deine Zahlung ist eingegangen und wurde auf dein Spielerkonto verbucht.\n") @@ -65,5 +65,5 @@ cursor.execute("select count(*) from users u, transactions t where u.id=t.user g count = cursor.fetchone()[0] cursor.execute("select sum(transactions.balance) from transactions") balance = cursor.fetchone()[0] -print str(balance)+ " DEM (" + str(balance/1.955830)+ " EUR) in " + str(int(count)) + " Konten" +print str(balance)+ " EUR (" + str(balance*1.955830)+ " DEM) in " + str(int(count)) + " Konten" diff --git a/scripts/register/vinyambar.py b/scripts/register/vinyambar.py index 8692dd729..930bb11d8 100755 --- a/scripts/register/vinyambar.py +++ b/scripts/register/vinyambar.py @@ -39,7 +39,7 @@ def show_detail(): while count>0: count = count-1 balance, description, date = cursor.fetchone() - custdetail.addstr(line, 2, str(date)[0:10]+' - '+description+' - '+str(balance)+' DEM') + custdetail.addstr(line, 2, str(date)[0:10]+' - '+description+' - '+str(balance)+' EUR') line=line+1 custdetail.refresh() diff --git a/scripts/register/warn.py b/scripts/register/warn.py new file mode 100755 index 000000000..802655464 --- /dev/null +++ b/scripts/register/warn.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +import MySQLdb +import sys +import smtplib + +From='accounts@vinyambar.de' +dbname=sys.argv[1] +price=1.25 +warnahead=2 +db=MySQLdb.connect(db=dbname) +cursor=db.cursor() + +users = cursor.execute("select users.email, users.id, count(subscriptions.game) from users, subscriptions, games where users.id=subscriptions.user and subscriptions.game=games.id and games.status='RUNNING' GROUP BY users.id") +server=smtplib.SMTP('localhost') +while users > 0: + users=users-1 + email, uid, games = cursor.fetchone() + c2 = db.cursor() + t = c2.execute("select sum(balance) from transactions where user="+str(int(uid))) + if t==0: + balance=0.0 + else: + balance = c2.fetchone()[0] + if balance < games*warnahead*price: + print "Warning "+email+", uid="+str(int(uid))+", balance="+str(balance)+", games="+str(int(games)) + Msg = ("From: Vinyambar Buchhaltung <"+From+">\nTo: "+email+"\nSubject: Vinyambar Kontostand, Warnung.\n\n"+ + "Dein Vinyambar Kontostand reicht nicht mehr aus, um die kommenden "+str(warnahead)+"\n"+ + "Wochen zu bezahlen. Bitte mache baldmöglichst eine neue Überweisung\n" + "auf das Vinyambar-Konto.\n\n"+ + "Kundennummer: "+str(uid)+"\n"+ + "Kontostand: "+str(balance)+" EUR\n"+ + "\n"+ + "Unser Konto: Katja Zedel\n"+ + "Kontonummer 1251 886 106\n"+ + "BLZ 500 502 01 (Frankfurter Sparkasse)\n") + try: + # print Msg + server.sendmail(From, email, Msg) + except: + print "Could not send confirmation to "+email + print "Exception is:", sys.exc_type, ":", sys.exc_value + diff --git a/scripts/register/zat.py b/scripts/register/zat.py index 7c6610c09..d4e5a5400 100755 --- a/scripts/register/zat.py +++ b/scripts/register/zat.py @@ -15,3 +15,4 @@ while k!=0: user = int(cursor.fetchone()[0]) update=db.cursor() update.execute("INSERT INTO transactions (user,date,balance,description) VALUES ("+str(user)+", '"+date+"', -"+str(price)+", 'ZAT-"+str(game)+"')") +