|
|
@ -1,22 +1,13 @@ |
|
|
|
from datetime import datetime |
|
|
|
|
|
|
|
from django import forms |
|
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
|
from django.core.urlresolvers import reverse |
|
|
|
from django.utils.html import strip_tags |
|
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
|
|
|
|
|
from django.views.generic import ListView, TemplateView |
|
|
|
|
|
|
|
from django.views.generic import ListView |
|
|
|
from django.views.generic import View |
|
|
|
from django.views.generic.base import TemplateView |
|
|
|
from django.views.generic.edit import UpdateView |
|
|
|
|
|
|
|
from django.views.generic.edit import FormMixin |
|
|
|
|
|
|
|
from django.core.exceptions import ObjectDoesNotExist |
|
|
|
|
|
|
|
from django.utils.html import strip_tags |
|
|
|
|
|
|
|
from materia.models import TipoMateriaLegislativa |
|
|
|
from sapl.crud import build_crud |
|
|
|
|
|
|
@ -202,8 +193,10 @@ class ProtocoloPesquisaView(TemplateView, FormMixin): |
|
|
|
else: |
|
|
|
return self.form_invalid(form) |
|
|
|
|
|
|
|
|
|
|
|
class AnularProcoloAdmForm(forms.Form): |
|
|
|
numero_protocolo = forms.CharField(label='Número de Protocolo', required=True) |
|
|
|
numero_protocolo = forms.CharField( |
|
|
|
label='Número de Protocolo', required=True) |
|
|
|
ano = forms.CharField(label='Ano', required=True) |
|
|
|
motivo = forms.CharField(label='Motivo', required=True) |
|
|
|
|
|
|
@ -216,6 +209,7 @@ def get_client_ip(request): |
|
|
|
ip = request.META.get('REMOTE_ADDR') |
|
|
|
return ip |
|
|
|
|
|
|
|
|
|
|
|
class AnularProtocoloAdmView(FormMixin, TemplateView): |
|
|
|
template_name = 'protocoloadm/anular_protocoloadm.html' |
|
|
|
|
|
|
@ -233,15 +227,17 @@ class AnularProtocoloAdmView(FormMixin, TemplateView): |
|
|
|
|
|
|
|
numero = request.POST['numero_protocolo'] |
|
|
|
ano = request.POST['ano_protocolo'] |
|
|
|
justificativa_anulacao = strip_tags(request.POST['justificativa_anulacao']) |
|
|
|
justificativa_anulacao = strip_tags( |
|
|
|
request.POST['justificativa_anulacao']) |
|
|
|
user_anulacao = "NOUSER" # TODO get user from session |
|
|
|
ip_addr = get_client_ip(request) |
|
|
|
|
|
|
|
try: |
|
|
|
protocolo = Protocolo.objects.get(numero = numero, ano = ano) |
|
|
|
protocolo = Protocolo.objects.get(numero=numero, ano=ano) |
|
|
|
|
|
|
|
if protocolo.anulado: |
|
|
|
form._errors = {'error_message': 'Procolo encontra-se anulado'} |
|
|
|
form._errors = { |
|
|
|
'error_message': 'Procolo encontra-se anulado'} |
|
|
|
return self.form_invalid(form) |
|
|
|
|
|
|
|
protocolo.anulado = True |
|
|
|