summaryrefslogtreecommitdiff
path: root/archaeological_files_pdl
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_files_pdl')
-rw-r--r--archaeological_files_pdl/templates/ishtar/wizard/file_confirm_wizard.html17
-rw-r--r--archaeological_files_pdl/wizards.py20
2 files changed, 37 insertions, 0 deletions
diff --git a/archaeological_files_pdl/templates/ishtar/wizard/file_confirm_wizard.html b/archaeological_files_pdl/templates/ishtar/wizard/file_confirm_wizard.html
new file mode 100644
index 000000000..45298c896
--- /dev/null
+++ b/archaeological_files_pdl/templates/ishtar/wizard/file_confirm_wizard.html
@@ -0,0 +1,17 @@
+{% extends "ishtar/wizard/confirm_wizard.html" %}
+{% load url from future %}
+{% load i18n %}
+
+{% block "warning_informations" %}
+{% for file in similar_files %}
+{% if forloop.first %}
+<p class='alert'><label>{% trans "These(s) file(s) are in the same town and have parcel(s) in common." %}</label></p>
+<ul>
+{% endif%}
+ <li>{{file}} <a href='#' onclick='load_window("{% url 'show-file' file.pk '' %}", "{{model_name}}");' class='display_details'>{% trans "Details" %}</a></li>
+{% if forloop.last %}
+</ul>
+<hr/>
+{% endif %}
+{% endfor %}
+{% endblock %}
diff --git a/archaeological_files_pdl/wizards.py b/archaeological_files_pdl/wizards.py
index 1d8351176..61294e538 100644
--- a/archaeological_files_pdl/wizards.py
+++ b/archaeological_files_pdl/wizards.py
@@ -37,6 +37,7 @@ class FileWizard(BaseFileWizard):
'preventiveplanning-%(url_name)s':
'ishtar/wizard/wizard_preventiveplanning.html',
}
+ wizard_confirm = 'ishtar/wizard/file_confirm_wizard.html'
def get_current_year(self):
general_form_key = 'general-' + self.url_name
@@ -68,6 +69,7 @@ class FileWizard(BaseFileWizard):
context = super(FileWizard, self).get_context_data(form)
formplanning = "planningservice-" + self.url_name
forminstruction = "instruction-" + self.url_name
+ formfinal = "final-" + self.url_name
if self.steps.current == formplanning:
try:
idx = int(
@@ -83,6 +85,24 @@ class FileWizard(BaseFileWizard):
if saisine_type:
context['saisine_type'] = unicode(saisine_type)
context['saisine_type_delay'] = saisine_type.delay or 0
+ elif self.steps.current == formfinal and \
+ self.steps.current.endswith('creation'): # creation only
+ parcels = []
+ parcel_step_key = self.parcel_step_key + self.url_name
+
+ parcel_numbers = self.session_get_value(
+ parcel_step_key, 'parcel_number', multi=True) or []
+ sections = self.session_get_value(
+ parcel_step_key, 'section', multi=True) or []
+ towns = self.session_get_value(
+ parcel_step_key, 'town', multi=True) or []
+ for idx, parcel_number in enumerate(parcel_numbers):
+ if not parcel_number:
+ continue
+ parcels.append({'town': towns[idx],
+ 'section': sections[idx],
+ 'parcel_number': parcel_number})
+ context['similar_files'] = models.File.similar_files(parcels)
return context