2017-06-28 23:55:53 -05:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
from . import main
|
|
|
|
|
|
|
|
|
|
|
|
class StorageEngine(object):
|
|
|
|
|
|
|
|
def __init__(self):
|
2017-09-30 23:14:44 -05:00
|
|
|
pass
|
2017-06-28 23:55:53 -05:00
|
|
|
|
2017-09-21 23:24:18 -05:00
|
|
|
def authenticate(self, args):
|
2017-09-30 23:14:44 -05:00
|
|
|
return main.authenticate(args)
|
2017-06-28 23:55:53 -05:00
|
|
|
|
2017-10-02 00:12:22 -05:00
|
|
|
def get_values(self, table, values=None):
|
|
|
|
return getattr(self, '_get_{}'.format(table))(values)
|
|
|
|
|
|
|
|
def _get_cp(self, values):
|
|
|
|
return main.get_cp(values['cp'])
|
|
|
|
|
|
|
|
def _get_formapago(self, values):
|
|
|
|
return main.SATFormaPago.get_activos()
|
|
|
|
|
2017-06-28 23:55:53 -05:00
|
|
|
def get_partners(self, values):
|
|
|
|
return main.get_partners(values)
|
|
|
|
|
|
|
|
def new_partner(self, values):
|
|
|
|
return main.new_partner(values)
|
|
|
|
|
|
|
|
def update_partner(self, values):
|
|
|
|
id = int(values['id'])
|
|
|
|
del values['id']
|
|
|
|
fields = util.clean(values)
|
|
|
|
fields['rfc'] = fields['rfc'].upper()
|
|
|
|
q = Clients.update(**values).where(Clients.id==id)
|
|
|
|
q.execute()
|
|
|
|
row = {
|
|
|
|
'id': id,
|
|
|
|
'cia': fields['cia'],
|
|
|
|
'rfc': fields['rfc'],
|
|
|
|
'name': fields['name'],
|
|
|
|
}
|
|
|
|
data = {'ok': True, 'row': row, 'new': False}
|
|
|
|
return data
|
|
|
|
|
|
|
|
def delete_partner(self, id):
|
|
|
|
q = Clients.delete().where(Clients.id==id)
|
|
|
|
return bool(q.execute())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|