summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tabellio/pcfdb/sync.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/tabellio/pcfdb/sync.py b/tabellio/pcfdb/sync.py
index 5b64bdb..cc5eb19 100644
--- a/tabellio/pcfdb/sync.py
+++ b/tabellio/pcfdb/sync.py
@@ -700,7 +700,7 @@ class SyncFromPcfDbView(BrowserView):
where_ts = ''
if timestamp:
where_ts = cursor.mogrify('AND t_com.ts > %s', (timestamp,))
- cursor.execute('''SELECT t_com.id, t_com.st, t_com.nom, code, compets, t_comcat.nom
+ cursor.execute('''SELECT t_com.id, t_com.st, t_com.nom, code, compets, burvicepres, t_comcat.nom
FROM t_com JOIN t_comcat
ON (t_com.comcat = t_comcat.id)
WHERE t_com.st = 'S_ACTIVE'
@@ -712,7 +712,7 @@ class SyncFromPcfDbView(BrowserView):
if row is None:
break
count += 1
- com_id, state, title, code, compets, category = row
+ com_id, state, title, code, compets, burvicepres, category = row
cat_id = self.plone_utils.normalizeString(category)
if not hasattr(self.commissions_folder, cat_id):
@@ -736,21 +736,21 @@ class SyncFromPcfDbView(BrowserView):
annotations['tabellio.com_id'] = com_id
pers_cursor = self.db_connection.cursor()
- pers_cursor.execute('''SELECT t_pershistoline.type, nom, prenom
+ pers_cursor.execute('''SELECT t_pershistoline.type, nom, prenom, t_pers.id
FROM t_pers JOIN t_pershistoline
ON t_pershistoline.pers = t_pers.id
WHERE t_pershistoline.description = %(id)s
AND t_pershistoline.fin IS NULL''',
{'id': com_id})
object.president = None
- object.vicepresidents = []
+ vicepresidents = []
object.members = []
object.substitutes = []
while True:
row = pers_cursor.fetchone()
if row is None:
break
- type, lastname, firstname = row
+ type, lastname, firstname, pers_id = row
if not (lastname and firstname):
# this is some placeholder for a future person, skip it
continue
@@ -758,8 +758,7 @@ class SyncFromPcfDbView(BrowserView):
object.president = RelationValue(
self.get_author_intid_from_name(firstname, lastname))
elif type == 'P_COMM_VP':
- object.vicepresidents.append(
- RelationValue(self.get_author_intid_from_name(firstname, lastname)))
+ vicepresidents.append((pers_id, lastname, firstname))
elif type == 'P_COMM_TI':
object.members.append(
RelationValue(self.get_author_intid_from_name(firstname, lastname)))
@@ -768,6 +767,12 @@ class SyncFromPcfDbView(BrowserView):
RelationValue(self.get_author_intid_from_name(firstname, lastname)))
pers_cursor.close()
+ object.vicepresidents = []
+ for vicepres_id in burvicepres or []:
+ for persid, lastname, firstname in vicepresidents:
+ if persid == vicepres_id:
+ object.vicepresidents.append(RelationValue(self.get_author_intid_from_name(firstname, lastname)))
+
# compets
compet_cursor = self.db_connection.cursor()
compet_cursor.execute('''SELECT t_compet.nom