forked from elmau/empresa-libre
Fix - Issue #149
This commit is contained in:
commit
83dff5bc5f
|
@ -1573,6 +1573,24 @@ def crear_db(nombre):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def _backup_db(user):
|
||||||
|
dt = datetime.datetime.now().strftime('%y%m%d_%H%M')
|
||||||
|
path_bk = _join(PATH_MEDIA, 'tmp', '{}_{}.bk'.format(user, dt))
|
||||||
|
args = 'pg_dump -U postgres -Fc {} > "{}"'.format(user, path_bk)
|
||||||
|
_call(args)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
|
def delete_db(user, bk=True):
|
||||||
|
if bk:
|
||||||
|
_backup_db(user)
|
||||||
|
args = 'psql -U postgres -c "DROP DATABASE {0};"'.format(user)
|
||||||
|
_call(args)
|
||||||
|
args = 'psql -U postgres -c "DROP ROLE {0};"'.format(user)
|
||||||
|
_call(args)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
def _to_seafile(path_db, data):
|
def _to_seafile(path_db, data):
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
return
|
return
|
||||||
|
|
|
@ -5325,6 +5325,7 @@ def _borrar_rfc():
|
||||||
confirm = input('¿Estás seguro de borrar el RFC?')
|
confirm = input('¿Estás seguro de borrar el RFC?')
|
||||||
|
|
||||||
if _delete_emisor(rfc):
|
if _delete_emisor(rfc):
|
||||||
|
util.delete_db(rfc.lower())
|
||||||
log.info('RFC borrado correctamente...')
|
log.info('RFC borrado correctamente...')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -5393,7 +5394,9 @@ def empresa_agregar(rfc, no_bd):
|
||||||
|
|
||||||
|
|
||||||
def empresa_borrar(rfc):
|
def empresa_borrar(rfc):
|
||||||
return _delete_emisor(rfc)
|
if _delete_emisor(rfc):
|
||||||
|
util.delete_db(rfc.lower())
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def _importar_valores(archivo='', rfc=''):
|
def _importar_valores(archivo='', rfc=''):
|
||||||
|
|
Loading…
Reference in New Issue