aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Šmerkl <46304018+SveterCZE@users.noreply.github.com>2021-05-02 21:19:07 +0200
committerPetr Šmerkl <46304018+SveterCZE@users.noreply.github.com>2021-05-02 21:19:07 +0200
commita463c1dc7a5b7c0e8f9d2ac8f3f3662b926ec3b1 (patch)
treeaacf286ae5eb07d7cc556dda36416ff270767102
parent22d2d40fadcf2d3a08f29730eeb153679eab500d (diff)
downloadjustice-a463c1dc7a5b7c0e8f9d2ac8f3f3662b926ec3b1.tar.gz
added search by foreign entity number
-rw-r--r--main.py13
-rw-r--r--templates/results_entities.html5
2 files changed, 16 insertions, 2 deletions
diff --git a/main.py b/main.py
index 87a59c8..89c79f0 100644
--- a/main.py
+++ b/main.py
@@ -90,11 +90,12 @@ def search_results_person(search):
def search_results_entity(search):
entity_name = search.entity_name_search.data
entity_name_search_method = search.entity_name_search_selection.data
- entity_name_actual_or_full = search.entity_name_search_actual.data
entity_number = search.entity_number_search.data
entity_number_search_method = search.entity_number_search_selection.data
- entity_number_actual_or_full = search.entity_name_search_actual.data
+
+ foreign_entity_number = search.foreign_entity_number_search.data
+ foreign_entity_number_search_method = search.foreign_entity_number_search_selection.data
actual_selection = search.entity_actual_selection.data
@@ -108,6 +109,14 @@ def search_results_entity(search):
elif entity_number_search_method == "text_exact":
qry = qry.filter(Pravnicka_Osoba.ico == entity_number)
+ if foreign_entity_number:
+ if foreign_entity_number_search_method == "text_anywhere":
+ qry = qry.filter(Pravnicka_Osoba.reg_cislo.contains(foreign_entity_number))
+ elif foreign_entity_number_search_method == "text_beginning":
+ qry = qry.filter(Pravnicka_Osoba.reg_cislo.like(f'{foreign_entity_number}%'))
+ elif foreign_entity_number_search_method == "text_exact":
+ qry = qry.filter(Pravnicka_Osoba.reg_cislo == foreign_entity_number)
+
if entity_name:
if entity_name_search_method == "text_anywhere":
qry = qry.filter(Pravnicka_Osoba.nazev.contains(entity_name))
diff --git a/templates/results_entities.html b/templates/results_entities.html
index 8465a9c..3f08edf 100644
--- a/templates/results_entities.html
+++ b/templates/results_entities.html
@@ -88,8 +88,13 @@
<tr>
<td style="width:20%">Název:</td>
<td style="width:40%"><b>{{ row.nazev }}</b></td>
+ {% if row.ico != 0 %}
<td style="width:15%">IČO:</td>
<td style="width:25%"><a href="/{{ row.ico }}"><b>{{ row.ico }}</b></a></td>
+ {% else %}
+ <td style="width:15%">Zahraniční reg. č.:</td>
+ <td style="width:25%"><b>{{ row.reg_cislo }}</b></td>
+ {% endif %}
</tr>
<tr>