From 94539d42b632ff8365550505a464beb3b6ddaa41 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sat, 23 Feb 2013 17:35:33 +0100 Subject: remove support for weekly stock mail --- invoice/generate-invoice.py | 46 ++------------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/invoice/generate-invoice.py b/invoice/generate-invoice.py index 9592191..aa5072d 100755 --- a/invoice/generate-invoice.py +++ b/invoice/generate-invoice.py @@ -360,51 +360,9 @@ def backup(): send_mail(msg, "shop-backup@kreativitaet-trifft-technik.de") -def get_stock_data(): - connection = sqlite3.connect('shop.db') - c = connection.cursor() - result = [] - - c.execute("SELECT name,amount FROM products") - - for row in c: - result.append((row[0],row[1])) - - c.close() - - return result - -def gen_stock_asciitable(): - stock = get_stock_data() - longest_name = 0 - longest_amount = 0 - asciitable = "" - for element in stock: - if len(element[0]) > longest_name: - longest_name = len(element[0]) - if len(str(element[1])) > longest_amount: - longest_amount = len(str(element[1])) - - asciitable = "+-" + longest_name * "-" + "-+-" + longest_amount * "-" + "-+\n" - asciitable += "| " + "Produkt" + (longest_name - len("Produkt")) * " " + " | " + (longest_amount - 1) * " " + "#" + " |\n" - asciitable += "+-" + longest_name * "-" + "-+-" + longest_amount * "-" + "-+\n" - for product in stock: - asciitable += "| " + product[0] + (longest_name - len(product[0])) * " " + " | " + (longest_amount - len(str(product[1]))) * " " + str(product[1]) + " |\n" - asciitable += "+-" + longest_name * "-" + "-+-" + longest_amount * "-" + "-+\n" - - return asciitable - -def gen_stock_mail(): - msg = MIMEMultipart() - msg["From"] = "KtT-Shopsystem " - msg["To"] = "KtT Einkaufsteam " - msg["Subject"] = Header("Aktueller Warenbestand", 'utf-8') - msg.preamble = "Please use a MIME aware email client!" - msg.attach(MIMEText(gen_stock_asciitable(), 'plain', 'utf-8')) - return msg - def weekly(): - send_mail(gen_stock_mail(), "einkauf@kreativitaet-trifft-technik.de") + #send_mail("", "einkauf@kreativitaet-trifft-technik.de") + pass if sys.argv[1] == "daily": daily() -- cgit v1.2.3