|
@@ -76,6 +76,24 @@ def welcome(request,utente=None):
|
|
|
eol = getConfig('DocEol')
|
|
eol = getConfig('DocEol')
|
|
|
data['eol'] = eol
|
|
data['eol'] = eol
|
|
|
|
|
|
|
|
|
|
+ ElencoDocumenti = list()
|
|
|
|
|
+ if utente: #visualizza i documenti per l'utente
|
|
|
|
|
+ ElencoDocumenti = Documento.objects.filter(utente=utente).order_by("utente__nome","documento")
|
|
|
|
|
+ elif sede:
|
|
|
|
|
+ tmpUtenti = sede.utente_set.all()
|
|
|
|
|
+ for t in tmpUtenti:
|
|
|
|
|
+ d = t.documento_set.all()
|
|
|
|
|
+ for id in d:
|
|
|
|
|
+ ElencoDocumenti.append(id)
|
|
|
|
|
+ else:
|
|
|
|
|
+ tmpUtenti = azienda.utente_set.all()
|
|
|
|
|
+ for t in tmpUtenti:
|
|
|
|
|
+ d = t.documento_set.all()
|
|
|
|
|
+ for id in d:
|
|
|
|
|
+ ElencoDocumenti.append(id)
|
|
|
|
|
+
|
|
|
|
|
+ data['ElencoDocumenti'] = ElencoDocumenti
|
|
|
|
|
+
|
|
|
if request.method == 'POST':
|
|
if request.method == 'POST':
|
|
|
|
|
|
|
|
if 'indietro' in request.POST:
|
|
if 'indietro' in request.POST:
|
|
@@ -83,6 +101,26 @@ def welcome(request,utente=None):
|
|
|
print("AdminId",request.session['AdminId'])
|
|
print("AdminId",request.session['AdminId'])
|
|
|
return HttpResponseRedirect(reverse("azienda:welcome"))
|
|
return HttpResponseRedirect(reverse("azienda:welcome"))
|
|
|
|
|
|
|
|
|
|
+ if 'ScaricaSelezionati' in request.POST:
|
|
|
|
|
+ print('Premuto tasto Scarica Selezionati')
|
|
|
|
|
+ print('request',request.POST)
|
|
|
|
|
+ if 'select' in request.POST:
|
|
|
|
|
+ SelectResponse = formMultipleCheckBox(request.POST)
|
|
|
|
|
+ SelectResponse.c(data['ElencoDocumenti'])
|
|
|
|
|
+ print("SelectResponse",SelectResponse)
|
|
|
|
|
+
|
|
|
|
|
+ if SelectResponse.is_valid():
|
|
|
|
|
+ select = SelectResponse.cleaned_data.get('select')
|
|
|
|
|
+ print('select',select,type(select))
|
|
|
|
|
+ (pathzipfile,filePreparato) = PrepareZipFile(select)
|
|
|
|
|
+ # scarica il file
|
|
|
|
|
+ response = None
|
|
|
|
|
+ with open(os.path.join(pathzipfile,filePreparato),'rb') as f:
|
|
|
|
|
+ response = HttpResponse(f.read(),content_type='application/zip')
|
|
|
|
|
+ response['Content-Disposition'] = 'attachment; filename={}'.format(filePreparato)
|
|
|
|
|
+ os.unlink(os.path.join(pathzipfile,filePreparato))
|
|
|
|
|
+ return response
|
|
|
|
|
+
|
|
|
if 'DeleteOldDocuments' in request.POST:
|
|
if 'DeleteOldDocuments' in request.POST:
|
|
|
print('Richiesta di eliminazione vecchi documenti')
|
|
print('Richiesta di eliminazione vecchi documenti')
|
|
|
dods = DeleteOldDocuments(request.POST)
|
|
dods = DeleteOldDocuments(request.POST)
|
|
@@ -174,7 +212,7 @@ def welcome(request,utente=None):
|
|
|
sm.send()
|
|
sm.send()
|
|
|
### comunicazioni ###
|
|
### comunicazioni ###
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ '''
|
|
|
ElencoDocumenti = list()
|
|
ElencoDocumenti = list()
|
|
|
if utente: #visualizza i documenti per l'utente
|
|
if utente: #visualizza i documenti per l'utente
|
|
|
ElencoDocumenti = Documento.objects.filter(utente=utente).order_by("utente__nome","documento")
|
|
ElencoDocumenti = Documento.objects.filter(utente=utente).order_by("utente__nome","documento")
|
|
@@ -192,7 +230,7 @@ def welcome(request,utente=None):
|
|
|
ElencoDocumenti.append(id)
|
|
ElencoDocumenti.append(id)
|
|
|
|
|
|
|
|
data['ElencoDocumenti'] = ElencoDocumenti
|
|
data['ElencoDocumenti'] = ElencoDocumenti
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if request.method == "POST":
|
|
if request.method == "POST":
|
|
|
if 'ScaricaSelezionati' in request.POST:
|
|
if 'ScaricaSelezionati' in request.POST:
|
|
|
print('Premuto tasto Scarica Selezionati')
|
|
print('Premuto tasto Scarica Selezionati')
|
|
@@ -213,7 +251,7 @@ def welcome(request,utente=None):
|
|
|
response['Content-Disposition'] = 'attachment; filename={}'.format(filePreparato)
|
|
response['Content-Disposition'] = 'attachment; filename={}'.format(filePreparato)
|
|
|
os.unlink(os.path.join(pathzipfile,filePreparato))
|
|
os.unlink(os.path.join(pathzipfile,filePreparato))
|
|
|
return response
|
|
return response
|
|
|
-
|
|
|
|
|
|
|
+ '''
|
|
|
|
|
|
|
|
print("Numero documenti associati",len(ElencoDocumenti),len(data['ElencoDocumenti']))
|
|
print("Numero documenti associati",len(ElencoDocumenti),len(data['ElencoDocumenti']))
|
|
|
|
|
|