Changeset 9916 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 27 Jan 2013, 15:08:16 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r9913 r9916 203 203 204 204 def get_signature_table(signatures, lang='en'): 205 """Return a reportlab table containing signature fields (with date). 205 """Return a list of one or more reportlab tables with signature fields. 206 207 Each signature will get a date field. 208 209 If more than three signatures have to be rendered, instead of a 210 list with one table a list of tables with one signature field each 211 will be returned. 206 212 """ 207 213 style = getSampleStyleSheet() … … 220 226 ('TOPPADDING', (0,-1), (-1,-1), 0), 221 227 ] 222 for num, elem in enumerate(signatures): 223 # draw a line above each signature cell (not: empty cells in between)224 sig_style.append(225 ('LINEABOVE', (num*2,-1), (num*2, -1), 1, colors.black))228 229 col_widths = [sig_col_width*cm, space_width*cm] * len(signatures) 230 if len(signatures) == 1 or len(signatures) > 3: 231 col_widths = [table_width*0.66*cm, table_width*0.34*cm] 226 232 227 233 row = [] 228 for signature in signatures: 229 row.append(Paragraph(trans(_('Date:'), lang), ENTRY1_STYLE)) 230 row.append('') 231 if len(signatures) > 1: 232 col_widths.extend([sig_col_width*cm, space_width*cm]) 233 else: 234 col_widths.extend([sig_col_width/2*cm, sig_col_width/2*cm]) 235 row.append('') # empty spaceholder on right 236 data.append(row[:-1]) 237 data.extend(([''],)*2) # insert 2 empty rows... 238 row = [] 239 for signature in signatures: 240 row.append(Paragraph(trans(signature, lang), ENTRY1_STYLE)) 241 row.append('') 242 data.append(row[:-1]) 234 if len(signatures) < 4: 235 # draw several signature fields in a row 236 for num, signature in enumerate(signatures): 237 # draw a line above each signature cell (not: empty cells 238 # in between) 239 sig_style.append( 240 ('LINEABOVE', (num*2,-1), (num*2, -1), 1, colors.black)) 241 row.append(Paragraph(trans(_('Date:'), lang), ENTRY1_STYLE)) 242 row.append('') # space col 243 data.append(row[:-1]) 244 data.extend(([''],)*2) # insert 2 empty rows... 245 row = [] 246 for signature in signatures: 247 row.append(Paragraph(trans(signature, lang), ENTRY1_STYLE)) 248 row.append('') 249 data.append(row[:-1]) 250 else: 251 # Draw each signature field one under another (vertically) 252 for num, signature in enumerate(signatures): 253 line = (num - 1) * 2 254 sig_style.extend(( 255 ('TOPPADDING', (0, line), (-1, line), 32), 256 ('BOTTOMPADDING', (0, line), (-1, line), 2), 257 ('LINEABOVE', (0, line+1), (0, line+1), 1, colors.black), 258 ('SPAN', (0, line+1), (1, line+1)), 259 )) 260 data.append(['', '']) 261 row.append(Paragraph(trans(signature, lang), ENTRY1_STYLE)) 262 data.append(row) 263 row = [] 243 264 table = Table(data, style=sig_style, repeatRows=len(data), 244 265 colWidths=col_widths) … … 355 376 return _('Study course data are incomplete.'), None 356 377 if previous_session: 357 # Students can pay for previous sessions in all workflow states.358 # Fresh students are excluded by the update method ofthe359 # PreviousPaymentAddFormPage.378 # Students can pay for previous sessions in all 379 # workflow states. Fresh students are excluded by the 380 # update method of the PreviousPaymentAddFormPage. 360 381 if previous_level == 100: 361 382 amount = getattr(certificate, 'school_fee_1', 0.0) … … 366 387 amount = getattr(certificate, 'school_fee_1', 0.0) 367 388 elif student.state == RETURNING: 368 # In case of returning school fee payment the payment session 369 # and level contain the values of the session the student 370 # has paid for. Payment session is always next session. 389 # In case of returning school fee payment the 390 # payment session and level contain the values of 391 # the session the student has paid for. Payment 392 # session is always next session. 371 393 p_session, p_level = self.getReturningData(student) 372 394 academic_session = self._getSessionConfiguration(p_session) 373 395 if academic_session == None: 374 return _(u'Session configuration object is not available.'), None 396 return _( 397 u'Session configuration object is not available.' 398 ), None 375 399 amount = getattr(certificate, 'school_fee_2', 0.0) 376 400 elif student.is_postgrad and student.state == PAID: 377 # Returning postgraduate students also pay for the next session 378 # but their level always remains the same. 401 # Returning postgraduate students also pay for the 402 # next session but their level always remains the 403 # same. 379 404 p_session += 1 380 405 academic_session = self._getSessionConfiguration(p_session) 381 406 if academic_session == None: 382 return _(u'Session configuration object is not available.'), None 407 return _( 408 u'Session configuration object is not available.' 409 ), None 383 410 amount = getattr(certificate, 'school_fee_2', 0.0) 384 411 elif category == 'clearance': … … 554 581 """Render pdf slips for various pages. 555 582 """ 583 # XXX: tell what the different parameters mean 556 584 style = getSampleStyleSheet() 557 585 creator = getUtility(IPDFCreator)
Note: See TracChangeset for help on using the changeset viewer.