[8862] | 1 | ## $Id: browser.py 13642 2016-01-20 17:24:56Z henrik $ |
---|
| 2 | ## |
---|
| 3 | ## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | import grok |
---|
| 19 | from zope.formlib.textwidgets import BytesDisplayWidget |
---|
| 20 | from zope.component import getUtility |
---|
| 21 | from zope.i18n import translate |
---|
[13620] | 22 | from datetime import datetime |
---|
[8862] | 23 | from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget |
---|
[13623] | 24 | from waeup.kofa.interfaces import IExtFileStore, IObjectHistory, IKofaUtils |
---|
[13620] | 25 | from waeup.kofa.browser.layout import action, UtilityView |
---|
[13623] | 26 | from waeup.kofa.utils.helpers import get_current_principal, to_timezone |
---|
[8862] | 27 | from waeup.kofa.students.browser import ( |
---|
[8904] | 28 | StudentPersonalDisplayFormPage, StudentPersonalManageFormPage, |
---|
[8862] | 29 | StudentClearanceManageFormPage, StudentClearanceEditFormPage, |
---|
[13058] | 30 | StudentClearanceDisplayFormPage, OnlinePaymentFakeApproveView, |
---|
| 31 | ExportPDFClearanceSlip, StudentBaseManageFormPage, |
---|
[8966] | 32 | StudentBaseDisplayFormPage, |
---|
[13623] | 33 | StudentBasePDFFormPage, |
---|
[8862] | 34 | StudentBaseEditFormPage, StudentPersonalEditFormPage, |
---|
| 35 | OnlinePaymentDisplayFormPage, OnlinePaymentAddFormPage, |
---|
[13058] | 36 | OnlinePaymentBreadcrumb, ExportPDFPaymentSlip, |
---|
| 37 | ExportPDFCourseRegistrationSlip, |
---|
| 38 | ExportPDFBedTicketSlip, |
---|
[13458] | 39 | StudentFilesUploadPage, emit_lock_message, |
---|
| 40 | AccommodationManageFormPage) |
---|
[10707] | 41 | from waeup.kofa.students.interfaces import IStudentsUtils |
---|
[8862] | 42 | from waeup.kofa.students.viewlets import ( |
---|
| 43 | PaymentReceiptActionButton, StudentPassportActionButton) |
---|
| 44 | from kofacustom.nigeria.students.interfaces import ( |
---|
[8863] | 45 | INigeriaStudentBase, INigeriaStudent, INigeriaStudentPersonal, |
---|
[9564] | 46 | INigeriaStudentPersonalEdit, |
---|
[8863] | 47 | INigeriaUGStudentClearance,INigeriaPGStudentClearance, |
---|
[8904] | 48 | INigeriaStudentOnlinePayment |
---|
[8862] | 49 | ) |
---|
| 50 | from waeup.kofa.students.workflow import ADMITTED |
---|
| 51 | from kofacustom.nigeria.interfaces import MessageFactory as _ |
---|
| 52 | |
---|
[8863] | 53 | class NigeriaOnlinePaymentBreadcrumb(OnlinePaymentBreadcrumb): |
---|
[8862] | 54 | """A breadcrumb for payments. |
---|
| 55 | """ |
---|
[8863] | 56 | grok.context(INigeriaStudentOnlinePayment) |
---|
[8862] | 57 | |
---|
| 58 | class PaymentReceiptActionButton(PaymentReceiptActionButton): |
---|
| 59 | grok.order(4) |
---|
[8863] | 60 | grok.context(INigeriaStudentOnlinePayment) |
---|
[8862] | 61 | |
---|
[8966] | 62 | class NigeriaStudentBaseDisplayFormPage(StudentBaseDisplayFormPage): |
---|
| 63 | """ Page to display student base data |
---|
| 64 | """ |
---|
[9704] | 65 | form_fields = grok.AutoFields(INigeriaStudentBase).omit( |
---|
| 66 | 'password', 'suspended', 'suspended_comment') |
---|
[13620] | 67 | form_fields[ |
---|
| 68 | 'financial_clearance_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
[8966] | 69 | |
---|
[8863] | 70 | class NigeriaStudentBaseManageFormPage(StudentBaseManageFormPage): |
---|
[8862] | 71 | """ View to manage student base data |
---|
| 72 | """ |
---|
[9144] | 73 | form_fields = grok.AutoFields(INigeriaStudentBase).omit( |
---|
[13620] | 74 | 'student_id', 'adm_code', 'suspended', |
---|
| 75 | 'financially_cleared_by', 'financial_clearance_date') |
---|
[8862] | 76 | |
---|
[8863] | 77 | class NigeriaStudentBaseEditFormPage(StudentBaseEditFormPage): |
---|
[8862] | 78 | """ View to edit student base data |
---|
| 79 | """ |
---|
[8863] | 80 | form_fields = grok.AutoFields(INigeriaStudentBase).select( |
---|
[8862] | 81 | 'email', 'phone') |
---|
| 82 | |
---|
[8863] | 83 | class NigeriaStudentPersonalDisplayFormPage(StudentPersonalDisplayFormPage): |
---|
[8862] | 84 | """ Page to display student personal data |
---|
| 85 | """ |
---|
[9562] | 86 | form_fields = grok.AutoFields(INigeriaStudentPersonal) |
---|
[8862] | 87 | form_fields['perm_address'].custom_widget = BytesDisplayWidget |
---|
[9053] | 88 | form_fields['next_kin_address'].custom_widget = BytesDisplayWidget |
---|
[9562] | 89 | form_fields[ |
---|
| 90 | 'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
[8862] | 91 | |
---|
[8863] | 92 | class NigeriaStudentPersonalEditFormPage(StudentPersonalEditFormPage): |
---|
[8862] | 93 | """ Page to edit personal data |
---|
| 94 | """ |
---|
[9564] | 95 | form_fields = grok.AutoFields(INigeriaStudentPersonalEdit).omit('personal_updated') |
---|
[8862] | 96 | |
---|
[8904] | 97 | class NigeriaStudentPersonalManageFormPage(StudentPersonalManageFormPage): |
---|
| 98 | """ Page to edit personal data |
---|
| 99 | """ |
---|
| 100 | form_fields = grok.AutoFields(INigeriaStudentPersonal) |
---|
[9554] | 101 | form_fields['personal_updated'].for_display = True |
---|
[9572] | 102 | form_fields[ |
---|
| 103 | 'personal_updated'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
[8904] | 104 | |
---|
[8863] | 105 | class NigeriaStudentClearanceDisplayFormPage(StudentClearanceDisplayFormPage): |
---|
[8862] | 106 | """ Page to display student clearance data |
---|
| 107 | """ |
---|
| 108 | |
---|
| 109 | @property |
---|
| 110 | def form_fields(self): |
---|
[9248] | 111 | if self.context.is_postgrad: |
---|
[8862] | 112 | form_fields = grok.AutoFields( |
---|
[8863] | 113 | INigeriaPGStudentClearance).omit('clearance_locked') |
---|
[8862] | 114 | else: |
---|
| 115 | form_fields = grok.AutoFields( |
---|
[8863] | 116 | INigeriaUGStudentClearance).omit('clearance_locked') |
---|
[9535] | 117 | if not getattr(self.context, 'officer_comment'): |
---|
| 118 | form_fields = form_fields.omit('officer_comment') |
---|
| 119 | else: |
---|
| 120 | form_fields['officer_comment'].custom_widget = BytesDisplayWidget |
---|
[8862] | 121 | return form_fields |
---|
| 122 | |
---|
[13058] | 123 | class NigeriaExportPDFClearanceSlip(ExportPDFClearanceSlip): |
---|
[8862] | 124 | """Deliver a PDF slip of the context. |
---|
| 125 | """ |
---|
[9704] | 126 | omit_fields = ('password', 'suspended', 'suspended_comment', |
---|
[11536] | 127 | 'phone', 'adm_code', 'email', 'date_of_birth', 'current_level') |
---|
[8862] | 128 | |
---|
| 129 | @property |
---|
| 130 | def form_fields(self): |
---|
[9248] | 131 | if self.context.is_postgrad: |
---|
[8862] | 132 | form_fields = grok.AutoFields( |
---|
[8863] | 133 | INigeriaPGStudentClearance).omit('clearance_locked') |
---|
[8862] | 134 | else: |
---|
| 135 | form_fields = grok.AutoFields( |
---|
[8863] | 136 | INigeriaUGStudentClearance).omit('clearance_locked') |
---|
[9535] | 137 | if not getattr(self.context, 'officer_comment'): |
---|
| 138 | form_fields = form_fields.omit('officer_comment') |
---|
[8862] | 139 | return form_fields |
---|
| 140 | |
---|
[8863] | 141 | class NigeriaStudentClearanceManageFormPage(StudentClearanceManageFormPage): |
---|
[8862] | 142 | """ Page to edit student clearance data |
---|
| 143 | """ |
---|
| 144 | |
---|
| 145 | @property |
---|
| 146 | def form_fields(self): |
---|
[9248] | 147 | if self.context.is_postgrad: |
---|
[9249] | 148 | form_fields = grok.AutoFields( |
---|
| 149 | INigeriaPGStudentClearance).omit('clr_code') |
---|
[8862] | 150 | else: |
---|
[9249] | 151 | form_fields = grok.AutoFields( |
---|
| 152 | INigeriaUGStudentClearance).omit('clr_code') |
---|
[8862] | 153 | return form_fields |
---|
| 154 | |
---|
[8863] | 155 | class NigeriaStudentClearanceEditFormPage(StudentClearanceEditFormPage): |
---|
[8862] | 156 | """ View to edit student clearance data by student |
---|
| 157 | """ |
---|
| 158 | |
---|
| 159 | @property |
---|
| 160 | def form_fields(self): |
---|
[9248] | 161 | if self.context.is_postgrad: |
---|
[8946] | 162 | form_fields = grok.AutoFields(INigeriaPGStudentClearance).omit( |
---|
[12107] | 163 | 'clearance_locked', 'nysc_location', 'clr_code', 'officer_comment', |
---|
[12120] | 164 | 'physical_clearance_date') |
---|
[8862] | 165 | else: |
---|
[8946] | 166 | form_fields = grok.AutoFields(INigeriaUGStudentClearance).omit( |
---|
[12107] | 167 | 'clearance_locked', 'clr_code', 'officer_comment', |
---|
[12120] | 168 | 'physical_clearance_date') |
---|
[8862] | 169 | return form_fields |
---|
| 170 | |
---|
[13058] | 171 | class NigeriaExportPDFCourseRegistrationSlip(ExportPDFCourseRegistrationSlip): |
---|
[9376] | 172 | """Deliver a PDF slip of the context. |
---|
| 173 | """ |
---|
[9704] | 174 | omit_fields = ('password', 'suspended', 'suspended_comment', |
---|
[11536] | 175 | 'phone', 'adm_code', 'sex', 'email', 'date_of_birth', 'current_level') |
---|
[9376] | 176 | |
---|
[8863] | 177 | class NigeriaOnlinePaymentDisplayFormPage(OnlinePaymentDisplayFormPage): |
---|
[8862] | 178 | """ Page to view an online payment ticket |
---|
| 179 | """ |
---|
[8863] | 180 | grok.context(INigeriaStudentOnlinePayment) |
---|
[9774] | 181 | form_fields = grok.AutoFields(INigeriaStudentOnlinePayment).omit( |
---|
[9985] | 182 | 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item') |
---|
[8862] | 183 | form_fields[ |
---|
| 184 | 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 185 | form_fields[ |
---|
| 186 | 'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 187 | |
---|
[8863] | 188 | class NigeriaOnlinePaymentAddFormPage(OnlinePaymentAddFormPage): |
---|
[8862] | 189 | """ Page to add an online payment ticket |
---|
| 190 | """ |
---|
[8863] | 191 | form_fields = grok.AutoFields(INigeriaStudentOnlinePayment).select( |
---|
[8862] | 192 | 'p_category') |
---|
| 193 | |
---|
[13058] | 194 | class NigeriaOnlinePaymentFakeApproveView(OnlinePaymentFakeApproveView): |
---|
[8862] | 195 | """ Disable payment approval view for students. |
---|
| 196 | |
---|
| 197 | This view is used for browser tests only and |
---|
| 198 | has to be neutralized here! |
---|
| 199 | """ |
---|
| 200 | grok.name('fake_approve') |
---|
| 201 | grok.require('waeup.managePortal') |
---|
| 202 | |
---|
| 203 | def update(self): |
---|
| 204 | return |
---|
| 205 | |
---|
[13058] | 206 | class NigeriaExportPDFPaymentSlip(ExportPDFPaymentSlip): |
---|
[8862] | 207 | """Deliver a PDF slip of the context. |
---|
| 208 | """ |
---|
[8863] | 209 | grok.context(INigeriaStudentOnlinePayment) |
---|
[9774] | 210 | form_fields = grok.AutoFields(INigeriaStudentOnlinePayment).omit( |
---|
[9985] | 211 | 'provider_amt', 'gateway_amt', 'thirdparty_amt', 'p_item') |
---|
[8862] | 212 | form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
| 213 | form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') |
---|
[9704] | 214 | omit_fields = ('password', 'suspended', 'suspended_comment', 'phone', |
---|
[11536] | 215 | 'adm_code', 'sex', 'email', 'date_of_birth', 'current_level') |
---|
[8862] | 216 | |
---|
[13458] | 217 | class NigeriaAccommodationManageFormPage(AccommodationManageFormPage): |
---|
| 218 | """ Page to manage bed tickets. |
---|
| 219 | This manage form page is for both students and students officers. |
---|
| 220 | """ |
---|
| 221 | with_hostel_selection = False |
---|
| 222 | |
---|
[13058] | 223 | class NigeriaExportPDFBedTicketSlip(ExportPDFBedTicketSlip): |
---|
[9376] | 224 | """Deliver a PDF slip of the context. |
---|
| 225 | """ |
---|
[9704] | 226 | omit_fields = ('password', 'suspended', 'suspended_comment', |
---|
[11536] | 227 | 'phone', 'adm_code', 'email', 'date_of_birth', 'current_level') |
---|
[9376] | 228 | |
---|
[8862] | 229 | class StudentPassportActionButton(StudentPassportActionButton): |
---|
| 230 | |
---|
| 231 | @property |
---|
| 232 | def target_url(self): |
---|
[10707] | 233 | # Passport pictures must not be editable if application slip |
---|
| 234 | # exists. |
---|
[8862] | 235 | slip = getUtility(IExtFileStore).getFileByContext( |
---|
| 236 | self.context, 'application_slip') |
---|
[13130] | 237 | PORTRAIT_CHANGE_STATES = getUtility(IStudentsUtils).PORTRAIT_CHANGE_STATES |
---|
| 238 | if self.context.state not in PORTRAIT_CHANGE_STATES or slip is not None: |
---|
[8862] | 239 | return '' |
---|
| 240 | return self.view.url(self.view.context, self.target) |
---|
| 241 | |
---|
[8863] | 242 | class NigeriaStudentFilesUploadPage(StudentFilesUploadPage): |
---|
[8862] | 243 | """ View to upload passport picture. |
---|
| 244 | |
---|
| 245 | Students are not allowed to change the picture if they |
---|
| 246 | passed the regular Kofa application. |
---|
| 247 | """ |
---|
| 248 | |
---|
| 249 | def update(self): |
---|
[10707] | 250 | # Passport pictures must not be editable if application slip |
---|
| 251 | # exists. |
---|
[8862] | 252 | slip = getUtility(IExtFileStore).getFileByContext( |
---|
| 253 | self.context, 'application_slip') |
---|
[13130] | 254 | PORTRAIT_CHANGE_STATES = getUtility(IStudentsUtils).PORTRAIT_CHANGE_STATES |
---|
| 255 | if self.context.state not in PORTRAIT_CHANGE_STATES or slip is not None: |
---|
[8862] | 256 | emit_lock_message(self) |
---|
| 257 | return |
---|
| 258 | super(StudentFilesUploadPage, self).update() |
---|
[13620] | 259 | return |
---|
| 260 | |
---|
| 261 | class ClearStudentFinancially(UtilityView, grok.View): |
---|
[13634] | 262 | """ Clear student financially by financial clearance officer |
---|
[13620] | 263 | """ |
---|
| 264 | grok.context(INigeriaStudent) |
---|
| 265 | grok.name('clear_financially') |
---|
| 266 | grok.require('waeup.clearStudentFinancially') |
---|
| 267 | |
---|
| 268 | def update(self): |
---|
| 269 | if self.context.financially_cleared_by: |
---|
| 270 | self.flash(_('This student has already been financially cleared.'), |
---|
| 271 | type="danger") |
---|
| 272 | self.redirect(self.url(self.context)) |
---|
| 273 | return |
---|
| 274 | user = get_current_principal() |
---|
| 275 | if user is None: |
---|
| 276 | usertitle = 'system' |
---|
| 277 | else: |
---|
| 278 | usertitle = getattr(user, 'public_name', None) |
---|
| 279 | if not usertitle: |
---|
| 280 | usertitle = user.title |
---|
| 281 | self.context.financially_cleared_by = usertitle |
---|
| 282 | self.context.financial_clearance_date = datetime.utcnow() |
---|
| 283 | self.context.writeLogMessage(self,'financially cleared') |
---|
| 284 | history = IObjectHistory(self.context) |
---|
| 285 | history.addMessage('Financially cleared') |
---|
| 286 | self.flash(_('Student has been financially cleared.')) |
---|
| 287 | self.redirect(self.url(self.context)) |
---|
| 288 | return |
---|
| 289 | |
---|
| 290 | def render(self): |
---|
| 291 | return |
---|
| 292 | |
---|
| 293 | class WithdrawFinancialClearance(UtilityView, grok.View): |
---|
[13634] | 294 | """ Withdraw financial clearance by financial clearance officer |
---|
[13620] | 295 | """ |
---|
| 296 | grok.context(INigeriaStudent) |
---|
| 297 | grok.name('withdraw_financial_clearance') |
---|
| 298 | grok.require('waeup.clearStudentFinancially') |
---|
| 299 | |
---|
| 300 | def update(self): |
---|
| 301 | if not self.context.financially_cleared_by: |
---|
| 302 | self.flash(_('This student has not yet been financially cleared.'), |
---|
| 303 | type="danger") |
---|
| 304 | self.redirect(self.url(self.context)) |
---|
| 305 | return |
---|
| 306 | self.context.financially_cleared_by = None |
---|
| 307 | self.context.financial_clearance_date = None |
---|
| 308 | self.context.writeLogMessage(self,'financial clearance withdrawn') |
---|
| 309 | history = IObjectHistory(self.context) |
---|
| 310 | history.addMessage('Financial clearance withdrawn') |
---|
| 311 | self.flash(_('Financial clearance withdrawn.')) |
---|
| 312 | self.redirect(self.url(self.context)) |
---|
| 313 | return |
---|
| 314 | |
---|
| 315 | def render(self): |
---|
[13623] | 316 | return |
---|
| 317 | |
---|
| 318 | cleared_note = """ |
---|
| 319 | <br /><br /><br /> |
---|
| 320 | <strong>Financially cleared on %s by %s.</strong> |
---|
| 321 | |
---|
| 322 | """ |
---|
| 323 | |
---|
| 324 | not_cleared_note = """ |
---|
| 325 | <br /><br /><br /> |
---|
| 326 | <strong>Not yet financially cleared.</strong> |
---|
| 327 | |
---|
| 328 | """ |
---|
| 329 | |
---|
[13634] | 330 | class NigeriaExportPDFFinancialClearancePage(UtilityView, grok.View): |
---|
| 331 | """Deliver a PDF financial clearance slip. |
---|
[13623] | 332 | """ |
---|
| 333 | grok.context(INigeriaStudent) |
---|
[13634] | 334 | grok.name('financial_clearance_slip.pdf') |
---|
[13623] | 335 | grok.require('waeup.viewStudent') |
---|
| 336 | prefix = 'form' |
---|
| 337 | |
---|
| 338 | omit_fields = ( |
---|
| 339 | 'suspended', 'phone', |
---|
| 340 | 'adm_code', 'suspended_comment', |
---|
| 341 | 'date_of_birth', 'current_level') |
---|
| 342 | |
---|
| 343 | form_fields = None |
---|
| 344 | |
---|
| 345 | @property |
---|
| 346 | def label(self): |
---|
| 347 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
[13634] | 348 | return translate(_('Financial Clearance Slip of'), |
---|
[13623] | 349 | 'waeup.kofa', target_language=portal_language) \ |
---|
| 350 | + ' %s' % self.context.display_fullname |
---|
| 351 | |
---|
| 352 | def _sigsInFooter(self): |
---|
| 353 | |
---|
| 354 | isStudent = getattr( |
---|
| 355 | self.request.principal, 'user_type', None) == 'student' |
---|
| 356 | if isStudent: |
---|
| 357 | return () |
---|
[13642] | 358 | return (_('Date, Checking Officer Signature'), |
---|
| 359 | _('Date, Approving Officer Signature'), |
---|
[13623] | 360 | ) |
---|
| 361 | |
---|
| 362 | @property |
---|
| 363 | def note(self): |
---|
| 364 | if self.context.financially_cleared_by: |
---|
| 365 | tz = getUtility(IKofaUtils).tzinfo |
---|
| 366 | try: |
---|
| 367 | timestamp = to_timezone( |
---|
| 368 | self.context.financial_clearance_date, tz).strftime( |
---|
| 369 | "%Y-%m-%d %H:%M:%S") |
---|
| 370 | except ValueError: |
---|
| 371 | return not_cleared_note |
---|
| 372 | return cleared_note % ( |
---|
| 373 | timestamp, self.context.financially_cleared_by) |
---|
| 374 | return not_cleared_note |
---|
| 375 | |
---|
| 376 | @property |
---|
| 377 | def tabletitle(self): |
---|
| 378 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
| 379 | tabletitle = [] |
---|
| 380 | tabletitle.append(translate(_('Successful Payments'), 'waeup.kofa', |
---|
| 381 | target_language=portal_language)) |
---|
| 382 | return tabletitle |
---|
| 383 | |
---|
| 384 | def render(self): |
---|
| 385 | portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE |
---|
| 386 | P_ID = translate(_('Payment Id'), 'waeup.kofa', target_language=portal_language) |
---|
| 387 | #CD = translate(_('Creation Date'), 'waeup.kofa', target_language=portal_language) |
---|
| 388 | PD = translate(_('Payment Date'), 'waeup.kofa', target_language=portal_language) |
---|
| 389 | CAT = translate(_('Payment Category'), 'waeup.kofa', target_language=portal_language) |
---|
| 390 | ITEM = translate(_('Payment Item'), 'waeup.kofa', target_language=portal_language) |
---|
| 391 | AMT = translate(_('Amount (Naira)'), 'waeup.kofa', target_language=portal_language) |
---|
| 392 | SSS = translate(_('Payment Session'), 'waeup.kofa', target_language=portal_language) |
---|
| 393 | studentview = StudentBasePDFFormPage(self.context.student, |
---|
| 394 | self.request, self.omit_fields) |
---|
| 395 | students_utils = getUtility(IStudentsUtils) |
---|
| 396 | |
---|
| 397 | tabledata = [] |
---|
| 398 | tableheader = [] |
---|
| 399 | tabledata.append(sorted( |
---|
| 400 | [value for value in self.context['payments'].values() |
---|
[13634] | 401 | if value.p_state == 'paid'], key=lambda value: value.p_session)) |
---|
| 402 | tableheader.append([(P_ID,'p_id', 4.2), |
---|
[13623] | 403 | #(CD,'creation_date', 3), |
---|
| 404 | (PD,'formatted_p_date', 3), |
---|
| 405 | (CAT,'category', 3), |
---|
| 406 | (ITEM, 'p_item', 3), |
---|
| 407 | (AMT, 'amount_auth', 2), |
---|
| 408 | (SSS, 'p_session', 2), |
---|
| 409 | ]) |
---|
| 410 | return students_utils.renderPDF( |
---|
[13634] | 411 | self, 'financial_clearance_slip.pdf', |
---|
[13623] | 412 | self.context.student, studentview, |
---|
| 413 | tableheader=tableheader, |
---|
| 414 | tabledata=tabledata, |
---|
| 415 | signatures=None, |
---|
| 416 | sigs_in_footer=self._sigsInFooter(), |
---|
| 417 | omit_fields=self.omit_fields, |
---|
| 418 | note=self.note |
---|
| 419 | ) |
---|