diff --git a/sapl/base/templatetags/common_tags.py b/sapl/base/templatetags/common_tags.py
index 10b1a7054..13beb2924 100644
--- a/sapl/base/templatetags/common_tags.py
+++ b/sapl/base/templatetags/common_tags.py
@@ -51,6 +51,12 @@ def model_verbose_name_plural(class_name):
model = get_class(class_name)
return model._meta.verbose_name_plural
+@register.filter
+def format_user(user):
+ if user.first_name:
+ return user.username + " - " + user.first_name + " " + user.last_name
+ else:
+ return user.username
@register.filter
def meta_model_value(instance, attr):
@@ -363,3 +369,4 @@ def dont_break_out(value):
_safe = '
{}
'.format(value)
_safe = mark_safe(_safe)
return _safe
+
diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py
index 23280c436..70c5a82be 100644
--- a/sapl/materia/forms.py
+++ b/sapl/materia/forms.py
@@ -2607,6 +2607,8 @@ class ConfirmarProposicaoForm(ProposicaoForm):
protocolo.ano = timezone.now().year
protocolo.tipo_protocolo = '1'
+ protocolo.user = proposicao.user
+ protocolo.de_proposicao = True
protocolo.interessado = str(proposicao.autor)[
:200] # tamanho máximo 200
diff --git a/sapl/protocoloadm/migrations/0038_auto_20211025_1657.py b/sapl/protocoloadm/migrations/0038_auto_20211025_1657.py
new file mode 100644
index 000000000..f2693082a
--- /dev/null
+++ b/sapl/protocoloadm/migrations/0038_auto_20211025_1657.py
@@ -0,0 +1,26 @@
+# Generated by Django 2.2.24 on 2021-10-25 19:57
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('protocoloadm', '0037_auto_20210209_1047'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='protocolo',
+ name='de_proposicao',
+ field=models.BooleanField(default=False),
+ ),
+ migrations.AddField(
+ model_name='protocolo',
+ name='user',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL, verbose_name='Usuário'),
+ ),
+ ]
diff --git a/sapl/protocoloadm/models.py b/sapl/protocoloadm/models.py
index 5e6142f86..dbf61af2d 100644
--- a/sapl/protocoloadm/models.py
+++ b/sapl/protocoloadm/models.py
@@ -83,6 +83,14 @@ class Protocolo(models.Model):
verbose_name=_('IP'),
help_text=_('Endereço IP da estação de trabalho do usuário que está realizando Protocolo e '
'informando data e hora manualmente.'))
+ user = models.ForeignKey(
+ get_settings_auth_user_model(),
+ verbose_name=_('Usuário'),
+ on_delete=models.PROTECT,
+ null=True,
+ blank=True
+ )
+ de_proposicao = models.BooleanField(default=False)
# Não foi utilizado auto_now_add=True em timestamp porque ele usa datetime.now que não é timezone aware.
timestamp = models.DateTimeField(
null=True,
diff --git a/sapl/protocoloadm/views.py b/sapl/protocoloadm/views.py
index 35cb9ba2b..45180a5bc 100755
--- a/sapl/protocoloadm/views.py
+++ b/sapl/protocoloadm/views.py
@@ -599,6 +599,7 @@ class ProtocoloDocumentoView(PermissionRequiredMixin,
def get_initial(self):
initial = super().get_initial()
+ initial['user'] = self.request.user.username
initial['user_data_hora_manual'] = self.request.user.username
initial['ip_data_hora_manual'] = get_client_ip(self.request)
initial['data'] = timezone.localdate(timezone.now())
@@ -663,6 +664,7 @@ class ProtocoloDocumentoView(PermissionRequiredMixin,
protocolo.ano = timezone.now().year
protocolo.assunto_ementa = self.request.POST['assunto']
+ protocolo.user = self.request.user
if form.cleaned_data['data_hora_manual'] == 'True':
protocolo.timestamp = None
@@ -811,6 +813,7 @@ class ProtocoloMateriaView(PermissionRequiredMixin, CreateView):
def get_initial(self):
initial = super().get_initial()
+ initial['user'] = self.request.user.username
initial['user_data_hora_manual'] = self.request.user.username
initial['ip_data_hora_manual'] = get_client_ip(self.request)
initial['data'] = timezone.localdate(timezone.now())
@@ -882,6 +885,7 @@ class ProtocoloMateriaView(PermissionRequiredMixin, CreateView):
protocolo.numero_paginas = self.request.POST['numero_paginas']
protocolo.observacao = self.request.POST['observacao']
protocolo.assunto_ementa = self.request.POST['assunto_ementa']
+ protocolo.user = self.request.user
if form.cleaned_data['data_hora_manual'] == 'True':
protocolo.timestamp = None
diff --git a/sapl/templates/materia/proposicao_detail.html b/sapl/templates/materia/proposicao_detail.html
index 40c0e806b..ea1ab76fb 100644
--- a/sapl/templates/materia/proposicao_detail.html
+++ b/sapl/templates/materia/proposicao_detail.html
@@ -108,6 +108,18 @@
{% endif %}
+ {% if object.data_envio %}
+
+ {% endif %}
{% if object.conteudo_gerado_related %}
diff --git a/sapl/templates/materia/recibo_proposicao.html b/sapl/templates/materia/recibo_proposicao.html
index a07d7a6d1..1a04f2bf5 100644
--- a/sapl/templates/materia/recibo_proposicao.html
+++ b/sapl/templates/materia/recibo_proposicao.html
@@ -1,6 +1,7 @@
{% load i18n %}
{% load tz %}
{% load crispy_forms_tags %}
+{% load common_tags %}
{% load webpack_static from webpack_loader %}
{% block detail_content %}
@@ -50,10 +51,11 @@
Autor: {{proposicao.autor}} |
- Data de Envio: {{proposicao.data_envio|localtime|date:"d/m/Y H:i:s"}} |
+ Enviada por: {{ proposicao.user|format_user }} |
Descrição: {{proposicao.descricao}} |
+ Data de Envio: {{proposicao.data_envio|localtime|date:"d/m/Y H:i:s"}} |
diff --git a/sapl/templates/protocoloadm/comprovante.html b/sapl/templates/protocoloadm/comprovante.html
index a6bcef79f..645393cf8 100644
--- a/sapl/templates/protocoloadm/comprovante.html
+++ b/sapl/templates/protocoloadm/comprovante.html
@@ -2,6 +2,7 @@
{% load crispy_forms_tags %}
{% load static %}
{% load webpack_static from webpack_loader %}
+{% load common_tags %}
{% block detail_content %}