summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tabellio/pcfdb/sync.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/tabellio/pcfdb/sync.py b/tabellio/pcfdb/sync.py
index de27aa4..b47d9ad 100644
--- a/tabellio/pcfdb/sync.py
+++ b/tabellio/pcfdb/sync.py
@@ -789,6 +789,37 @@ class SyncFromPcfDbView(BrowserView):
else:
object.polgroups = []
+ if doctype == 'DECCCF':
+ # for decrets we need to get some additional dates from histo
+ # lines
+ decret_cursor = self.db_connection.cursor()
+ decret_cursor.execute(decret_cursor.mogrify(
+ '''SELECT idhisto
+ FROM t_histoline
+ WHERE doctype = %s
+ AND docno = %s
+ AND docsess = %s''', (doctype, no, sess)))
+ row = decret_cursor.fetchone()
+ if row is not None:
+ idhisto = row[0]
+ decret_cursor.execute(decret_cursor.mogrify(
+ '''SELECT date
+ FROM t_histoline
+ WHERE idhisto = %s
+ AND descr = %s''', (idhisto, u'Envoi à la sanction')))
+ row = decret_cursor.fetchone()
+ if row is not None:
+ object.adoption_date = row[0]
+ decret_cursor.execute(decret_cursor.mogrify(
+ '''SELECT date
+ FROM t_histoline
+ WHERE idhisto = %s
+ AND descr = %s''', (idhisto, u'Publication au Moniteur belge')))
+ row = decret_cursor.fetchone()
+ if row is not None:
+ object.moniteur_date = row[0]
+ decret_cursor.close()
+
notify(ObjectModifiedEvent(object))
self.publish(object)