@@ -39,25 +39,26 @@ def index(self):
3939 )
4040 self ._finished ()
4141
42- def _get_signers (self ):
42+ def _get_signers (self , show_message = True ):
4343 """Get the list of held_positions to be used as signer.
4444
45- :return: list of held_position objects
45+ :return: list of signer infos with " held_position", "name" and "function"
4646 """
4747 res = []
48- for signer_infos in ISignable (self .context ).get_signers ():
49- if not signer_infos ["held_position" ]:
50- api .portal .show_message (
51- _ (
52- "Problem with certified signatories, make sure a held position "
53- 'is selected for each signatory (check "${name}/${function}")!' ,
54- mapping = {"name" : signer_infos ["name" ], "function" : signer_infos ["function" ]},
55- ),
56- request = self .request ,
57- type = "warning" ,
58- )
48+ for signer_info in ISignable (self .context ).get_signers ():
49+ if not signer_info ["held_position" ]:
50+ if show_message is True :
51+ api .portal .show_message (
52+ _ (
53+ "Problem with certified signatories, make sure a held position "
54+ 'is selected for each signatory (check "${name}/${function}")!' ,
55+ mapping = {"name" : signer_info ["name" ], "function" : signer_info ["function" ]},
56+ ),
57+ request = self .request ,
58+ type = "warning" ,
59+ )
5960 return []
60- res .append (signer_infos [ "held_position" ] )
61+ res .append (signer_info )
6162 return res
6263
6364 def get_signers (self ):
@@ -66,14 +67,18 @@ def get_signers(self):
6667 :return: list of signer infos (userid, email, fullname, position)
6768 """
6869 res = []
69- signers = self ._get_signers ()
70+ signer_infos = self ._get_signers ()
7071 # signers is a list of held_positions
71- for hp in signers :
72+ for signer_info in signer_infos :
7273 # get email from user
74+ hp = signer_info ["held_position" ]
7375 signer_person = hp .get_person ()
74- email = api .user .get (signer_person .userid ).getProperty ("email" )
75- person_title = signer_person .get_title (include_person_title = False )
76- res .append ((signer_person .userid , email , person_title , hp .label or u"" ))
76+ userid = signer_person .userid
77+ user = api .user .get (userid )
78+ email = user .getProperty ("email" )
79+ person_title = signer_info ["name" ] or signer_person .get_title (include_person_title = False )
80+ hp_label = signer_info ["function" ] or hp .label or u""
81+ res .append ((userid , email , person_title , hp_label ))
7782 return tuple (res )
7883
7984 def get_observers (self ):
0 commit comments