From a831afb60cfaed5ec342fab1e4a7eb83feb9c4f7 Mon Sep 17 00:00:00 2001
From: Petr Šmerkl <46304018+SveterCZE@users.noreply.github.com>
Date: Fri, 7 May 2021 21:03:33 +0200
Subject: Add search by additional properies
---
forms.py | 8 ++++++++
main.py | 34 +++++++++++++++++++++++++++++++++-
templates/search_form.html | 18 ++++++++++++++++++
3 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/forms.py b/forms.py
index 9cbad2f..73e576a 100644
--- a/forms.py
+++ b/forms.py
@@ -30,6 +30,14 @@ class JusticeSearchForm(Form):
ulice_search = StringField(u'Ulice:')
ulice_search_selection = SelectField('', choices=search_options)
ulice_search_actual = SelectField('', choices=actual_options)
+
+ cp_search = StringField(u'Číslo popisné:')
+ cp_search_selection = SelectField('', choices=search_options)
+ cp_search_actual = SelectField('', choices=actual_options)
+
+ co_search = StringField(u'Číslo orientační:')
+ co_search_selection = SelectField('', choices=search_options)
+ co_search_actual = SelectField('', choices=actual_options)
oddil_search = StringField(u'Oddíl:')
oddil_search_selection = SelectField('', choices=search_options)
diff --git a/main.py b/main.py
index ee090d3..608e50f 100644
--- a/main.py
+++ b/main.py
@@ -178,6 +178,14 @@ def search_results(search):
ulice_search_method = search.ulice_search_selection.data
ulice_actual_or_full = search.ulice_search_actual.data
+ co = search.co_search.data
+ co_search_method = search.co_search_selection.data
+ co_actual_or_full = search.co_search_actual.data
+
+ cp = search.cp_search.data
+ cp_search_method = search.cp_search_selection.data
+ cp_actual_or_full = search.cp_search_actual.data
+
pravni_forma = search.pravni_forma_search.data
pravni_forma_actual_or_full = search.pravni_forma_actual.data
@@ -263,7 +271,31 @@ def search_results(search):
qry = qry.filter(Adresy_v2.ulice.like(f'{ulice}%'))
elif ulice_search_method == "text_exact":
qry = qry.filter(Adresy_v2.ulice == ulice)
-
+
+ if cp:
+ qry = qry.join(Sidlo_Association, Company.sidlo_text)
+ if cp_actual_or_full == "actual_results":
+ qry = qry.filter(Sidlo_Association.vymaz_datum == 0)
+ qry = qry.join(Adresy_v2, Sidlo_Association.sidlo_text)
+ if cp_search_method == "text_anywhere":
+ qry = qry.filter(Adresy_v2.cisloPo.contains(cp))
+ elif cp_search_method == "text_beginning":
+ qry = qry.filter(Adresy_v2.cisloPo.like(f'{cp}%'))
+ elif cp_search_method == "text_exact":
+ qry = qry.filter(Adresy_v2.cisloPo == cp)
+
+ if co:
+ qry = qry.join(Sidlo_Association, Company.sidlo_text)
+ if co_actual_or_full == "actual_results":
+ qry = qry.filter(Sidlo_Association.vymaz_datum == 0)
+ qry = qry.join(Adresy_v2, Sidlo_Association.sidlo_text)
+ if co_search_method == "text_anywhere":
+ qry = qry.filter(Adresy_v2.cisloOr.contains(co))
+ elif co_search_method == "text_beginning":
+ qry = qry.filter(Adresy_v2.cisloOr.like(f'{co}%'))
+ elif co_search_method == "text_exact":
+ qry = qry.filter(Adresy_v2.cisloOr == co)
+
if pravni_forma:
qry = qry.join(Pravni_Forma_Association_v2, Company.pravni_forma_text)
if pravni_forma_actual_or_full == "actual_results":
diff --git a/templates/search_form.html b/templates/search_form.html
index 14c387d..f4fc7a9 100644
--- a/templates/search_form.html
+++ b/templates/search_form.html
@@ -55,6 +55,24 @@
+
+
+ {{ form.cp_search.label }}
+
+
+ {{ form.cp_search()|safe }} {{ form.cp_search_selection }} {{ form.cp_search_actual }}
+
+
+
+
+
+ {{ form.co_search.label }}
+
+
+ {{ form.co_search()|safe }} {{ form.co_search_selection }} {{ form.co_search_actual }}
+
+
+
{{ form.oddil_search.label }}
--
cgit
From c7d33751e951f9cc4dfd90467854cc6e20cc341b Mon Sep 17 00:00:00 2001
From: Petr Šmerkl <46304018+SveterCZE@users.noreply.github.com>
Date: Fri, 7 May 2021 23:21:08 +0200
Subject: expand search options for natural persons
---
db_creation.py | 4 ++-
forms.py | 20 ++++++++++++
justice_build.py | 8 +++--
main.py | 69 +++++++++++++++++++++++++++------------
models.py | 3 +-
templates/extract.html | 6 ++--
templates/search_form_person.html | 41 +++++++++++++++++++++++
update_db.py | 27 +++++++--------
8 files changed, 135 insertions(+), 43 deletions(-)
diff --git a/db_creation.py b/db_creation.py
index c1f0cc1..9aeb780 100644
--- a/db_creation.py
+++ b/db_creation.py
@@ -113,7 +113,9 @@ def create_tables(conn):
"prijmeni" TEXT,
"titul_za" TEXT,
"datum_naroz" TEXT,
- UNIQUE("titul_pred","jmeno","prijmeni","titul_za","datum_naroz"),
+ "adresa_id" INTEGER,
+ UNIQUE("titul_pred","jmeno","prijmeni","titul_za","datum_naroz","adresa_id"),
+ FOREIGN KEY("adresa_id") REFERENCES "adresy_v2"("id"),
PRIMARY KEY("id" AUTOINCREMENT)
); """
diff --git a/forms.py b/forms.py
index 73e576a..56d9b65 100644
--- a/forms.py
+++ b/forms.py
@@ -9,6 +9,8 @@ Created on Sun Jan 17 10:05:34 2021
from wtforms import Form, StringField, SelectField, BooleanField
from wtforms.fields.html5 import DateField
+# CREATE A GENERAL CLASS TO REMOVE DUPLICITIES?
+
class JusticeSearchForm(Form):
search_options = [("text_anywhere","Kedkoliv v textu"),
("text_beginning","Začátek výrazu"),
@@ -107,6 +109,24 @@ class PersonSearchForm(Form):
surname_search_selection = SelectField('', choices=search_options)
surname_search_actual = SelectField('', choices=actual_options)
+ # Delete the duplicity
+
+ obec_search = StringField(u'Obec:')
+ obec_search_selection = SelectField('', choices=search_options)
+ obec_search_actual = SelectField('', choices=actual_options)
+
+ ulice_search = StringField(u'Ulice:')
+ ulice_search_selection = SelectField('', choices=search_options)
+ ulice_search_actual = SelectField('', choices=actual_options)
+
+ cp_search = StringField(u'Číslo popisné:')
+ cp_search_selection = SelectField('', choices=search_options)
+ cp_search_actual = SelectField('', choices=actual_options)
+
+ co_search = StringField(u'Číslo orientační:')
+ co_search_selection = SelectField('', choices=search_options)
+ co_search_actual = SelectField('', choices=actual_options)
+
person_actual_selection = SelectField('', choices=actual_options)
birthday = DateField(u'Datum narození:', format='%Y-%m-%d')
diff --git a/justice_build.py b/justice_build.py
index eebca0c..018e7cb 100644
--- a/justice_build.py
+++ b/justice_build.py
@@ -3,9 +3,11 @@ from download_files import download_data
from update_db import update_DB
def main():
- typy_po = ["as", "sro", "vos", "ks", "dr", "zajzdrpo", "zahrfos", "ustav", "svj", "spolek", "prisp", "pobspolek",
- "oszpo", "osznadf", "osznad", "orgzam", "odbororg", "nadf", "nad", "evrspol", "evrhzs", "evrdrspol"]
- soudy = ["praha", "plzen", "brno", "ceske_budejovice", "hradec_kralove", "ostrava", "usti_nad_labem"]
+ # typy_po = ["as", "sro", "vos", "ks", "dr", "zajzdrpo", "zahrfos", "ustav", "svj", "spolek", "prisp", "pobspolek",
+ # "oszpo", "osznadf", "osznad", "orgzam", "odbororg", "nadf", "nad", "evrspol", "evrhzs", "evrdrspol"]
+ # soudy = ["praha", "plzen", "brno", "ceske_budejovice", "hradec_kralove", "ostrava", "usti_nad_labem"]
+ typy_po = ["as"]
+ soudy = ["ceske_budejovice"]
DB_name = "justice.db"
create_DB(DB_name)
diff --git a/main.py b/main.py
index 608e50f..6c4a2cf 100644
--- a/main.py
+++ b/main.py
@@ -51,6 +51,18 @@ def search_results_person(search):
birthday = search.birthday.data
+ obec = search.obec_search.data
+ obec_search_method = search.obec_search_selection.data
+
+ ulice = search.ulice_search.data
+ ulice_search_method = search.ulice_search_selection.data
+
+ co = search.co_search.data
+ co_search_method = search.co_search_selection.data
+
+ cp = search.cp_search.data
+ cp_search_method = search.cp_search_selection.data
+
actual_selection = search.person_actual_selection.data
qry = Fyzicka_Osoba.query
@@ -70,7 +82,43 @@ def search_results_person(search):
qry = qry.filter(Fyzicka_Osoba.prijmeni.like(f'{surname}%'))
elif surname_search_method == "text_exact":
qry = qry.filter(Fyzicka_Osoba.prijmeni == surname)
-
+
+ if obec:
+ qry = qry.join(Adresy_v2, Fyzicka_Osoba.adresa)
+ if obec_search_method == "text_anywhere":
+ qry = qry.filter(Adresy_v2.obec.contains(obec))
+ elif obec_search_method == "text_beginning":
+ qry = qry.filter(Adresy_v2.obec.like(f'{obec}%'))
+ elif obec_search_method == "text_exact":
+ qry = qry.filter(Adresy_v2.obec == obec)
+
+ if ulice:
+ qry = qry.join(Adresy_v2, Fyzicka_Osoba.adresa)
+ if ulice_search_method == "text_anywhere":
+ qry = qry.filter(Adresy_v2.ulice.contains(ulice))
+ elif ulice_search_method == "text_beginning":
+ qry = qry.filter(Adresy_v2.ulice.like(f'{ulice}%'))
+ elif ulice_search_method == "text_exact":
+ qry = qry.filter(Adresy_v2.ulice == ulice)
+
+ if cp:
+ qry = qry.join(Adresy_v2, Fyzicka_Osoba.adresa)
+ if cp_search_method == "text_anywhere":
+ qry = qry.filter(Adresy_v2.cisloPo.contains(cp))
+ elif cp_search_method == "text_beginning":
+ qry = qry.filter(Adresy_v2.cisloPo.like(f'{cp}%'))
+ elif cp_search_method == "text_exact":
+ qry = qry.filter(Adresy_v2.cisloPo == cp)
+
+ if co:
+ qry = qry.join(Adresy_v2, Fyzicka_Osoba.adresa)
+ if co_search_method == "text_anywhere":
+ qry = qry.filter(Adresy_v2.cisloOr.contains(co))
+ elif co_search_method == "text_beginning":
+ qry = qry.filter(Adresy_v2.cisloOr.like(f'{co}%'))
+ elif co_search_method == "text_exact":
+ qry = qry.filter(Adresy_v2.cisloOr == co)
+
if birthday:
qry = qry.filter(Fyzicka_Osoba.datum_naroz == birthday)
@@ -94,9 +142,6 @@ def search_results_entity(search):
entity_number = search.entity_number_search.data
entity_number_search_method = search.entity_number_search_selection.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
qry = Pravnicka_Osoba.query
@@ -114,22 +159,6 @@ def search_results_entity(search):
qry1 = qry1.filter(Pravnicka_Osoba.reg_cislo == entity_number)
qry = qry.union(qry1)
- # if entity_number:
- # if entity_number_search_method == "text_anywhere":
- # qry = qry.filter(Pravnicka_Osoba.ico.contains(entity_number))
- # elif entity_number_search_method == "text_beginning":
- # qry = qry.filter(Pravnicka_Osoba.ico.like(f'{entity_number}%'))
- # 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/models.py b/models.py
index f1f93aa..eb427e9 100644
--- a/models.py
+++ b/models.py
@@ -237,11 +237,13 @@ class Fyzicka_Osoba(db.Model):
prijmeni = db.Column(db.String)
titul_za = db.Column(db.String)
datum_naroz = db.Column(MyType)
+ adresa_id = db.Column(db.Integer, db.ForeignKey('adresy_v2.id'))
statut_org_association = db.relationship("Statutarni_Organ_Clen_Association")
spolecnik_association = db.relationship("Spolecnici_Association")
prokurista_association = db.relationship("Prokurista_Association")
sole_shareholder_association = db.relationship("Jediny_Akcionar_Association")
supervisory_board_member_association = db.relationship("Dozorci_Rada_Clen_Association")
+ adresa = db.relationship("Adresy_v2")
def get_name(self):
joined_name = ""
@@ -468,7 +470,6 @@ class Zakladni_Kapital(db.Model):
splaceni_typ = db.Column(db.String)
splaceni_hodnota = db.Column(db.String)
- # def __repr__(self):
def my_rep(self):
joined_zk = ""
joined_zk += self.vklad_hodnota + " "
diff --git a/templates/extract.html b/templates/extract.html
index 3600cd5..0c4efd0 100644
--- a/templates/extract.html
+++ b/templates/extract.html
@@ -258,7 +258,7 @@
{{ underlne_style_open|safe }}
{% if row.statutarni_organ_text[i].clenove[j].jmeno != None %}{{ row.statutarni_organ_text[i].clenove[j].jmeno }}
{% else %}{{ row.statutarni_organ_text[i].clenove[j].jmeno_po.nazev}}{% if row.statutarni_organ_text[i].clenove[j].jmeno_po.reg_cislo != 0 %}, reg č. {{ row.statutarni_organ_text[i].clenove[j].jmeno_po.reg_cislo }}{% endif %}{% if row.statutarni_organ_text[i].clenove[j].jmeno_po.ico != 0 %}, IČ {{ row.statutarni_organ_text[i].clenove[j].jmeno_po.ico }}{% endif %} {% endif %}
- {{ row.statutarni_organ_text[i].clenove[j].adresa }}
+ {{ row.statutarni_organ_text[i].clenove[j].adresa }}
{% if row.statutarni_organ_text[i].clenove[j].funkce_od != 0 %} Den vzniku funkce: {{ row.statutarni_organ_text[i].clenove[j].funkce_od}}{% endif %}
{% if row.statutarni_organ_text[i].clenove[j].funkce_do != 0 %} Den zániku funkce: {{ row.statutarni_organ_text[i].clenove[j].funkce_do}}{% endif %}
{% if row.statutarni_organ_text[i].clenove[j].clenstvi_od != 0 %} Den vzniku členství: {{ row.statutarni_organ_text[i].clenove[j].clenstvi_od}}{% endif %}
@@ -343,7 +343,7 @@
| {{ underlne_style_open|safe }}
{% if row.dozorci_rada_text[i].clenove[j].jmeno != None %}{{ row.dozorci_rada_text[i].clenove[j].jmeno }}
{% else %}{{ row.dozorci_rada_text[i].clenove[j].jmeno_po.nazev}}{% if row.dozorci_rada_text[i].clenove[j].jmeno_po.reg_cislo != 0 %}, reg č. {{ row.dozorci_rada_text[i].clenove[j].jmeno_po.reg_cislo }}{% endif %}{% if row.dozorci_rada_text[i].clenove[j].jmeno_po.ico != 0 %}, IČ {{ row.dozorci_rada_text[i].clenove[j].jmeno_po.ico }}{% endif %} {% endif %}
- {{ row.dozorci_rada_text[i].clenove[j].adresa }}
+ {{ row.dozorci_rada_text[i].clenove[j].adresa }}
{% if row.dozorci_rada_text[i].clenove[j].funkce_od != 0 %} Den vzniku funkce: {{ row.dozorci_rada_text[i].clenove[j].funkce_od}}{% endif %}
{% if row.dozorci_rada_text[i].clenove[j].funkce_do != 0 %} Den zániku funkce: {{ row.dozorci_rada_text[i].clenove[j].funkce_do}}{% endif %}
{% if row.dozorci_rada_text[i].clenove[j].clenstvi_od != 0 %} Den vzniku členství: {{ row.dozorci_rada_text[i].clenove[j].clenstvi_od}}{% endif %}
@@ -397,7 +397,7 @@
{% set underlne_style_close = "" %}
{% endif %}
| {{ underlne_style_open|safe }}
- {{ row.prokurista[i].jmeno }}
+ {{ row.prokurista[i].jmeno }}
{{ row.prokurista[i].adresa }}{% if row.prokurista[i].text_prokurista != "0" %} {{ row.prokurista[i].text_prokurista }}{% endif %}{{ underlne_style_close|safe }} |
{{ underlne_style_open|safe }} Zapsáno: {{ row.prokurista[i].zapis_datum }} {% if row.prokurista[i].vymaz_datum != 0 %} Vymazáno: {{ row.prokurista[i].vymaz_datum }} {% endif %} {{ underlne_style_close|safe }} |
diff --git a/templates/search_form_person.html b/templates/search_form_person.html
index 30d4865..d2fafb8 100644
--- a/templates/search_form_person.html
+++ b/templates/search_form_person.html
@@ -49,6 +49,47 @@
+
+
+
+ {{ form.obec_search.label }}
+
+
+ {{ form.obec_search()|safe }} {{ form.obec_search_selection }}
+
+
+
+
+
+
+ {{ form.ulice_search.label }}
+
+
+ {{ form.ulice_search()|safe }} {{ form.ulice_search_selection }}
+
+
+
+
+
+
+ {{ form.cp_search.label }}
+
+
+ {{ form.cp_search()|safe }} {{ form.cp_search_selection }}
+
+
+
+
+
+
+ {{ form.co_search.label }}
+
+
+ {{ form.co_search()|safe }} {{ form.co_search_selection }}
+
+
+
+
Vyhledávat údaje:
diff --git a/update_db.py b/update_db.py
index b85eb52..e59831f 100644
--- a/update_db.py
+++ b/update_db.py
@@ -209,9 +209,8 @@ def find_spolecnik(c, ICO, elem2, conn, primary_sql_key, element):
# TODO Fix - make reference to type of person - some foreign persons have no ico or regCo, so they are assigned a number for a natural person
if nazev == "0":
# I probably do not need the primary sql key
- spolecnik_fo_id = find_fyzicka_osoba(c, ICO, elem, conn, primary_sql_key, element)
- # adresa_id = find_and_store_address(c, elem)
adresa_id = find_sidlo(c, elem, primary_sql_key)
+ spolecnik_fo_id = find_fyzicka_osoba(c, ICO, elem, conn, primary_sql_key, element, adresa_id)
c.execute("INSERT INTO spolecnici (company_id, spolecnik_fo_id, zapis_datum, vymaz_datum, adresa_id, text_spolecnik) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, spolecnik_fo_id, zapis_datum, vymaz_datum, adresa_id, text_spolecnik,))
c.execute ("SELECT last_insert_rowid()")
spolecnik_id = c.fetchone()[0]
@@ -220,7 +219,6 @@ def find_spolecnik(c, ICO, elem2, conn, primary_sql_key, element):
spol_ico = str(get_prop(elem, "osoba/ico"))
regCislo = str(get_prop(elem, "osoba/regCislo"))
spolecnik_po_id = find_pravnicka_osoba(c, elem, spol_ico, regCislo)
- # adresa_id = find_and_store_address(c, elem)
adresa_id = find_sidlo(c, elem, primary_sql_key)
c.execute("INSERT INTO spolecnici (company_id, spolecnik_po_id, zapis_datum, vymaz_datum, adresa_id, text_spolecnik) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, spolecnik_po_id, zapis_datum, vymaz_datum, adresa_id, text_spolecnik,))
c.execute ("SELECT last_insert_rowid()")
@@ -350,8 +348,8 @@ def find_prokura(c, ICO, elem2, conn, primary_sql_key, element):
zapis_datum = str(get_prop(elem, "zapisDatum"))
vymaz_datum = str(get_prop(elem, "vymazDatum"))
text_prokurista = str(get_prop(elem, "hodnotaUdaje/textZaOsobu/value"))
- prokurista_fo_id = find_fyzicka_osoba(c, ICO, elem, conn, primary_sql_key, element)
adresa_id = find_sidlo(c, elem, primary_sql_key)
+ prokurista_fo_id = find_fyzicka_osoba(c, ICO, elem, conn, primary_sql_key, element, adresa_id)
c.execute("INSERT INTO prokuriste (company_id, zapis_datum, vymaz_datum, prokurista_fo_id, adresa_id, text_prokurista) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, zapis_datum, vymaz_datum, prokurista_fo_id, adresa_id, text_prokurista,))
else:
zapis_datum = str(get_prop(elem, "zapisDatum"))
@@ -376,8 +374,8 @@ def find_sole_shareholder(c, ICO, elem2, conn, primary_sql_key, element):
adresa_id = find_sidlo(c, elem, primary_sql_key)
c.execute("INSERT into jediny_akcionar (company_id, zapis_datum, vymaz_datum, text_akcionar, akcionar_po_id, adresa_id) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, zapis_datum, vymaz_datum, text_akcionar, akcionar_po_id, adresa_id,))
elif typ_akcionar == "F":
- akcionar_fo_id = find_fyzicka_osoba(c, ICO, elem, conn, primary_sql_key, element)
adresa_id = find_sidlo(c, elem, primary_sql_key)
+ akcionar_fo_id = find_fyzicka_osoba(c, ICO, elem, conn, primary_sql_key, element, adresa_id)
c.execute("INSERT into jediny_akcionar (company_id, zapis_datum, vymaz_datum, text_akcionar, akcionar_fo_id, adresa_id) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, zapis_datum, vymaz_datum, text_akcionar, akcionar_fo_id, adresa_id,))
except Exception as f:
print(f)
@@ -498,8 +496,8 @@ def find_clen_statut_org(c, ICO, elem, conn, relationship_table_key, element):
funkceDo = str(get_prop(elem, "funkceDo"))
clenstviDo = str(get_prop(elem, "clenstviDo"))
if typ_osoby == "AngazmaFyzicke":
- osoba_id = find_fyzicka_osoba(c, ICO, elem, conn, relationship_table_key, element)
adresa_id = find_sidlo(c, elem, relationship_table_key)
+ osoba_id = find_fyzicka_osoba(c, ICO, elem, conn, relationship_table_key, element, adresa_id)
c.execute("INSERT into statutarni_organ_clen_relation (statutarni_organ_id, osoba_id, adresa_id, zapis_datum, vymaz_datum, funkce_od, funkce_do, clenstvi_od, clenstvi_do, funkce) VALUES (?,?,?,?,?,?,?,?,?,?)", (relationship_table_key, osoba_id, adresa_id, zapis_datum, vymaz_datum, funkceOd, funkceDo, clenstviOd, clenstviDo, funkce_statutar_organu,))
if typ_osoby == "AngazmaPravnicke":
spol_ico = str(get_prop(elem, "osoba/ico"))
@@ -514,28 +512,28 @@ def insert_individual_relations_v2(c, ICO, conn, primary_sql_key, zapis_datum, v
insert_into_ancillary_table(c, elem, inserted_figure)
return 0
-def find_fyzicka_osoba(c, ICO, elem, conn, relationship_table_key, element):
+def find_fyzicka_osoba(c, ICO, elem, conn, relationship_table_key, element, adresa_id):
try:
jmeno = str(get_prop(elem, "osoba/jmeno"))
prijmeni = str(get_prop(elem, "osoba/prijmeni"))
datum_narozeni = str(get_prop(elem, "osoba/narozDatum"))
titulPred = str(get_prop(elem, "osoba/titulPred"))
titulZa = str(get_prop(elem, "osoba/titulZa"))
- insert_fyzicka_osoba(c, titulPred, jmeno, prijmeni, titulZa, datum_narozeni)
- osoba_id = find_osoba_id(c, titulPred, jmeno, prijmeni, titulZa, datum_narozeni)
+ insert_fyzicka_osoba(c, titulPred, jmeno, prijmeni, titulZa, datum_narozeni, adresa_id)
+ osoba_id = find_osoba_id(c, titulPred, jmeno, prijmeni, titulZa, datum_narozeni, adresa_id)
return osoba_id
except:
pass
-def insert_fyzicka_osoba(c, titulPred, jmeno, prijmeni, titulZa, datum_narozeni):
+def insert_fyzicka_osoba(c, titulPred, jmeno, prijmeni, titulZa, datum_narozeni, adresa_id):
try:
- c.execute("INSERT into fyzicke_osoby (titul_pred, jmeno, prijmeni, titul_za, datum_naroz) VALUES (?,?,?,?,?)", (titulPred, jmeno, prijmeni, titulZa, datum_narozeni,))
+ c.execute("INSERT into fyzicke_osoby (titul_pred, jmeno, prijmeni, titul_za, datum_naroz, adresa_id) VALUES (?,?,?,?,?,?)", (titulPred, jmeno, prijmeni, titulZa, datum_narozeni,adresa_id,))
except:
pass
-def find_osoba_id(c, titulPred, jmeno, prijmeni, titulZa, datum_narozeni):
+def find_osoba_id(c, titulPred, jmeno, prijmeni, titulZa, datum_narozeni, adresa_id):
try:
- anciallary_table_key = c.execute("SELECT id FROM fyzicke_osoby WHERE titul_pred = (?) and jmeno = (?) and prijmeni = (?) and titul_za = (?) and datum_naroz = (?)", (titulPred, jmeno, prijmeni, titulZa, datum_narozeni,))
+ anciallary_table_key = c.execute("SELECT id FROM fyzicke_osoby WHERE titul_pred = (?) and jmeno = (?) and prijmeni = (?) and titul_za = (?) and datum_naroz = (?) and adresa_id = (?)", (titulPred, jmeno, prijmeni, titulZa, datum_narozeni,adresa_id,))
anciallary_table_key = c.fetchone()[0]
return anciallary_table_key
except Exception as f:
@@ -570,9 +568,8 @@ def find_clen_dr(c, ICO, elem, conn, relationship_table_key, element):
funkceDo = str(get_prop(elem, "funkceDo"))
clenstviDo = str(get_prop(elem, "clenstviDo"))
if typ_osoby == "AngazmaFyzicke":
- osoba_id = find_fyzicka_osoba(c, ICO, elem, conn, relationship_table_key, element)
- # adresa_id = find_and_store_address(c, elem)
adresa_id = find_sidlo(c, elem, relationship_table_key)
+ osoba_id = find_fyzicka_osoba(c, ICO, elem, conn, relationship_table_key, element, adresa_id)
c.execute("INSERT into dr_organ_clen_relation (dozorci_rada_id, osoba_id, adresa_id, zapis_datum, vymaz_datum, funkce_od, funkce_do, clenstvi_od, clenstvi_do, funkce) VALUES (?,?,?,?,?,?,?,?,?,?)", (relationship_table_key, osoba_id, adresa_id, zapis_datum, vymaz_datum, funkceOd, funkceDo, clenstviOd, clenstviDo, funkce_statutar_organu,))
elif typ_osoby == "AngazmaPravnicke":
spol_ico = str(get_prop(elem, "osoba/ico"))
--
cgit
From 69758200a54a8731089b6394944440c3a8f5d976 Mon Sep 17 00:00:00 2001
From: Petr Šmerkl <46304018+SveterCZE@users.noreply.github.com>
Date: Fri, 7 May 2021 23:46:06 +0200
Subject: update search by legal persons
---
db_creation.py | 4 +++-
forms.py | 17 ++++++++++++++
main.py | 48 +++++++++++++++++++++++++++++++++++++++
models.py | 3 ++-
templates/search_form_entity.html | 40 ++++++++++++++++++++++++++++++++
update_db.py | 23 +++++++++----------
6 files changed, 121 insertions(+), 14 deletions(-)
diff --git a/db_creation.py b/db_creation.py
index 9aeb780..a8fefe7 100644
--- a/db_creation.py
+++ b/db_creation.py
@@ -234,7 +234,9 @@ def create_tables(conn):
"ico" INTEGER,
"reg_cislo" INTEGER,
"nazev" TEXT,
- UNIQUE("ico","reg_cislo","nazev"),
+ "adresa_id" INTEGER,
+ UNIQUE("ico","reg_cislo","nazev","adresa_id"),
+ FOREIGN KEY("adresa_id") REFERENCES "adresy_v2"("id"),
PRIMARY KEY("id" AUTOINCREMENT)
); """
diff --git a/forms.py b/forms.py
index 56d9b65..5f67564 100644
--- a/forms.py
+++ b/forms.py
@@ -147,6 +147,23 @@ class EntitySearchForm(Form):
entity_number_search = StringField(u'IČO nebo zahraniční registrační číslo:')
entity_number_search_selection = SelectField('', choices=search_options)
+ # REMOVE DUPLICITY
+ obec_search = StringField(u'Obec:')
+ obec_search_selection = SelectField('', choices=search_options)
+ obec_search_actual = SelectField('', choices=actual_options)
+
+ ulice_search = StringField(u'Ulice:')
+ ulice_search_selection = SelectField('', choices=search_options)
+ ulice_search_actual = SelectField('', choices=actual_options)
+
+ cp_search = StringField(u'Číslo popisné:')
+ cp_search_selection = SelectField('', choices=search_options)
+ cp_search_actual = SelectField('', choices=actual_options)
+
+ co_search = StringField(u'Číslo orientační:')
+ co_search_selection = SelectField('', choices=search_options)
+ co_search_actual = SelectField('', choices=actual_options)
+
entity_actual_selection = SelectField('', choices=actual_options)
class CompanyForm(Form):
diff --git a/main.py b/main.py
index 6c4a2cf..cc512ea 100644
--- a/main.py
+++ b/main.py
@@ -142,6 +142,18 @@ def search_results_entity(search):
entity_number = search.entity_number_search.data
entity_number_search_method = search.entity_number_search_selection.data
+ obec = search.obec_search.data
+ obec_search_method = search.obec_search_selection.data
+
+ ulice = search.ulice_search.data
+ ulice_search_method = search.ulice_search_selection.data
+
+ co = search.co_search.data
+ co_search_method = search.co_search_selection.data
+
+ cp = search.cp_search.data
+ cp_search_method = search.cp_search_selection.data
+
actual_selection = search.entity_actual_selection.data
qry = Pravnicka_Osoba.query
@@ -167,6 +179,42 @@ def search_results_entity(search):
elif entity_name_search_method == "text_exact":
qry = qry.filter(Pravnicka_Osoba.nazev == entity_name)
+ if obec:
+ qry = qry.join(Adresy_v2, Pravnicka_Osoba.adresa)
+ if obec_search_method == "text_anywhere":
+ qry = qry.filter(Adresy_v2.obec.contains(obec))
+ elif obec_search_method == "text_beginning":
+ qry = qry.filter(Adresy_v2.obec.like(f'{obec}%'))
+ elif obec_search_method == "text_exact":
+ qry = qry.filter(Adresy_v2.obec == obec)
+
+ if ulice:
+ qry = qry.join(Adresy_v2, Pravnicka_Osoba.adresa)
+ if ulice_search_method == "text_anywhere":
+ qry = qry.filter(Adresy_v2.ulice.contains(ulice))
+ elif ulice_search_method == "text_beginning":
+ qry = qry.filter(Adresy_v2.ulice.like(f'{ulice}%'))
+ elif ulice_search_method == "text_exact":
+ qry = qry.filter(Adresy_v2.ulice == ulice)
+
+ if cp:
+ qry = qry.join(Adresy_v2, Pravnicka_Osoba.adresa)
+ if cp_search_method == "text_anywhere":
+ qry = qry.filter(Adresy_v2.cisloPo.contains(cp))
+ elif cp_search_method == "text_beginning":
+ qry = qry.filter(Adresy_v2.cisloPo.like(f'{cp}%'))
+ elif cp_search_method == "text_exact":
+ qry = qry.filter(Adresy_v2.cisloPo == cp)
+
+ if co:
+ qry = qry.join(Adresy_v2, Pravnicka_Osoba.adresa)
+ if co_search_method == "text_anywhere":
+ qry = qry.filter(Adresy_v2.cisloOr.contains(co))
+ elif co_search_method == "text_beginning":
+ qry = qry.filter(Adresy_v2.cisloOr.like(f'{co}%'))
+ elif co_search_method == "text_exact":
+ qry = qry.filter(Adresy_v2.cisloOr == co)
+
results = qry.all()
print(results)
diff --git a/models.py b/models.py
index eb427e9..1540aa9 100644
--- a/models.py
+++ b/models.py
@@ -228,6 +228,8 @@ class Pravnicka_Osoba(db.Model):
sole_shareholder_association = db.relationship("Jediny_Akcionar_Association")
statut_org_association = db.relationship("Statutarni_Organ_Clen_Association")
supervisory_board_member_association = db.relationship("Dozorci_Rada_Clen_Association")
+ adresa_id = db.Column(db.Integer, db.ForeignKey('adresy_v2.id'))
+ adresa = db.relationship("Adresy_v2")
class Fyzicka_Osoba(db.Model):
__tablename__ = "fyzicke_osoby"
@@ -341,7 +343,6 @@ class Podily_Association(db.Model):
zapis_datum = db.Column(MyType)
vymaz_datum = db.Column(MyType)
druh_podilu_id = db.Column(db.Integer, db.ForeignKey('druhy_podilu.id'))
- # vklad_typ = db.Column(db.String)
vklad_typ = db.Column(MyCurrency)
vklad_text = db.Column(db.String)
souhrn_typ = db.Column(MyContribution)
diff --git a/templates/search_form_entity.html b/templates/search_form_entity.html
index 7d3d0ed..9491dba 100644
--- a/templates/search_form_entity.html
+++ b/templates/search_form_entity.html
@@ -40,6 +40,46 @@
+
+
+
+ {{ form.obec_search.label }}
+
+
+ {{ form.obec_search()|safe }} {{ form.obec_search_selection }}
+
+
+
+
+
+
+ {{ form.ulice_search.label }}
+
+
+ {{ form.ulice_search()|safe }} {{ form.ulice_search_selection }}
+
+
+
+
+
+
+ {{ form.cp_search.label }}
+
+
+ {{ form.cp_search()|safe }} {{ form.cp_search_selection }}
+
+
+
+
+
+
+ {{ form.co_search.label }}
+
+
+ {{ form.co_search()|safe }} {{ form.co_search_selection }}
+
+
+
diff --git a/update_db.py b/update_db.py
index e59831f..b237003 100644
--- a/update_db.py
+++ b/update_db.py
@@ -214,12 +214,11 @@ def find_spolecnik(c, ICO, elem2, conn, primary_sql_key, element):
c.execute("INSERT INTO spolecnici (company_id, spolecnik_fo_id, zapis_datum, vymaz_datum, adresa_id, text_spolecnik) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, spolecnik_fo_id, zapis_datum, vymaz_datum, adresa_id, text_spolecnik,))
c.execute ("SELECT last_insert_rowid()")
spolecnik_id = c.fetchone()[0]
- # print(ICO, spolecnik_fo_id, adresa_id)
else:
spol_ico = str(get_prop(elem, "osoba/ico"))
regCislo = str(get_prop(elem, "osoba/regCislo"))
- spolecnik_po_id = find_pravnicka_osoba(c, elem, spol_ico, regCislo)
adresa_id = find_sidlo(c, elem, primary_sql_key)
+ spolecnik_po_id = find_pravnicka_osoba(c, elem, spol_ico, regCislo, adresa_id)
c.execute("INSERT INTO spolecnici (company_id, spolecnik_po_id, zapis_datum, vymaz_datum, adresa_id, text_spolecnik) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, spolecnik_po_id, zapis_datum, vymaz_datum, adresa_id, text_spolecnik,))
c.execute ("SELECT last_insert_rowid()")
spolecnik_id = c.fetchone()[0]
@@ -370,8 +369,8 @@ def find_sole_shareholder(c, ICO, elem2, conn, primary_sql_key, element):
if typ_akcionar == "P":
spol_ico = str(get_prop(elem, "osoba/ico"))
regCislo = str(get_prop(elem, "osoba/regCislo"))
- akcionar_po_id = find_pravnicka_osoba(c, elem, spol_ico, regCislo)
adresa_id = find_sidlo(c, elem, primary_sql_key)
+ akcionar_po_id = find_pravnicka_osoba(c, elem, spol_ico, regCislo, adresa_id)
c.execute("INSERT into jediny_akcionar (company_id, zapis_datum, vymaz_datum, text_akcionar, akcionar_po_id, adresa_id) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, zapis_datum, vymaz_datum, text_akcionar, akcionar_po_id, adresa_id,))
elif typ_akcionar == "F":
adresa_id = find_sidlo(c, elem, primary_sql_key)
@@ -502,8 +501,8 @@ def find_clen_statut_org(c, ICO, elem, conn, relationship_table_key, element):
if typ_osoby == "AngazmaPravnicke":
spol_ico = str(get_prop(elem, "osoba/ico"))
regCislo = str(get_prop(elem, "osoba/regCislo"))
- prav_osoba_id = find_pravnicka_osoba(c, elem, spol_ico, regCislo)
adresa_id = find_sidlo(c, elem, relationship_table_key)
+ prav_osoba_id = find_pravnicka_osoba(c, elem, spol_ico, regCislo, adresa_id)
c.execute("INSERT into statutarni_organ_clen_relation (statutarni_organ_id, prav_osoba_id, adresa_id, zapis_datum, vymaz_datum, funkce_od, funkce_do, clenstvi_od, clenstvi_do, funkce) VALUES (?,?,?,?,?,?,?,?,?,?)", (relationship_table_key, prav_osoba_id, adresa_id, zapis_datum, vymaz_datum, funkceOd, funkceDo, clenstviOd, clenstviDo, funkce_statutar_organu,))
except Exception as f:
print(f)
@@ -539,11 +538,11 @@ def find_osoba_id(c, titulPred, jmeno, prijmeni, titulZa, datum_narozeni, adresa
except Exception as f:
print(f)
-def find_pravnicka_osoba(c, elem, spol_ico, regCislo):
+def find_pravnicka_osoba(c, elem, spol_ico, regCislo, adresa_id):
try:
nazev = str(get_prop(elem, "osoba/nazev"))
- insert_pravnicka_osoba(c, elem, spol_ico, regCislo, nazev)
- osoba_id = find_pravnicka_osoba_id(c, spol_ico, regCislo, nazev)
+ insert_pravnicka_osoba(c, elem, spol_ico, regCislo, nazev, adresa_id)
+ osoba_id = find_pravnicka_osoba_id(c, spol_ico, regCislo, nazev, adresa_id)
return osoba_id
except Exception as f:
print(f)
@@ -574,8 +573,8 @@ def find_clen_dr(c, ICO, elem, conn, relationship_table_key, element):
elif typ_osoby == "AngazmaPravnicke":
spol_ico = str(get_prop(elem, "osoba/ico"))
regCislo = str(get_prop(elem, "osoba/regCislo"))
- pravnicka_osoba_id = find_pravnicka_osoba(c, elem, spol_ico, regCislo)
adresa_id = find_sidlo(c, elem, relationship_table_key)
+ pravnicka_osoba_id = find_pravnicka_osoba(c, elem, spol_ico, regCislo, adresa_id)
c.execute("INSERT into dr_organ_clen_relation (dozorci_rada_id, pravnicka_osoba_id, adresa_id, zapis_datum, vymaz_datum, funkce_od, funkce_do, clenstvi_od, clenstvi_do, funkce) VALUES (?,?,?,?,?,?,?,?,?,?)", (relationship_table_key, pravnicka_osoba_id, adresa_id, zapis_datum, vymaz_datum, funkceOd, funkceDo, clenstviOd, clenstviDo, funkce_statutar_organu,))
except Exception as f:
print(f)
@@ -620,17 +619,17 @@ def find_druh_podilu_id(c, druhPodilu):
except Exception as f:
print(f)
-def find_pravnicka_osoba_id(c, spol_ico, regCislo, nazev):
+def find_pravnicka_osoba_id(c, spol_ico, regCislo, nazev, adresa_id):
try:
- anciallary_table_key = c.execute("SELECT id FROM pravnicke_osoby WHERE ico = (?) and reg_cislo = (?) and nazev = (?)", (spol_ico, regCislo, nazev,))
+ anciallary_table_key = c.execute("SELECT id FROM pravnicke_osoby WHERE ico = (?) and reg_cislo = (?) and nazev = (?) and adresa_id = (?)", (spol_ico, regCislo, nazev, adresa_id))
anciallary_table_key = c.fetchone()[0]
return anciallary_table_key
except Exception as f:
print(f)
-def insert_pravnicka_osoba(c, elem, spol_ico, regCislo, nazev):
+def insert_pravnicka_osoba(c, elem, spol_ico, regCislo, nazev, adresa_id):
try:
- c.execute("INSERT into pravnicke_osoby (ico, reg_cislo, nazev) VALUES (?,?,?)", (spol_ico, regCislo, nazev,))
+ c.execute("INSERT into pravnicke_osoby (ico, reg_cislo, nazev, adresa_id) VALUES (?,?,?, ?)", (spol_ico, regCislo, nazev, adresa_id,))
except:
pass
--
cgit
From e7a690470224c9d4d8c719a513105d1eb0d7e80e Mon Sep 17 00:00:00 2001
From: Petr Šmerkl <46304018+SveterCZE@users.noreply.github.com>
Date: Fri, 7 May 2021 23:52:22 +0200
Subject: preparation to removal of duplicities
---
forms.py | 3 +++
main.py | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/forms.py b/forms.py
index 5f67564..b49476d 100644
--- a/forms.py
+++ b/forms.py
@@ -11,6 +11,9 @@ from wtforms.fields.html5 import DateField
# CREATE A GENERAL CLASS TO REMOVE DUPLICITIES?
+class GeneralSearchForm(Form):
+ pass
+
class JusticeSearchForm(Form):
search_options = [("text_anywhere","Kedkoliv v textu"),
("text_beginning","Začátek výrazu"),
diff --git a/main.py b/main.py
index cc512ea..f023575 100644
--- a/main.py
+++ b/main.py
@@ -1,5 +1,5 @@
from app import app
-from forms import JusticeSearchForm, CompanyForm, PersonSearchForm, EntitySearchForm
+from forms import JusticeSearchForm, CompanyForm, PersonSearchForm, EntitySearchForm, GeneralSearchForm
from flask import flash, render_template, request, redirect
from models import Company, Insolvency_Events, Konkurz_Events, Predmet_Podnikani, Predmety_Podnikani_Association, Predmet_Cinnosti, Predmety_Cinnosti_Association
from models import Zakladni_Kapital, Akcie, Nazvy, Sidlo, Sidlo_Association, Pravni_Forma_Association_v2, Pravni_Formy, Statutarni_Organ_Association, Statutarni_Organy, Pocty_Clenu_Organu
--
cgit
From 83dbc0d742b4778e7e0dd8bfd30bb11e3d14a204 Mon Sep 17 00:00:00 2001
From: Petr Šmerkl <46304018+SveterCZE@users.noreply.github.com>
Date: Sat, 8 May 2021 14:02:26 +0200
Subject: remove duplicities in code
---
forms.py | 77 +++++++++++++-------------------------------------------
justice_build.py | 8 +++---
main.py | 8 +++---
3 files changed, 24 insertions(+), 69 deletions(-)
diff --git a/forms.py b/forms.py
index b49476d..a6659cf 100644
--- a/forms.py
+++ b/forms.py
@@ -12,22 +12,13 @@ from wtforms.fields.html5 import DateField
# CREATE A GENERAL CLASS TO REMOVE DUPLICITIES?
class GeneralSearchForm(Form):
- pass
-
-class JusticeSearchForm(Form):
search_options = [("text_anywhere","Kedkoliv v textu"),
("text_beginning","Začátek výrazu"),
("text_exact","Přesný výraz"),
]
actual_options = [("actual_results","Jen platné"),
("complete_results","Platné i neplatné"),]
- nazev_subjektu = StringField(u'Název subjektu:')
- nazev_subjektu_selection = SelectField('', choices=search_options)
- nazev_search_actual = SelectField('', choices=actual_options)
- ico_search = StringField(u'Identifikační číslo:')
- ico_search_selection = SelectField('', choices=search_options)
-
obec_search = StringField(u'Obec:')
obec_search_selection = SelectField('', choices=search_options)
obec_search_actual = SelectField('', choices=actual_options)
@@ -43,7 +34,18 @@ class JusticeSearchForm(Form):
co_search = StringField(u'Číslo orientační:')
co_search_selection = SelectField('', choices=search_options)
co_search_actual = SelectField('', choices=actual_options)
+
+class JusticeSearchForm(GeneralSearchForm):
+ search_options = GeneralSearchForm.search_options
+ actual_options = GeneralSearchForm.actual_options
+ nazev_subjektu = StringField(u'Název subjektu:')
+ nazev_subjektu_selection = SelectField('', choices=search_options)
+ nazev_search_actual = SelectField('', choices=actual_options)
+
+ ico_search = StringField(u'Identifikační číslo:')
+ ico_search_selection = SelectField('', choices=search_options)
+
oddil_search = StringField(u'Oddíl:')
oddil_search_selection = SelectField('', choices=search_options)
oddil_search_actual = SelectField('', choices=actual_options)
@@ -95,14 +97,9 @@ class JusticeSearchForm(Form):
zapis_do = DateField(u'Zapsáno do:', format='%Y-%m-%d')
zapis_od = DateField(u'Zapsáno od:', format='%Y-%m-%d')
-class PersonSearchForm(Form):
- # VYMAZAT DUPLICITU
- search_options = [("text_anywhere","Kedkoliv v textu"),
- ("text_beginning","Začátek výrazu"),
- ("text_exact","Přesný výraz"),
- ]
- actual_options = [("actual_results","Jen platné"),
- ("complete_results","Platné i neplatné"),]
+class PersonSearchForm(GeneralSearchForm):
+ search_options = GeneralSearchForm.search_options
+ actual_options = GeneralSearchForm.actual_options
fist_name_search = StringField(u'Jméno:')
fist_name_search_selection = SelectField('', choices=search_options)
@@ -112,36 +109,13 @@ class PersonSearchForm(Form):
surname_search_selection = SelectField('', choices=search_options)
surname_search_actual = SelectField('', choices=actual_options)
- # Delete the duplicity
-
- obec_search = StringField(u'Obec:')
- obec_search_selection = SelectField('', choices=search_options)
- obec_search_actual = SelectField('', choices=actual_options)
-
- ulice_search = StringField(u'Ulice:')
- ulice_search_selection = SelectField('', choices=search_options)
- ulice_search_actual = SelectField('', choices=actual_options)
-
- cp_search = StringField(u'Číslo popisné:')
- cp_search_selection = SelectField('', choices=search_options)
- cp_search_actual = SelectField('', choices=actual_options)
-
- co_search = StringField(u'Číslo orientační:')
- co_search_selection = SelectField('', choices=search_options)
- co_search_actual = SelectField('', choices=actual_options)
-
person_actual_selection = SelectField('', choices=actual_options)
birthday = DateField(u'Datum narození:', format='%Y-%m-%d')
-class EntitySearchForm(Form):
- # VYMAZAT DUPLICITU
- search_options = [("text_anywhere","Kedkoliv v textu"),
- ("text_beginning","Začátek výrazu"),
- ("text_exact","Přesný výraz"),
- ]
- actual_options = [("actual_results","Jen platné"),
- ("complete_results","Platné i neplatné"),]
+class EntitySearchForm(GeneralSearchForm):
+ search_options = GeneralSearchForm.search_options
+ actual_options = GeneralSearchForm.actual_options
entity_name_search = StringField(u'Název:')
entity_name_search_selection = SelectField('', choices=search_options)
@@ -150,23 +124,6 @@ class EntitySearchForm(Form):
entity_number_search = StringField(u'IČO nebo zahraniční registrační číslo:')
entity_number_search_selection = SelectField('', choices=search_options)
- # REMOVE DUPLICITY
- obec_search = StringField(u'Obec:')
- obec_search_selection = SelectField('', choices=search_options)
- obec_search_actual = SelectField('', choices=actual_options)
-
- ulice_search = StringField(u'Ulice:')
- ulice_search_selection = SelectField('', choices=search_options)
- ulice_search_actual = SelectField('', choices=actual_options)
-
- cp_search = StringField(u'Číslo popisné:')
- cp_search_selection = SelectField('', choices=search_options)
- cp_search_actual = SelectField('', choices=actual_options)
-
- co_search = StringField(u'Číslo orientační:')
- co_search_selection = SelectField('', choices=search_options)
- co_search_actual = SelectField('', choices=actual_options)
-
entity_actual_selection = SelectField('', choices=actual_options)
class CompanyForm(Form):
diff --git a/justice_build.py b/justice_build.py
index 018e7cb..eebca0c 100644
--- a/justice_build.py
+++ b/justice_build.py
@@ -3,11 +3,9 @@ from download_files import download_data
from update_db import update_DB
def main():
- # typy_po = ["as", "sro", "vos", "ks", "dr", "zajzdrpo", "zahrfos", "ustav", "svj", "spolek", "prisp", "pobspolek",
- # "oszpo", "osznadf", "osznad", "orgzam", "odbororg", "nadf", "nad", "evrspol", "evrhzs", "evrdrspol"]
- # soudy = ["praha", "plzen", "brno", "ceske_budejovice", "hradec_kralove", "ostrava", "usti_nad_labem"]
- typy_po = ["as"]
- soudy = ["ceske_budejovice"]
+ typy_po = ["as", "sro", "vos", "ks", "dr", "zajzdrpo", "zahrfos", "ustav", "svj", "spolek", "prisp", "pobspolek",
+ "oszpo", "osznadf", "osznad", "orgzam", "odbororg", "nadf", "nad", "evrspol", "evrhzs", "evrdrspol"]
+ soudy = ["praha", "plzen", "brno", "ceske_budejovice", "hradec_kralove", "ostrava", "usti_nad_labem"]
DB_name = "justice.db"
create_DB(DB_name)
diff --git a/main.py b/main.py
index f023575..5d43f97 100644
--- a/main.py
+++ b/main.py
@@ -1,5 +1,5 @@
from app import app
-from forms import JusticeSearchForm, CompanyForm, PersonSearchForm, EntitySearchForm, GeneralSearchForm
+from forms import GeneralSearchForm, JusticeSearchForm, CompanyForm, PersonSearchForm, EntitySearchForm
from flask import flash, render_template, request, redirect
from models import Company, Insolvency_Events, Konkurz_Events, Predmet_Podnikani, Predmety_Podnikani_Association, Predmet_Cinnosti, Predmety_Cinnosti_Association
from models import Zakladni_Kapital, Akcie, Nazvy, Sidlo, Sidlo_Association, Pravni_Forma_Association_v2, Pravni_Formy, Statutarni_Organ_Association, Statutarni_Organy, Pocty_Clenu_Organu
@@ -14,7 +14,7 @@ from sqlalchemy import create_engine
@app.route('/', methods=['GET', 'POST'])
def index():
search = JusticeSearchForm(request.form)
- print(search)
+ # print(search)
if request.method == 'POST':
return search_results(search)
@@ -23,7 +23,7 @@ def index():
@app.route('/osoby', methods=['GET', 'POST'])
def search_person():
search = PersonSearchForm(request.form)
- print(search)
+ # print(search)
if request.method == 'POST':
return search_results_person(search)
@@ -32,7 +32,7 @@ def search_person():
@app.route('/entity', methods=['GET', 'POST'])
def search_entity():
search = EntitySearchForm(request.form)
- print(search)
+ # print(search)
if request.method == 'POST':
return search_results_entity(search)
--
cgit