aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2022-12-29 11:29:07 +0100
committerAndrea Lepori <alepori@student.ethz.ch>2022-12-29 11:29:08 +0100
commit41e5d5870df06dce58e08b644c22bbb8ada8dc84 (patch)
tree2820d4a8ef3af441801cd838130c34756f5e9f42
parentnew way to select groups that can be overridden (diff)
parentremove unarchive, enable archive unapproved docs (diff)
downloadscout-subs-41e5d5870df06dce58e08b644c22bbb8ada8dc84.tar.gz
scout-subs-41e5d5870df06dce58e08b644c22bbb8ada8dc84.zip
Merge branch 'master' into dev
Diffstat (limited to '')
-rw-r--r--server/templates/server/doc_list.html9
-rw-r--r--server/templates/server/doc_list_readonly.html6
-rw-r--r--server/views.py66
-rw-r--r--version.txt2
4 files changed, 56 insertions, 27 deletions
diff --git a/server/templates/server/doc_list.html b/server/templates/server/doc_list.html
index 45ea6e0..06c8893 100644
--- a/server/templates/server/doc_list.html
+++ b/server/templates/server/doc_list.html
@@ -17,7 +17,7 @@
</a>
</li>
<li><a class="tooltipped modal-trigger" href="#modal2" data-position="top" data-tooltip="Archivia selezionati"><i class="material-icons">archive</i></a></li>
- <li><a class="tooltipped" data-position="top" data-tooltip="Dearchivia selezionati" Onclick="send('unarchive')"><i class="material-icons">unarchive</i></a></li>
+ <!--<li><a class="tooltipped" data-position="top" data-tooltip="Dearchivia selezionati" Onclick="send('unarchive')"><i class="material-icons">unarchive</i></a></li>-->
<li><a class="tooltipped modal-trigger" href="#modal3" data-position="top" data-tooltip="Scarica selezionati" Onclick="send('download')"><i class="material-icons">file_download</i></a></li>
{% if settings.DEBUG %}
<li><a class="tooltipped" data-position="top" data-tooltip="Approva selezionati" Onclick="send('approve')"><i class="material-icons left">check</i>DEBUG</a></li>
@@ -38,6 +38,7 @@
<div class="modal-content">
<h4>Attenzione</h4>
<p>
+ Una volta archiviato un documento non potrà più essere dearchiviato.<br>
Se il documento contine dati medici quando archiviato tutti i dati medici verranno eliminati.
</p>
</div>
@@ -619,7 +620,9 @@ $('#select-all').click(function(event) {
if(this.checked) {
// Iterate each checkbox
$('.allselect').each(function() {
- this.checked = true;
+ if (!this.hidden) {
+ this.checked = true;
+ }
});
} else {
$('.allselect').each(function() {
@@ -667,9 +670,11 @@ function filterResults(group_name) {
for (i = 0; i < items.length; i++) {
var a = items[i].children[0];
+ var checkBox = items[i].children[1].children[0].children[0];
var txtValue = a.value;
if (txtValue == group_name) {
items[i].style.display = action;
+ checkBox.hidden = (action == "none");
}
}
}
diff --git a/server/templates/server/doc_list_readonly.html b/server/templates/server/doc_list_readonly.html
index ac1ae6d..c29fb74 100644
--- a/server/templates/server/doc_list_readonly.html
+++ b/server/templates/server/doc_list_readonly.html
@@ -600,7 +600,9 @@ $('#select-all').click(function(event) {
if(this.checked) {
// Iterate each checkbox
$('.allselect').each(function() {
- this.checked = true;
+ if (!this.hidden) {
+ this.checked = true;
+ }
});
} else {
$('.allselect').each(function() {
@@ -648,9 +650,11 @@ function filterResults(group_name) {
for (i = 0; i < items.length; i++) {
var a = items[i].children[0];
+ var checkBox = items[i].children[1].children[0].children[0];
var txtValue = a.value;
if (txtValue == group_name) {
items[i].style.display = action;
+ checkBox.hidden = (action == "none");
}
}
}
diff --git a/server/views.py b/server/views.py
index e9ca0c2..d295de6 100644
--- a/server/views.py
+++ b/server/views.py
@@ -1094,23 +1094,19 @@ def doclist(request):
docc.status = 'ok'
docc.save()
elif request.POST["action"] == 'archive':
- if docc.status == 'ok':
- docc.status = 'archive'
- if docc.medical_data:
- docc.medical_data.delete()
- docc.medical_data.save()
- docc.medical_data = None
- docc.save()
- else:
- error = True
- error_text = "Non puoi archiviare un documento non approvato"
- elif request.POST["action"] == 'unarchive':
- if docc.status == 'archive':
- docc.status = 'ok'
- docc.save()
- else:
- error = True
- error_text = "Non puoi dearchiviare un documento non archiviato"
+ docc.status = 'archive'
+ if docc.medical_data:
+ docc.medical_data.delete()
+ docc.medical_data.save()
+ docc.medical_data = None
+ docc.save()
+ #elif request.POST["action"] == 'unarchive':
+ # if docc.status == 'archive':
+ # docc.status = 'ok'
+ # docc.save()
+ # else:
+ # error = True
+ # error_text = "Non puoi dearchiviare un documento non archiviato"
# get filter values
hidden = "filter_hidden" in request.POST
@@ -1621,10 +1617,11 @@ def docpreview(request):
# get document
document = Document.objects.filter(code=code)[0]
- parent_group = document.user.groups[0]
+ doc_group = document.group.name
+ parent_group = document.user.groups.values_list('name', flat=True)[0]
# user has not permission to view document
- if parent_group not in groups:
+ if doc_group not in groups:
return
# prepare images in base64
@@ -1671,7 +1668,8 @@ def data_request(request):
data = ", ".join(users_email)
context["data"] = data
elif request.POST["request"] == "data_user":
- users = User.objects.filter(groups=parent_group)
+ perm = Permission.objects.get(codename="approved")
+ users = User.objects.filter(groups__name=parent_group, user_permissions=perm)
# get time for filename
current_time = datetime.strftime(datetime.now(), "%H_%M__%d_%m_%y")
@@ -1682,10 +1680,20 @@ def data_request(request):
writer = csv.writer(response)
# csv header
- writer.writerow(["Codice", "Nome", "Cognome", "Email", "Nome dei genitori", "Via", "CAP", "Comune", "Nazionalita", "Data di nascita", "Telefono di casa", "Telefono", "Scuola", "Anno scolastico", "Numero AVS"])
+ writer.writerow(["Codice", "Nome", "Cognome", "Email", "Nome dei genitori", "Indirizzo", "NAP", "Luogo", "Nazionalita", "Nazionalità secondo G+S", "Data di nascita", "numero di telefono Altro", "numero di telefono Cellulare", "Scuola", "Classe scolastica", "Numero AVS"])
for user in users:
usercode = UserCode.objects.filter(user=user)[0]
+ nationality = usercode.nationality
+
+ nat_gs = ""
+ if "svizzera" in nationality.lower():
+ nat_gs = "CH"
+ elif "ch" == nationality.lower():
+ nat_gs = "CH"
+ else:
+ nat_gs = "DIV"
+
writer.writerow([
"U"+str(usercode.code),
user.first_name,
@@ -1696,6 +1704,7 @@ def data_request(request):
usercode.cap,
usercode.country,
usercode.nationality,
+ nat_gs,
usercode.born_date,
usercode.home_phone,
usercode.phone,
@@ -1707,7 +1716,8 @@ def data_request(request):
return response
elif request.POST["request"] == "data_user_medic":
- users = User.objects.filter(groups=parent_group)
+ perm = Permission.objects.get(codename="approved")
+ users = User.objects.filter(groups__name=parent_group, user_permissions=perm)
# get time for filename
current_time = datetime.strftime(datetime.now(), "%H_%M__%d_%m_%y")
@@ -1718,11 +1728,20 @@ def data_request(request):
writer = csv.writer(response)
# csv header
- writer.writerow(["Codice", "Nome", "Cognome", "Email", "Nome dei genitori", "Via", "CAP", "Comune", "Nazionalita", "Data di nascita", "Telefono di casa", "Telefono", "Scuola", "Anno scolastico", "Numero AVS", "Contatto d'emergenza", "Parentela del contatto", "Telefono d'emergenza", "Cellulare emergenza", "Indirizzo completo emergenza", "Cassa malati", "Ass. Infortuni", "Ass. RC", "Socio REGA", "Nome del medico", "Telefono medico", "Indirizzo medico", "Malattie", "Vacinazioni", "Data antitetanica", "Allergie", "Assume medicamenti", "Medicamenti", "Informazioni particolari", "Informazioni"])
+ writer.writerow(["Codice", "Nome", "Cognome", "Email", "Nome dei genitori", "Indirizzo", "NAP", "Luogo", "Nazionalita", "Nazionalità secondo G+S", "Data di nascita", "numero di telefono Altro", "numero di telefono Cellulare", "Scuola", "Classe scolastica", "Numero AVS", "Contatto d'emergenza", "Parentela del contatto", "Telefono d'emergenza", "Cellulare emergenza", "Indirizzo completo emergenza", "Cassa malati", "Ass. Infortuni", "Ass. RC", "Socio REGA", "Nome del medico", "Telefono medico", "Indirizzo medico", "Malattie", "Vacinazioni", "Data antitetanica", "Allergie", "Assume medicamenti", "Medicamenti", "Informazioni particolari", "Informazioni"])
for user in users:
usercode = UserCode.objects.filter(user=user)[0]
medic = usercode.medic
+
+ nat_gs = ""
+ if "svizzera" in nationality.lower():
+ nat_gs = "CH"
+ elif "ch" == nationality.lower():
+ nat_gs = "CH"
+ else:
+ nat_gs = "DIV"
+
writer.writerow([
"U"+str(usercode.code),
user.first_name,
@@ -1733,6 +1752,7 @@ def data_request(request):
usercode.cap,
usercode.country,
usercode.nationality,
+ nat_gs,
usercode.born_date,
usercode.home_phone,
usercode.phone,
diff --git a/version.txt b/version.txt
index 13d18eb..9553714 100644
--- a/version.txt
+++ b/version.txt
@@ -1,2 +1,2 @@
version=0.6
-rev=12
+rev=14