Commit 506c6c06 authored by M3nt0r3's avatar M3nt0r3
Browse files

lavoro generale di pulizia, copyright, c311 e c308 + altri lavori

parent 536dc89f824b
File mode changed from 100644 to 100755
Most of the files are
Copyright (c) 2005-2015 by Promotux di Francesco Meloni snc - http://www.promotux.it/
Copyright (c) 2016 by Sublima s.r.l - http://www.sublima.it/
Many files also contain contributions from third
parties. In this case the original copyright of
the contributions can be traced through the
history of the source version control system.
When that is not the case, the files contain a prominent
notice stating the original copyright and applicable
license, or come with their own dedicated COPYRIGHT
and/or LICENSE file.
This diff is collapsed.
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
__author__ = "Francesco Meloni <francesco@promotux.it>"
import sys
import os
......
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2012,2011 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
__author__ = "Francesco Meloni <francesco@promotux.it>"
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
__author__ = "Francesco Meloni <francesco@promotux.it>"
import os
import sys
......@@ -35,13 +18,14 @@ if not os.path.exists(path):
if path not in sys.path:
sys.path.append(path)
from werkzeug.debug import DebuggedApplication
# from werkzeug.debug import DebuggedApplication
from promogest import preEnv
from promogest.lib.config import Config
preEnv.web = True
def bigbang(schema=None):
file_conf = "confs/"+schema
file_conf = "confs/" + schema
main_conf = Config(os.path.join(file_conf))
preEnv.main_conf_force = main_conf
from Sublima import SublimaWebApp
......@@ -52,9 +36,9 @@ def bigbang(schema=None):
return application
try:
application = bigbang(schema=os.environ['SCHEMAA']+".conf")
except:
application = bigbang(schema="demo.conf")
application = bigbang(schema=os.environ['SCHEMAA'] + ".conf")
except Exception:
application = bigbang(schema="c308.conf")
if __name__ == '__main__':
run_simple(
......@@ -65,4 +49,4 @@ if __name__ == '__main__':
use_debugger=True,
# processes = 10,
use_reloader=True,
extra_files=["confs/demo.conf"])
extra_files=["confs/c308.conf"])
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
__author__ = "Francesco Meloni <francesco@promotux.it>"
# -*- coding: utf-8 -*-
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
\ No newline at end of file
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
__author__ = "Francesco Meloni <francesco@promotux.it>"
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
#
# from __future__ import division
from web_lib.webutils import expose
from promogest.lib.utils import *
from promogest.dao.News import News
......@@ -39,11 +20,11 @@ def newsDetailByDenomination(req, subdomain=None, permalink=None):
next_news = Environment.session.query(News).order_by(
News.publication_date.asc()).filter(
News.publication_date > news[0].publication_date).filter(
News.active==True).first()
News.active == True).first()
prev_news = Environment.session.query(News).order_by(
News.publication_date.desc()).filter(
News.publication_date < news[0].publication_date).filter(
News.active==True).first()
News.active == True).first()
mo = news[0]
mo.clicks = int(mo.clicks or 0)+1
mo.persist()
......@@ -108,7 +89,7 @@ def newss_list(req, static=None, categoria=None):
@expose('/getNewsList')
def get_news_list(req, static=None, categoria=None):
batch = 10
batch = 5
page = req.args.get("page")
try:
page = int(page)
......@@ -136,7 +117,7 @@ def get_news_list(req, static=None, categoria=None):
searchkey=fullsearch,
idCategoria=categoria,
active=True)
pageData = {'file': 'main/blog_list',
pageData = {'file': 'main/_blog_list',
"newss": newss,
"newsscount": newsscount,
"page": page,
......
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
__author__ = "Francesco Meloni <francesco@promotux.it>"
from webEnv import *
from web_lib.page import Page
......@@ -28,9 +11,10 @@ from promogest.lib.utils import leggiListino, setconf, mN
from web_lib.session import Session
import datetime
from decimal import Decimal
@expose('/cart/<action>')
@expose('/view-cart/<action>')
@expose('/view-cart')
@expose('/cart')
def cart_action(req, action=None):
"""
TODO: CHECK PREZZO DETTAGLIO E INGROSSO NEI CARRELLI
......@@ -60,10 +44,10 @@ def cart_action(req, action=None):
pass
iduser = Session(req).getUserId()
listino_predefinito = setconf("Setup", "id_listino_predefinito")
#devi aggiungere la riga nella tabella setconf
# devi aggiungere la riga nella tabella setconf
if sessionid:
items = Cart().select(sessionid=sessionid,
idUser=iduser, batchSize=None)
idUser=iduser, batchSize=None)
tot = 0
for i in items:
l = leggiListino(idListino=listino_predefinito, idArticolo=i.id_articolo)
......@@ -71,10 +55,9 @@ def cart_action(req, action=None):
tot += l["prezzoIngrosso"]*i.quantita
else:
items = []
pageData = {'file': 'main/view-cart',
pageData = {'file': 'main/cart',
"itemss": items,
'tot': tot
}
'tot': tot}
return Page(req).render(pageData)
def __update_modal__(req, action=None):
......@@ -104,11 +87,9 @@ def cart_action(req, action=None):
"cart_numero_items": len(cart_items)}
return Page(req).render(pageData)
def __create__update__(req, action=None):
""" """
# print("ARGOMENTI ARGS E FORM", req.args, req.form.to_dict())
print("ARGOMENTI ARGS E FORM", req.args, req.form.to_dict())
listino_predefinito = setconf("Setup", "id_listino_predefinito")
for q, v in req.form.to_dict().iteritems():
idarticolo = int(q.split("_")[1])
......@@ -146,7 +127,7 @@ def cart_action(req, action=None):
sessionid = req.cookies[COOKIENAME]
if sessionid:
rigghe = Cart().count(sessionid=sessionid,
idUser=iduser, batchSize=None)
idUser=iduser, batchSize=None)
items = Cart().select(sessionid=sessionid,
idUser=iduser, batchSize=None)
cart_tot = 0
......@@ -155,11 +136,10 @@ def cart_action(req, action=None):
cart_tot += l["prezzoDettaglio"] * Decimal(i.quantita)
item = {"Result": "OK",
"Items": rigghe,
"cart_tot": str(mN(cart_tot,2))}
"cart_tot": str(mN(cart_tot, 2))}
jasoned = json.dumps(item)
return Response(jasoned)
def __delete__(req, action=None):
"""Cancella una riga"""
id = int(req.args.get("item"))
......@@ -175,7 +155,5 @@ def cart_action(req, action=None):
return __delete__(req, action=action)
elif action == "update_modal":
return __update_modal__(req, action=action)
else:
return __show__(req, action=action)
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
__author__ = "Francesco Meloni <francesco@promotux.it>"
from webEnv import *
from web_lib.page import Page
......@@ -41,12 +24,10 @@ from promogest.dao.Multiplo import Multiplo
from promogest.dao.TestataDocumento import TestataDocumento
from promogest.dao.RigaDocumento import RigaDocumento
from promogest.dao.ScontoTestataDocumento import ScontoTestataDocumento
import datetime
from promogest.lib import utils
@expose('/checkout')
@expose('/checkout/<action>')
def checkout_action(req, action=None):
......@@ -97,8 +78,7 @@ def checkout_action(req, action=None):
"cliente": cliente,
"cart_items": items,
'tot': tot,
"tipo": None
}
"tipo": None}
return Page(req).render(pageData)
def __order_store__(req, action=None):
......@@ -112,10 +92,10 @@ def checkout_action(req, action=None):
if cliente:
cliente = cliente[0]
else:
cliente = None
cliente = None
if not cliente:
return __show__(req, action=action)
id_cliente = cliente.id #req.form.get("id_cliente")
id_cliente = cliente.id # req.form.get("id_cliente")
# professionista = cliente.ragione_sociale
tipoPagamento = req.form.get("tipo_pagamento")
daoCliente = cliente
......@@ -130,7 +110,7 @@ def checkout_action(req, action=None):
newDao.id_destinazione_merce = daoCliente.dm[0].id
else:
newDao.id_destinazione_merce = None
if tipoPagamento =="BONIFICO": #contrassegno
if tipoPagamento =="BONIFICO": # contrassegno
newDao.id_pagamento = setconf("Setup", "id_pagamento_bonifico")
elif tipoPagamento == "PAYPAL":
newDao.id_pagamento = setconf("Setup", "id_pagamento_paypal")
......@@ -145,7 +125,7 @@ def checkout_action(req, action=None):
newDao.incaricato_trasporto = None
newDao.totale_colli = 1
newDao.totale_peso = None
newDao.note_interne = "" #professionista
newDao.note_interne = "" # professionista
newDao.note_pie_pagina = ""
newDao.applicazione_sconti = "scalare"
scontiSuTotale = []
......@@ -209,7 +189,7 @@ def checkout_action(req, action=None):
newDao.righeDocumento = righeDocumento
if len(righeDocumento) > 0:
newDao.persist()
#rimuovo le righe dal carrello
# rimuovo le righe dal carrello
# email_conf = AccountEmail().select(denominazioneEM="email_ordine")
# if email_conf:
# email_conf = email_conf[0]
......@@ -232,15 +212,15 @@ def checkout_action(req, action=None):
pageData = {
"cliente": daoCliente,
"cart_items": cart_items,
"cart_tot": mNLC(cart_tot,2),
"cart_iva_tot" : mNLC(cart_iva_tot,2),
"cart_imponibile_tot": mNLC(cart_imponibile_tot,2),
"tipo":metodo_pagamento,
"mov" : numero,
"cart_tot": mNLC(cart_tot, 2),
"cart_iva_tot": mNLC(cart_iva_tot, 2),
"cart_imponibile_tot": mNLC(cart_imponibile_tot, 2),
"tipo": metodo_pagamento,
"mov": numero,
}
jinja_env.globals['utils'] = utils
html = jinja_env.from_string(html).render(pageData=pageData)
subject= "Ordine {0}".format(setconf("Public","title"))
subject = "Ordine {0}".format(setconf("Public", "title"))
do_send_mail(html=html,subj=subject)
do_send_mail(a=cliente.email_principale, html=html, subj=subject)
if metodo_pagamento == "PAYPAL":
......@@ -275,7 +255,6 @@ def checkout_action(req, action=None):
r.delete()
return Page(req).render(pageData)
def __delete__(req, action=None):
"""Cancella una riga"""
id = int(req.args.get("item"))
......@@ -297,4 +276,3 @@ def checkout_action(req, action=None):
return __preview__(req, action=action)
else:
return __show__(req, action=action)
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
__author__ = "Francesco Meloni <francesco@promotux.it>"
import hashlib
import datetime
......@@ -37,6 +20,7 @@ from promogest.dao.daoContatti.Contatto import Contatto
from promogest.modules.RuoliAzioni.dao.Role import Role
from promogest.lib.utils import prep2json
@expose("/client_registration")
def client_registration(req):
iduser = Session(req).getUserId()
......@@ -116,4 +100,4 @@ def client_registration(req):
item = {"Result": "OK",
"Message": "La tua registrazione come cliente è andata a buon fine, Grazie"}
jasoned = json.dumps(item)
return Response(jasoned)
\ No newline at end of file
return Response(jasoned)
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
__author__ = "Francesco Meloni <francesco@promotux.it>"
from web_lib.page import Page
from web_lib.webutils import expose, permalinkaTitle
@expose('/cms/<pages>')
def staticpages(req,pages=None, subdomain=None):
def staticpages(req, pages=None, subdomain=None):
""" Funzione per la visualizzazione pagine statiche """
from promogest.dao.StaticPages import StaticPages
staticPages = StaticPages(req=req).select(permalink=pages)
......@@ -41,7 +24,7 @@ def staticpages(req,pages=None, subdomain=None):
else:
title = "Pagina non presente"
pageData = {'file': 'main/static',
'staticPages' : staticPages,
'staticPages': staticPages,
"page_title": title,
"bodyTags":["staticPages"]}
"bodyTags": ["staticPages"]}
return Page(req).render(pageData)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2014 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
__author__ = "Francesco Meloni <francesco@promotux.it>"
from web_lib.page import Page
from web_lib.webutils import Response, expose
......@@ -29,6 +9,7 @@ from promogest.dao.User import User
from promogest.dao.ConfirmRegistration import ConfirmRegistration
from promogest.dao.Cart import Cart
@expose('/code/<codice>')
def codeConfirm(req, codice=None):
""" Home page """
......
# -*- coding: utf-8 -*-
# Part of Sublima. See LICENSE file for full copyright and licensing details.
# Copyright (C) 2005-2015 by Promotux
# di Francesco Meloni snc - http://www.promotux.it/
# Author: Francesco Meloni <francesco@promotux.it>
# This file is part of Promogest.
# Promogest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# Promogest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Promogest. If not, see <http://www.gnu.org/licenses/>.
__author__ = "Francesco Meloni <francesco@promotux.it>"
import hashlib
import datetime
from sqlalchemy.orm import *
from promogest.dao.User import User
from promogest.dao.AccountEmail import AccountEmail
from web_lib.webutils import *
from web_lib.mailHandler import *
# from web_lib.mailHandler import SendMail
from web_lib.session import Session
from web_lib.page import Page
......@@ -54,7 +35,7 @@ def contacts(req, static=None, subdomain=None):
email = req.form.get('email')
phone = req.form.get('phone')
body = req.form.get('body')