Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Public contract registry
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Public contract registry
Commits
5ee62572
Commit
5ee62572
authored
Feb 25, 2024
by
Alexa Valentová
Browse files
Options
Downloads
Patches
Plain Diff
update for new ARES API
parent
8f286ee0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#17101
passed
Feb 25, 2024
Stage: build
Stage: test_deploy
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
contracts/views.py
+1
-8
1 addition, 8 deletions
contracts/views.py
package-lock.json
+6
-6
6 additions, 6 deletions
package-lock.json
static_src/admin/signee_form.js
+36
-46
36 additions, 46 deletions
static_src/admin/signee_form.js
with
43 additions
and
60 deletions
contracts/views.py
+
1
−
8
View file @
5ee62572
import
os
import
os
from
xml.etree
import
ElementTree
import
requests
import
requests
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -442,15 +441,9 @@ def get_ares_info(request, ico: int):
...
@@ -442,15 +441,9 @@ def get_ares_info(request, ico: int):
raise
HTTPExceptions
.
FORBIDDEN
raise
HTTPExceptions
.
FORBIDDEN
ares_info
=
requests
.
get
(
ares_info
=
requests
.
get
(
f
"
https://
wwwinfo.mfcr.cz/cgi-bin/ares/darv_std.cgi?ico=
{
ico
}
"
f
"
https://
ares.gov.cz/ekonomicke-subjekty-v-be/rest/ekonomicke-subjekty/
{
ico
}
"
)
)
tree
=
ElementTree
.
fromstring
(
ares_info
.
content
)
for
result_count
in
tree
.
iter
(
"
are:Pocet_zaznamu
"
):
if
result_count
.
text
==
"
0
"
:
raise
HTTPExceptions
.
NOT_FOUND
return
HttpResponse
(
return
HttpResponse
(
content
=
ares_info
.
content
,
content
=
ares_info
.
content
,
status
=
ares_info
.
status_code
,
status
=
ares_info
.
status_code
,
...
...
This diff is collapsed.
Click to expand it.
package-lock.json
+
6
−
6
View file @
5ee62572
...
@@ -515,9 +515,9 @@
...
@@ -515,9 +515,9 @@
}
}
},
},
"node_modules/caniuse-lite"
:
{
"node_modules/caniuse-lite"
:
{
"version"
:
"1.0.30001
481
"
,
"version"
:
"1.0.30001
589
"
,
"resolved"
:
"https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001
481
.tgz"
,
"resolved"
:
"https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001
589
.tgz"
,
"integrity"
:
"sha512-
KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ
=="
,
"integrity"
:
"sha512-
vNQWS6kI+q6sBlHbh71IIeC+sRwK2N3EDySc/updIGhIee2x5z00J4c1242/5/d6EpEMdOnk/m+6tuk4/tcsqg
=="
,
"funding"
:
[
"funding"
:
[
{
{
"type"
:
"opencollective"
,
"type"
:
"opencollective"
,
...
@@ -2582,9 +2582,9 @@
...
@@ -2582,9 +2582,9 @@
"integrity"
:
"sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA=="
"integrity"
:
"sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA=="
},
},
"caniuse-lite"
:
{
"caniuse-lite"
:
{
"version"
:
"1.0.30001
481
"
,
"version"
:
"1.0.30001
589
"
,
"resolved"
:
"https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001
481
.tgz"
,
"resolved"
:
"https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001
589
.tgz"
,
"integrity"
:
"sha512-
KCqHwRnaa1InZBtqXzP98LPg0ajCVujMKjqKDhZEthIpAsJl/YEIa3YvXjGXPVqzZVguccuu7ga9KOE1J9rKPQ
=="
"integrity"
:
"sha512-
vNQWS6kI+q6sBlHbh71IIeC+sRwK2N3EDySc/updIGhIee2x5z00J4c1242/5/d6EpEMdOnk/m+6tuk4/tcsqg
=="
},
},
"chokidar"
:
{
"chokidar"
:
{
"version"
:
"3.5.3"
,
"version"
:
"3.5.3"
,
...
...
This diff is collapsed.
Click to expand it.
static_src/admin/signee_form.js
+
36
−
46
View file @
5ee62572
...
@@ -93,67 +93,57 @@ $(window).ready(
...
@@ -93,67 +93,57 @@ $(window).ready(
async
(
event
)
=>
{
async
(
event
)
=>
{
const
icoValue
=
$
(
"
#id_ico_number
"
).
val
();
const
icoValue
=
$
(
"
#id_ico_number
"
).
val
();
const
rawAres
XML
Response
=
await
fetch
(
const
rawAres
JSON
Response
=
await
fetch
(
`/ares-info-proxy/
${
icoValue
}
`
`/ares-info-proxy/
${
icoValue
}
`
);
);
if
(
!
rawAres
XML
Response
.
ok
)
{
if
(
!
rawAres
JSON
Response
.
ok
)
{
alertify
.
error
(
"
Chyba při načítní dat z ARES.
"
);
alertify
.
error
(
"
Chyba při načítní dat z ARES.
"
);
console
.
warn
(
console
.
warn
(
"
Error loading ARES data:
"
,
"
Error loading ARES data:
"
,
await
rawAres
XML
Response
.
text
()
await
rawAres
JSON
Response
.
text
()
);
);
return
;
return
;
}
}
const
formattedAresData
=
new
DOMParser
().
parseFromString
(
const
formattedAresData
=
await
rawAresJSONResponse
.
json
();
await
rawAresXMLResponse
.
text
(),
"
text/xml
"
);
const
errors
=
formattedAresData
.
getElementsByTagName
(
"
are:Error
"
);
let
street
=
(
(
formattedAresData
[
"
sidlo
"
][
"
nazevUlice
"
]
!==
undefined
)
?
formattedAresData
[
"
sidlo
"
][
"
nazevUlice
"
]
:
""
)
if
(
errors
.
length
!==
0
)
{
street
+=
(
alertify
.
error
(
"
Chyba při načítní dat z ARES. Je IČO zadáno správně?
"
);
(
formattedAresData
[
"
sidlo
"
][
"
cisloDomovni
"
]
!==
undefined
)
?
(
"
"
+
formattedAresData
[
"
sidlo
"
][
"
cisloDomovni
"
])
:
""
)
street
+=
(
(
formattedAresData
[
"
sidlo
"
][
"
cisloOrientacni
"
]
!==
undefined
)
?
(
"
/
"
+
formattedAresData
[
"
sidlo
"
][
"
cisloOrientacni
"
])
:
""
)
console
.
warn
(
$
(
"
#id_name
"
).
val
(
"
Error(s) loading ARES data:
"
,
(
formattedAresData
[
"
obchodniJmeno
"
]
!==
undefined
)
?
errors
formattedAresData
[
"
obchodniJmeno
"
]
:
""
)
$
(
"
#id_address_street_with_number
"
).
val
(
street
);
$
(
"
#id_address_district
"
).
val
(
(
formattedAresData
[
"
sidlo
"
][
"
nazevCastiObce
"
]
!==
undefined
)
?
formattedAresData
[
"
sidlo
"
][
"
nazevCastiObce
"
]
:
""
);
$
(
"
#id_address_zip
"
).
val
(
(
formattedAresData
[
"
sidlo
"
][
"
psc
"
]
!==
undefined
)
?
formattedAresData
[
"
sidlo
"
][
"
psc
"
]
:
""
);
);
return
;
}
let
streetResult
=
""
;
const
streetElements
=
formattedAresData
.
getElementsByTagName
(
"
dtt:Nazev_ulice
"
);
if
(
streetElements
.
length
!==
0
)
{
streetResult
+=
streetElements
[
0
].
innerHTML
;
}
const
houseNumberElements
=
formattedAresData
.
getElementsByTagName
(
"
dtt:Cislo_domovni
"
);
if
(
houseNumberElements
.
length
!==
0
)
{
streetResult
+=
`
${
houseNumberElements
[
0
].
innerHTML
}
`
;
}
const
orientationNumberElements
=
formattedAresData
.
getElementsByTagName
(
"
dtt:Cislo_orientacni
"
);
if
(
orientationNumberElements
.
length
!==
0
)
{
streetResult
+=
`/
${
orientationNumberElements
[
0
].
innerHTML
}
`
;
}
$
(
"
#id_name
"
).
val
(
formattedAresData
.
getElementsByTagName
(
"
are:Obchodni_firma
"
)[
0
].
innerHTML
)
$
(
"
#id_address_street_with_number
"
).
val
(
streetResult
);
$
(
"
#id_address_district
"
).
val
(
formattedAresData
.
getElementsByTagName
(
"
dtt:Nazev_obce
"
)[
0
].
innerHTML
);
$
(
"
#id_address_zip
"
).
val
(
formattedAresData
.
getElementsByTagName
(
"
dtt:PSC
"
)[
0
].
innerHTML
);
// IČO numbers will always be in the Czech Republic.
// IČO numbers will always be in the Czech Republic.
$
(
"
#id_address_country
"
).
val
(
"
Česká Republika
"
);
$
(
"
#id_address_country
"
).
val
(
(
formattedAresData
[
"
sidlo
"
][
"
nazevStatu
"
]
!==
undefined
)
?
formattedAresData
[
"
sidlo
"
][
"
nazevStatu
"
]
:
""
);
console
.
log
(
formattedAresData
);
console
.
info
(
"
Loaded ARES data:
"
,
formattedAresData
);
}
}
);
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment