sync adoption & moniteur date

This commit is contained in:
Frédéric Péters 2011-11-21 13:41:48 +01:00
parent cfcf569149
commit e278de7d7c
1 changed files with 31 additions and 0 deletions

View File

@ -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)