sync commission secretariat
This commit is contained in:
parent
527ed6a3b7
commit
94ba9733d1
|
@ -20,6 +20,7 @@ from zope import component
|
||||||
from zope.app.intid.interfaces import IIntIds
|
from zope.app.intid.interfaces import IIntIds
|
||||||
from z3c.relationfield import RelationValue
|
from z3c.relationfield import RelationValue
|
||||||
from zope.i18n.locales import locales
|
from zope.i18n.locales import locales
|
||||||
|
from plone.app.textfield.value import RichTextValue
|
||||||
|
|
||||||
import transaction
|
import transaction
|
||||||
|
|
||||||
|
@ -698,6 +699,34 @@ class SyncFromPcfDbView(BrowserView):
|
||||||
firstname, lastname, 'S_MINISTRE')))
|
firstname, lastname, 'S_MINISTRE')))
|
||||||
minist_cursor.close()
|
minist_cursor.close()
|
||||||
|
|
||||||
|
secr_cursor = self.db_connection.cursor()
|
||||||
|
secr_cursor.execute('''SELECT titre, sexe, nom, prenom, adjoint, email, attrib
|
||||||
|
FROM t_comsecr
|
||||||
|
WHERE comid = %(id)s
|
||||||
|
ORDER BY adjoint, nom''', {'id': com_id})
|
||||||
|
s = ['<ul>\n']
|
||||||
|
while True:
|
||||||
|
row = secr_cursor.fetchone()
|
||||||
|
if row is None:
|
||||||
|
break
|
||||||
|
titre, sexe, nom, prenom, adjoint, email, attrib = row
|
||||||
|
s.append('<li><a href="mailto:%s">%s %s %s</a>' % (
|
||||||
|
email.replace('@', ' arobase ').replace('.', ' point '),
|
||||||
|
titre, prenom, nom))
|
||||||
|
if adjoint:
|
||||||
|
if sexe == 'M':
|
||||||
|
s.append(u' (adjoint)')
|
||||||
|
else:
|
||||||
|
s.append(u' (adjointe)')
|
||||||
|
if attrib:
|
||||||
|
s.append(u' (%s)' % attrib)
|
||||||
|
s.append('</li>\n')
|
||||||
|
s.append('</ul>\n')
|
||||||
|
object.secretariat = RichTextValue(raw=''.join(s),
|
||||||
|
mimeType='text/html',
|
||||||
|
outputMimeType='text/x-html-safe')
|
||||||
|
secr_cursor.close()
|
||||||
|
|
||||||
notify(ObjectModifiedEvent(object))
|
notify(ObjectModifiedEvent(object))
|
||||||
if object.active:
|
if object.active:
|
||||||
self.publish(object)
|
self.publish(object)
|
||||||
|
|
Reference in New Issue