From 5a1ee3831afbd94a1fd5231050c490c2eaa37a94 Mon Sep 17 00:00:00 2001
From: goose-life <32566441+goose-life@users.noreply.github.com>
Date: Sat, 17 Aug 2024 16:09:16 +0200
Subject: [PATCH 1/9] fix all tables in newNodes before replacing oldNode
---
indigo_app/static/javascript/indigo/models.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/indigo_app/static/javascript/indigo/models.js b/indigo_app/static/javascript/indigo/models.js
index 6e3f8afe7..1aee82417 100644
--- a/indigo_app/static/javascript/indigo/models.js
+++ b/indigo_app/static/javascript/indigo/models.js
@@ -80,6 +80,7 @@
* @param {Element[]} newNodes the nodes to replace the old one with, or null to delete the node
*/
replaceNode: function(oldNode, newNodes) {
+ indigoAkn.fixTables(newNodes);
var del = !newNodes;
var first = del ? null : newNodes[0];
From 797ff62a6d7ad5aa19e769274dfb7ec94994a8be Mon Sep 17 00:00:00 2001
From: goose-life <32566441+goose-life@users.noreply.github.com>
Date: Sun, 18 Aug 2024 10:19:37 +0200
Subject: [PATCH 2/9] pass an empty list, not null, as newNodes if empty
---
indigo_app/static/javascript/indigo/models.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/indigo_app/static/javascript/indigo/models.js b/indigo_app/static/javascript/indigo/models.js
index 1aee82417..a544c61ce 100644
--- a/indigo_app/static/javascript/indigo/models.js
+++ b/indigo_app/static/javascript/indigo/models.js
@@ -80,7 +80,7 @@
* @param {Element[]} newNodes the nodes to replace the old one with, or null to delete the node
*/
replaceNode: function(oldNode, newNodes) {
- indigoAkn.fixTables(newNodes);
+ indigoAkn.fixTables(newNodes || []);
var del = !newNodes;
var first = del ? null : newNodes[0];
From 670dcaec07aa8e4dab1cb06951ec19cd3f8a02fb Mon Sep 17 00:00:00 2001
From: goose-life <32566441+goose-life@users.noreply.github.com>
Date: Sun, 18 Aug 2024 14:07:07 +0200
Subject: [PATCH 3/9] update resize_tables to match fixTables in indigo-akn
---
indigo_api/exporters.py | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/indigo_api/exporters.py b/indigo_api/exporters.py
index 9a858d684..cd3c4da12 100644
--- a/indigo_api/exporters.py
+++ b/indigo_api/exporters.py
@@ -395,19 +395,11 @@ def resize_tables(self, doc):
""" Ensure that tables have the correct number of columns and rows, otherwise
PDF generation fails.
"""
+ # there should never be a completely empty row -- check for this first
for table in doc.root.xpath('//a:table', namespaces={'a': doc.namespace}):
- # a cell can't span more rows than actually come after it
- # there should also never be a completely empty row -- check for this first
for row in table.xpath('a:tr', namespaces={'a': doc.namespace}):
if not row.xpath('a:td|a:th', namespaces={'a': doc.namespace}):
table.remove(row)
- for row in table.xpath('a:tr', namespaces={'a': doc.namespace}):
- actual = len(list(row.itersiblings(f'{{{doc.namespace}}}tr')))
- for cell in row.xpath('a:td[@rowspan] | a:th[@rowspan]', namespaces={'a': doc.namespace}):
- rowspan = int(cell.get('rowspan', 1))
- if rowspan > 1:
- # rowspan is the smaller of the current rowspan, and the actual number of rows (plus this one)
- cell.set('rowspan', str(min(rowspan, actual + 1)))
matrix = self.map_table(table, doc)
@@ -426,7 +418,9 @@ def resize_tables(self, doc):
missing_cells = n_cols - len(matrix[y])
for x in range(missing_cells):
log.debug(f"Adding missing cell in table {table.get('eId')} on row {y+1}")
- row.append(doc.maker('td'))
+ cell = doc.maker('td')
+ cell.append(doc.maker('p'))
+ row.append(cell)
# update the matrix
for x in range(n_cols):
matrix[y][x] = True
From 0b577a8ce604186723a52070f65ba5339265d41a Mon Sep 17 00:00:00 2001
From: goose-life <32566441+goose-life@users.noreply.github.com>
Date: Sun, 18 Aug 2024 17:16:34 +0200
Subject: [PATCH 4/9] update test outputs to match new behaviour
---
.../pdf_fixtures/tables/bad_spans_out.xml | 48 +++++++++----------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/indigo_api/tests/pdf_fixtures/tables/bad_spans_out.xml b/indigo_api/tests/pdf_fixtures/tables/bad_spans_out.xml
index 75f3f5691..38d153f77 100644
--- a/indigo_api/tests/pdf_fixtures/tables/bad_spans_out.xml
+++ b/indigo_api/tests/pdf_fixtures/tables/bad_spans_out.xml
@@ -8,13 +8,13 @@
Nature of ownership .The percentage of issued shares a person holds in the company - Directly.........%of shares The percentage of voting rights a person holds in the company .A person holds a right to appoint or remove a majority of the members of the board of directors of the company : A person exercises significant influence or control over the company. .A person holds the highest percentage of the issued Part C: Details of owner(s)(If different from applicant) Full name(s) Physical address(es) E-mail Tel. Part D: Property details (In accordance with title deed) Property description (Number(s) of Erf/ Erven/Portion(s) or Farm(s)) Physical address Current zoning Title deed number and date Any restrictive conditions? Is the property encumbered by a bond? Part E: Pre-application consultation (regulation 11) Has there been any pre-application consultation? If yes, complete the information below and attach the minutes of the pre-application consultation. Official’s name Date of consultation
+
-
+
+
or control the
beneficial owner has
in the company ,
whether individually
or jointly*
-
-Indirectly.........%of shares
+
- Directly.........%of shares
-Indirectly.........%of shares
-
- Directly
-Indirectly
- Directly
-Indirectly
-
-
+
-
shares but does not meet the above
four criteria .
- Directly.........%of shares
-Indirectly.........%of shares
+
+
@@ -180,14 +180,14 @@
-
+
-
+
-
+
-
+
@@ -217,7 +217,7 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
@@ -543,7 +543,7 @@
+
-
+ No. + |
+
+ Security plan + |
+
+ Check box + |
+ |
---|---|---|---|
+ 1. + |
+
+ The floor plan of the proposed site or area. + |
+
+ Yes + |
+
+ No + |
+
+ 2. + |
+
+ The access point (entry and exit). + |
+
+ Yes + |
+
+ No + |
+
+ 3. + |
+
+ The entry/ exit point to be manned at all times. + |
+
+ Yes + |
+
+ No + |
+
+ 4. + |
+
+ Patrons to be searched at point of arrival and departure. + |
+
+ Yes + |
+
+ No + |
+
+ 5. + |
+
+ Storage facilities for licensed firearms to be provided. + |
+
+ Yes + |
+
+ No + |
+
+ 6. + |
+
+ The point of sale to be cordoned off (indicated on the floor plan submitted). + |
+
+ Yes + |
+
+ No + |
+
+ 7. + |
+
+ The restricted part for consumption of liquor to be cordoned off (to be indicated on the floor plan submitted). + |
+
+ Yes + |
+
+ No + |
+
+ 8. + |
+
+ Parking to be provided. + |
+
+ Yes + |
+
+ No + |
+
+ 9. + |
+
+ Ablution facilities for males and females to be provided. + |
+
+ Yes + |
+
+ No + |
+
+ + | ++ + | +
+ 1. Details of licensed outlet or premises + |
+ |
---|---|
+ (a) Name of outlet: + |
+ |
+ (b) Trade name/s (if any): + |
+ |
+ (c) Registration number: + |
+ |
+ (d) Name of the metropolitan municipality/district municipality or local municipality where the licensed premises are situated: + |
+ |
+ (e) Physical business address of applicant: + |
+ |
+ 2. Personal details of the applicant + |
+ |
+ (a) Names and surname: + |
+ |
+ (b) Designation of applicant: + |
+ |
+ (c) Contact details: + |
+ |
+ Cell: __________________________ Tel: __________________________ Fax: __________________________ Email: _________________________________ + |
+ |
+ (Please attach certified copies of the documents requested in terms of regulation 25(3) to this form) +1. During the past 12 months, has the applicant, or any person holding an interest in the applicant, become disqualified from holding this liquor licence, as contemplated in section 40 of the Act? + |
+ |
+ Yes + |
+
+ No + |
+
+ 2. If the answer to the above question is in the affirmative, please provide details of any decision taken by the relevant provincial licensing authority in terms of section 40 of the Act + |
+ |
+ 3. Has the applicant or any of its owners, directors or subsidiaries been indicted or charged with any criminal offence, excluding traffic offences, during the past 12 months? + |
+ |
+ Yes + |
+
+ No + |
+
+ + | +|
+ 4. Has the applicant or any of its subsidiaries been a party to a law suit during the past 12 months? + |
+ |
+ If yes, provide details: __________________________ + |
+
+ Notice of intention to apply for a liquor licence for the undermentioned premises and proof of service +Name of premises +_____________________________________________________________ + |
+ ||||
+ Physical address of the premises: +_____________________________________________________________ +______________________________________________________________ +Category of licence ________________________________________ +Type of premises ________________________________________ + |
+ ||||
+ Full name + |
+
+ Surname + |
+
+ I.D. Number + |
+
+ Full address + |
+
+ Signature + |
+
---|---|---|---|---|
+ + | ++ + | ++ + | ++ + | ++ + | +
+ + | ++ + | ++ + | ++ + | ++ + | +
+ + | ++ + | ++ + | ++ + | ++ + | +
+ + | ++ + | ++ + | ++ + | ++ + | +
+ + | +||||
+ + | +