Changeset 15288 for main/kofacustom.dspg/trunk/src
- Timestamp:
- 10 Jan 2019, 10:12:19 (6 years ago)
- Location:
- main/kofacustom.dspg/trunk/src/kofacustom/dspg
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.dspg/trunk/src/kofacustom/dspg/interfaces.py
r15264 r15288 410 410 ) 411 411 412 lsfp_penalty_fee = schema.Float( 413 title = _(u'HND/ND FT Fresh Student Late School Fee Payment Penalty Fee'), 414 default = 0.0, 415 required = True, 416 ) 412 417 413 418 def getSessionString(): -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/locales/en/LC_MESSAGES/waeup.kofa.po
r15189 r15288 40 40 41 41 msgid "Next Matriculation Number Integer" 42 msgstr "Next ND Matriculation Number Integer"42 msgstr "Next ND FT Matriculation Number Integer" 43 43 44 44 msgid "Integer used for constructing the next matriculation number" 45 45 msgstr "" 46 "Integer used for constructing the next matriculation number of ND students"46 "Integer used for constructing the next matriculation number of ND FT students" 47 47 48 48 msgid "Next Matriculation Number Integer 2" 49 msgstr "Next HND FT Matriculation Number Integer" 50 51 msgid "Next Matriculation Number Integer 3" 49 52 msgstr "Next ND PT Matriculation Number Integer" 50 53 51 msgid "Next Matriculation Number Integer 3"52 msgstr "Next HND Matriculation Number Integer"53 54 54 msgid "Next Matriculation Number Integer 4" 55 msgstr "Next HND PT Matriculation Number Integer "55 msgstr "Next HND PT Matriculation Number Integer " 56 56 57 57 msgid "2nd integer used for constructing the next matriculation number" 58 58 msgstr "" 59 "Integer used for constructing the next matriculation number of ND PT students" 59 "Integer used for constructing the next matriculation number of HND FT " 60 "students" 60 61 61 62 msgid "3rd integer used for constructing the next matriculation number" 62 63 msgstr "" 63 "Integer used for constructing the next matriculation number of HND students" 64 "Integer used for constructing the next matriculation number of ND PT " 65 "students (start value 10001)" 64 66 65 67 msgid "4th integer used for constructing the next matriculation number" 66 68 msgstr "" 67 69 "Integer used for constructing the next matriculation number of HND PT " 68 "students "70 "students (start value 10001)" -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/browser.py
r15225 r15288 23 23 from waeup.kofa.interfaces import REQUESTED, IExtFileStore, IKofaUtils 24 24 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 25 from waeup.kofa.browser.layout import KofaEditFormPage26 from waeup.kofa.browser.layout import action, jsaction 25 from waeup.kofa.browser.layout import ( 26 KofaEditFormPage, UtilityView, action, jsaction) 27 27 from waeup.kofa.students.browser import ( 28 28 StudyLevelEditFormPage, StudyLevelDisplayFormPage, … … 31 31 ExportPDFTranscriptSlip, BedTicketAddPage, 32 32 msave, emit_lock_message) 33 from waeup.kofa.students.interfaces import IStudentsUtils, ICourseTicket 33 from waeup.kofa.students.interfaces import ( 34 IStudentsUtils, ICourseTicket, IStudent) 34 35 from waeup.kofa.students.workflow import FORBIDDEN_POSTGRAD_TRANS 35 36 from kofacustom.nigeria.students.browser import ( … … 42 43 NigeriaAccommodationManageFormPage, 43 44 ) 44 45 45 from kofacustom.dspg.students.interfaces import ( 46 46 ICustomStudentOnlinePayment, ICustomStudentStudyCourse, 47 ICustomStudentStudyLevel )47 ICustomStudentStudyLevel, ICustomStudent) 48 48 from kofacustom.dspg.interfaces import MessageFactory as _ 49 49 … … 176 176 """ 177 177 with_hostel_selection = True 178 179 class StudentGetMatricNumberPage(UtilityView, grok.View): 180 """ Construct and set the matriculation number. 181 """ 182 grok.context(IStudent) 183 grok.name('get_matric_number') 184 grok.require('waeup.viewStudent') 185 186 def update(self): 187 students_utils = getUtility(IStudentsUtils) 188 msg, mnumber = students_utils.setMatricNumber(self.context) 189 if msg: 190 self.flash(msg, type="danger") 191 else: 192 self.flash(_('Matriculation number %s assigned.' % mnumber)) 193 self.context.writeLogMessage(self, '%s assigned' % mnumber) 194 self.redirect(self.url(self.context)) 195 return 196 197 def render(self): 198 return 199 200 class ExportPDFMatricNumberSlip(UtilityView, grok.View): 201 """Deliver a PDF notification slip. 202 """ 203 grok.context(ICustomStudent) 204 grok.name('matric_number_slip.pdf') 205 grok.require('waeup.viewStudent') 206 prefix = 'form' 207 208 form_fields = grok.AutoFields(ICustomStudent).select( 209 'student_id', 'matric_number') 210 omit_fields = ('date_of_birth', 'current_level', 'flash_notice') 211 212 @property 213 def title(self): 214 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 215 return translate(_('Matriculation Number'), 'waeup.kofa', 216 target_language=portal_language) 217 218 @property 219 def label(self): 220 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 221 return translate(_('Matriculation Number Slip\n'), 222 target_language=portal_language) \ 223 + ' %s' % self.context.display_fullname 224 225 def render(self): 226 if self.context.state not in (PAID,) or not self.context.is_fresh \ 227 or not self.context.matric_number: 228 self.flash('Not allowed.', type="danger") 229 self.redirect(self.url(self.context)) 230 return 231 students_utils = getUtility(IStudentsUtils) 232 return students_utils.renderPDFAdmissionLetter(self, 233 self.context.student, omit_fields=self.omit_fields, 234 pre_text=pre_text, post_text='') -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/utils.py
r15255 r15288 43 43 if ticket.p_state == 'paid' and \ 44 44 ticket.p_category == 'dep_sug' and \ 45 ticket.p_session == session: 46 return True 47 return False 48 49 def _lsfp_penalty_paymentMade(self, student, session): 50 if student.current_mode not in ('hnd_ft', 'nd_ft'): 51 return True 52 if len(student['payments']): 53 for ticket in student['payments'].values(): 54 if ticket.p_state == 'paid' and \ 55 ticket.p_category == 'lsfp_penalty' and \ 45 56 ticket.p_session == session: 46 57 return True … … 143 154 return _('You have to pay NADESU/SA/SUG Dues first.'), None 144 155 if student.state == CLEARED: 156 penalty = getattr(academic_session, 'lsfp_penalty_fee') 157 if penalty and not self._lsfp_penalty_paymentMade( 158 student, student.current_session): 159 return _('You have to pay late school fee payment penalty first.'), None 145 160 if local(student): 146 161 amount = getattr(certificate, 'school_fee_1', 0.0) … … 258 273 #: passport pictures is allowed. 259 274 PORTRAIT_CHANGE_STATES = (ADMITTED, RETURNING,) 275 276 def constructMatricNumber(self, student): 277 #faccode = student.faccode 278 depcode = student.depcode 279 #certcode = student.certcode 280 year = unicode(student.entry_session)[2:] 281 if not student.state in (PAID, ) or not student.is_fresh: 282 return _('Matriculation number cannot be set.'), None 283 284 # ACC/ND/17/00001 285 if student.current_mode == 'nd_ft': 286 next_integer = grok.getSite()['configuration'].next_matric_integer 287 if next_integer == 0: 288 return _('Matriculation number cannot be set.'), None 289 return None, "%s/ND/%s/%05d" % (depcode, year, next_integer) 290 291 # ACC/HND/17/00001 292 if student.current_mode == 'hnd_ft': 293 next_integer = grok.getSite()['configuration'].next_matric_integer_2 294 if next_integer == 0: 295 return _('Matriculation number cannot be set.'), None 296 return None, "%s/HND/%s/%05d" % (depcode, year, next_integer) 297 298 # PT students get the same prefixes but their counter should start 299 # with 10001. This is inconsistent because after 9999 ft students 300 # the ft and pt number ranges will overlap. Issoufou pointed this 301 # out but the director said: 302 # "when the counter gets to 9999 for ft, it can start counting 303 # along where pt is, at that moment." 304 305 # ACC/ND/17/10001 306 if student.current_mode in ('nd_pt, nd_we'): 307 next_integer = grok.getSite()['configuration'].next_matric_integer_3 308 if next_integer == 0: 309 return _('Matriculation number cannot be set.'), None 310 return None, "%s/ND/%s/%05d" % (depcode, year, next_integer) 311 # ACC/HND/17/10001 312 if student.current_mode in ('hnd_pt, hnd_we'): 313 next_integer = grok.getSite()['configuration'].next_matric_integer_4 314 if next_integer == 0: 315 return _('Matriculation number cannot be set.'), None 316 return None, "%s/HND/%s/%05d" % (depcode, year, next_integer) 317 318 return _('Matriculation number cannot be set.'), None -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/students/viewlets.py
r14913 r15288 21 21 from waeup.kofa.interfaces import REQUESTED 22 22 from waeup.kofa.browser.viewlets import ManageActionButton 23 from waeup.kofa.students.interfaces import IStudentsUtils 24 from kofacustom.dspg.students.interfaces import ( 25 ICustomStudentStudyCourse, ICustomStudentStudyLevel) 23 from waeup.kofa.students.interfaces import IStudentsUtils, IStudent 26 24 from waeup.kofa.students.fileviewlets import ( 27 25 StudentFileDisplay, StudentFileUpload, StudentImage) 28 26 from waeup.kofa.students.browser import ( 29 27 ExportPDFClearanceSlip, StudyCourseDisplayFormPage, 30 StudyLevelDisplayFormPage) 28 StudyLevelDisplayFormPage, StudentBaseDisplayFormPage) 29 from kofacustom.dspg.students.interfaces import ( 30 ICustomStudentStudyCourse, ICustomStudentStudyLevel) 31 31 32 32 from kofacustom.nigeria.interfaces import MessageFactory as _ 33 34 class GetMatricNumberActionButton(ManageActionButton): 35 grok.order(10) 36 grok.context(IStudent) 37 grok.view(StudentBaseDisplayFormPage) 38 grok.require('waeup.viewStudent') 39 #grok.require('waeup.manageStudent') 40 icon = 'actionicon_count.png' 41 text = _('Get Matriculation Number') 42 43 @property 44 def target_url(self): 45 students_utils = getUtility(IStudentsUtils) 46 if self.context.matric_number: 47 return '' 48 error, matric_number = students_utils.constructMatricNumber( 49 self.context) 50 if error: 51 return '' 52 return self.view.url(self.view.context, 'get_matric_number') 53 54 class MatricNumberSlipActionButton(ManageActionButton): 55 grok.order(10) 56 grok.context(IStudent) 57 grok.view(StudentBaseDisplayFormPage) 58 grok.require('waeup.viewStudent') 59 icon = 'actionicon_pdf.png' 60 text = _('Download matriculation number slip') 61 target = 'matric_number_slip.pdf' 62 63 @property 64 def target_url(self): 65 if self.context.state not in (PAID,) or not self.context.is_fresh \ 66 or not self.context.matric_number: 67 return '' 68 return self.view.url(self.view.context, self.target) 33 69 34 70 # ND Result -
main/kofacustom.dspg/trunk/src/kofacustom/dspg/utils/utils.py
r15263 r15288 124 124 'pom':'POM Pack', 125 125 'hrm':'HRM Pack', 126 'lsfp_penalty':'HND/ND FT Fresh Student Late School Fee Payment Penalty', 126 127 } 127 128 … … 188 189 'pom':'POM Pack', 189 190 'hrm':'HRM Pack', 191 'lsfp_penalty':'HND/ND FT Fresh Student Late School Fee Payment Penalty', 190 192 } 191 193
Note: See TracChangeset for help on using the changeset viewer.