bygdis.fi

git clone https://git.tarina.org/bygdis.fi
Log | Files | Refs | README

commit 68bbc8e6a537be23d63eecad5b79a4b9a629780d
parent 70e37b0d8c8caabed23210facbd8d19a51b177ff
Author: rob <rob@tarina.org>
Date:   Tue,  2 May 2023 15:11:28 +0300

fakturera för dörrkod och radera bokningar

Diffstat:
MREADME | 0
Mserver.py | 23++++++++++++-----------
2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/README b/README diff --git a/server.py b/server.py @@ -279,7 +279,7 @@ def sendmail(email, subject, msg, bilaga): if bilaga != '': sendmsg = subprocess.check_output(('mail.mailutils', '-A', bilaga, '-a', 'From:'+postadmin, '-r', postadmin, '-s', subject, email),stdin=echomsg.stdout) else: - sendmsg = subprocess.check_output(('mail', '-r', postadmin, '-s', subject, email), stdin=echomsg.stdout) + sendmsg = subprocess.check_output(('mail.mailutils', '-r', postadmin, '-a', 'From:'+postadmin, '-s', subject, email), stdin=echomsg.stdout) echomsg.wait() #subprocess.call(['echo', msg, '|', 'mail', '-r', 'rob@tarina.org','-s', subject, email]) @@ -373,7 +373,8 @@ class admin(): if i.doorcode != None: raise web.seeother('/admin?kakka') if i.remove != None: - raise web.seeother('/admin?kakka') + db.update('bokningar', where='id="'+i.remove+'"', deleted=1) + raise web.seeother('/admin') if i.emptytrash == 'now': db.update('roskis', where='id=1',datum=datetime.datetime.now()) raise web.seeother('/admin') @@ -419,7 +420,7 @@ class boka(): now = datetime.datetime.now() form_boka.fill(year=now.year, month=now.month, day=now.day) if i.kod=='jep': - form_boka.fill(year=now.year, month=now.month, day=now.day ,boka='Dörrkod / Ovikoodi | 15.00 €', privat='Privat', event='Dörrkod för användning av Bygdegården i privat syfte.') + form_boka.fill(year=now.year, month=now.month, day=now.day ,boka='Dörrkod / Ovikoodi | 10.00 €', privat='Privat', event='Dörrkod för användning av Bygdegården i privat syfte.') else: event = db.select('bokningar', where='bokningshash="'+i.id+'"')[0] now=datetime.datetime.strptime(event.datumtid, '%Y-%m-%d %H:%M:%S') @@ -483,7 +484,7 @@ class fakturor(): subprocess.check_output(login_mlinvoice) #yes # - if i.add == 'faktura' and i.epost != '' and i.kund != '' and i.produkt != None: + if i.add == 'faktura' and i.epost != None and i.kund != None and i.produkt != None: url='https://bygdis.fi/static/mlinvoice/copy_invoice.php' copy_mlinvoice = ['curl','-b','X', url , '-i', '-b', basedir+'/sessions/cookies.txt', '-c',basedir+'/sessions/cookies.txt', '-d', 'id=40'] viewfile = subprocess.check_output(copy_mlinvoice) @@ -505,15 +506,14 @@ class fakturor(): try: payer = db2.select('mlinvoice_company', where='email="'+str(i.epost)+'"')[0] except: - db.insert('mlinvoice_company', email=i.epost, company_name=i.kund) + db2.insert('mlinvoice_company', email=i.epost, company_name=i.kund) + payer = db2.query("SELECT * FROM mlinvoice_company ORDER BY id DESC LIMIT 1;")[0] #LÄGG TILL VAROR # produkt=getprodukt(i.produkt) pris=produkt.unit_price db2.insert('mlinvoice_invoice_row', invoice_id=senaste.id, product_id=produkt.id, pcs=1.00, price=float(pris)) # - print(payer.id) - print(payer.company_name) db2.update('mlinvoice_invoice',where='id="'+str(senaste.id)+'"', invoice_no=invoice['invoice_no'], ref_number=invoice['ref_no'], company_id=payer.id, state_id=2) # #### Skicka epost @@ -887,7 +887,7 @@ class nydorrkod(): raise web.seeother('/nydorrkod?fail=namn') if '@' not in i.mail: raise web.seeother('/nydorrkod?fail=notmail') - if i.dorrkod == None: + if i.dorrkod == None or i.dorrkod == '': dorrkod = random.randint(1111,9999) elif isinstance(int(i.dorrkod), int) and len(i.dorrkod) == 4: dorrkod = str(i.dorrkod) @@ -1351,6 +1351,7 @@ class protokoll(): webdata = web.input(year=None, nr=0, cp=None, rm=None, pdf=None) view = '' years = os.listdir(basedir + '/protokoll/') + years.remove('.gitignore') years.sort() if webdata.year: protokoll = getprotokoll(webdata.year) @@ -1373,8 +1374,8 @@ class protokoll(): if webdata.pdf == "protokoll": randhash = hashlib.md5(str(random.getrandbits(256)).encode('utf-8')).hexdigest() pandoc_pdf = ['pandoc', '--verbose', basedir + '/protokoll/' + webdata.year + '/' + protokoll[int(webdata.nr)], '-f', 'markdown', '-V', 'papersize:a4', '-V', 'geometry:margin=0.8in','-s', '-o', basedir + '/public_html/static/pdf/'+randhash+'.pdf'] - subprocess.Popen(pandoc_pdf, cwd=basedir + '/public_html/static/pdf/') - time.sleep(3) + process=subprocess.Popen(pandoc_pdf, cwd=basedir + '/public_html/static/pdf/') + process.wait() raise web.seeother('/static/pdf/'+randhash+'.pdf?nocache='+randhash) #read protokoll read_p=basedir + '/protokoll/' + webdata.year + '/' + protokoll[int(webdata.nr)] @@ -1398,7 +1399,7 @@ class protokoll(): with open(write_p, 'w') as file: file.write(i.protokoll) print('ADDDDDDDDDDDDDING TO database post ' + i.protokoll) - raise web.seeother('/protokoll?year='+i.year+'&nr='+i.nr) + raise web.seeother('/protokoll?year='+str(i.year)+'&nr='+str(i.nr)) else: raise web.seeother('/login')