Changeset 17845


Ignore:
Timestamp:
13 Jul 2024, 08:43:56 (2 months ago)
Author:
Henrik Bettermann
Message:

Show NYSC request info on fee payment history slip.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py

    r17835 r17845  
    1919import os
    2020import csv
     21import pytz
    2122from datetime import datetime
    2223from zope.i18n import translate
     
    2425from zope.schema.interfaces import ConstraintNotSatisfied
    2526from zope.formlib.textwidgets import BytesDisplayWidget
    26 from zope.component import getUtility
     27from zope.component import getUtility, queryUtility
    2728from hurry.workflow.interfaces import IWorkflowInfo
    2829from waeup.kofa.interfaces import (
     
    6465    NigeriaAccommodationDisplayFormPage,
    6566    NigeriaStudentBaseDisplayFormPage,
     67    NigeriaExportPDFFinancialClearancePage,
    6668    )
    6769from waeup.uniben.students.interfaces import (
     
    11271129        msave(self, **data)
    11281130        return
     1131
     1132class CustomNigeriaExportPDFFinancialClearancePage(NigeriaExportPDFFinancialClearancePage):
     1133    """Deliver a PDF financial clearance slip.
     1134    """
     1135
     1136    @property
     1137    def note(self):
     1138        if self.context.nysc and self.context.nysc_updated:
     1139            nysc_updated = self.context.nysc_updated.strftime('%d/%m/%Y')
     1140            return """
     1141NYSC requested on %s.
     1142
     1143Senate Info: %s
     1144""" % (nysc_updated, self.context.nysc_senate_info)
     1145        else:
     1146            return
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r17542 r17845  
    2020import tempfile
    2121import pytz
     22from time import time
    2223from datetime import datetime, timedelta, date
    2324from StringIO import StringIO
     
    12601261        open(path, 'wb').write(self.browser.contents)
    12611262        print "Sample PDF tiship_slip.pdf written to %s" % path
     1263
     1264    def test_fiancial_clearance_pdf_slip(self):
     1265        payment1 = createObject(u'waeup.StudentOnlinePayment')
     1266        timestamp = ("%d" % int(time()*10000))[1:]
     1267        payment1.p_id = "LSCNEW-2-4153206270" # the longest possible p_id
     1268        payment1.p_category = 'schoolfee'
     1269        payment1.p_item = u'My School Fee'
     1270        payment1.p_session = 2015
     1271        payment1.p_level = 100
     1272        payment1.p_current = True
     1273        payment1.amount_auth = 23456.9
     1274        payment1.approve()
     1275        payment2 = createObject(u'waeup.StudentOnlinePayment')
     1276        timestamp = ("%d" % int(time()*10000))[1:]
     1277        payment2.p_id = "p%s" % timestamp
     1278        payment2.p_category = 'clearance'
     1279        payment2.p_item = u'My Clearance Fee'
     1280        payment2.p_session = 2015
     1281        payment2.p_level = 100
     1282        payment2.p_current = True
     1283        payment2.amount_auth = 5678.6
     1284        payment2.approve()
     1285        self.student['payments'][payment1.p_id] = payment1
     1286        self.student['payments'][payment2.p_id] = payment2
     1287        self.student.nysc = True
     1288        self.student.nysc_updated = datetime.now(pytz.utc)
     1289        self.student.nysc_senate_info = u'Senate Info test'
     1290        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     1291        self.browser.open(self.student_path + '/clear_financially')
     1292        self.browser.getLink("Download fee payment history").click()
     1293        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     1294        self.assertEqual(self.browser.headers['Content-Type'],
     1295                         'application/pdf')
     1296        path = os.path.join(samples_dir(), 'fee_payment_history.pdf')
     1297        open(path, 'wb').write(self.browser.contents)
     1298        print "Sample PDF fee_payment_history.pdf written to %s" % path
     1299        return
Note: See TracChangeset for help on using the changeset viewer.