[7191] | 1 | ## $Id: interfaces.py 9142 2012-09-01 13:39:16Z henrik $ |
---|
[6621] | 2 | ## |
---|
[7191] | 3 | ## Copyright (C) 2011 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 | ## |
---|
[8409] | 18 | #from datetime import datetime |
---|
[7620] | 19 | from zope.component import getUtility |
---|
[7256] | 20 | from zope.interface import Attribute, Interface |
---|
[6621] | 21 | from zope import schema |
---|
[7620] | 22 | from zc.sourcefactory.contextual import BasicContextualSourceFactory |
---|
[7811] | 23 | from waeup.kofa.interfaces import ( |
---|
[8409] | 24 | IKofaObject, academic_sessions_vocab, validate_email, ICSVExporter) |
---|
[7811] | 25 | from waeup.kofa.interfaces import MessageFactory as _ |
---|
[8176] | 26 | from waeup.kofa.schema import TextLineChoice, FormattedDate, PhoneNumber |
---|
[7811] | 27 | from waeup.kofa.students.vocabularies import ( |
---|
[7915] | 28 | StudyLevelSource, contextual_reg_num_source, contextual_mat_num_source, |
---|
| 29 | GenderSource, nats_vocab, |
---|
| 30 | ) |
---|
[8160] | 31 | from waeup.kofa.payments.interfaces import ( |
---|
[8174] | 32 | IPaymentsContainer, IOnlinePayment) |
---|
[7915] | 33 | from waeup.kofa.university.vocabularies import ( |
---|
| 34 | CourseSource, StudyModeSource, CertificateSource) |
---|
[6621] | 35 | |
---|
[7620] | 36 | # VerdictSource can't be placed into the vocabularies module because it |
---|
| 37 | # requires importing IStudentsUtils which then leads to circular imports. |
---|
| 38 | class VerdictSource(BasicContextualSourceFactory): |
---|
| 39 | """A verdicts source delivers all verdicts provided |
---|
| 40 | in the portal. |
---|
| 41 | """ |
---|
| 42 | def getValues(self, context): |
---|
[7841] | 43 | verdicts_dict = getUtility(IStudentsUtils).VERDICTS_DICT |
---|
[8820] | 44 | return sorted(verdicts_dict.keys()) |
---|
[7620] | 45 | |
---|
| 46 | def getToken(self, context, value): |
---|
| 47 | return value |
---|
| 48 | |
---|
| 49 | def getTitle(self, context, value): |
---|
[7841] | 50 | verdicts_dict = getUtility(IStudentsUtils).VERDICTS_DICT |
---|
[8820] | 51 | if value != '0': |
---|
| 52 | return verdicts_dict[value] + ' (%s)' % value |
---|
[7688] | 53 | return verdicts_dict[value] |
---|
[7620] | 54 | |
---|
[7681] | 55 | |
---|
[7150] | 56 | class IStudentsUtils(Interface): |
---|
| 57 | """A collection of methods which are subject to customization. |
---|
| 58 | |
---|
| 59 | """ |
---|
[7841] | 60 | def setReturningData(student): |
---|
| 61 | """ This method defines what happens after school fee payment |
---|
| 62 | depending on the student's senate verdict. |
---|
| 63 | |
---|
| 64 | In the base configuration current level is always increased |
---|
| 65 | by 100 no matter which verdict has been assigned. |
---|
| 66 | """ |
---|
| 67 | |
---|
[8595] | 68 | def setPaymentDetails(category, student): |
---|
| 69 | """Create Payment object and set the payment data of a student for |
---|
| 70 | the payment category specified. |
---|
[7150] | 71 | |
---|
| 72 | """ |
---|
| 73 | |
---|
[7186] | 74 | def getAccommodation_details(student): |
---|
[7150] | 75 | """Determine the accommodation dates of a student. |
---|
| 76 | |
---|
| 77 | """ |
---|
| 78 | |
---|
[7186] | 79 | def selectBed(available_beds): |
---|
[7150] | 80 | """Select a bed from a list of available beds. |
---|
| 81 | |
---|
| 82 | In the standard configuration we select the first bed found, |
---|
| 83 | but can also randomize the selection if we like. |
---|
| 84 | """ |
---|
| 85 | |
---|
[7186] | 86 | def renderPDF(view, subject='', filename='slip.pdf',): |
---|
[7150] | 87 | """Render pdf slips for various pages. |
---|
| 88 | |
---|
| 89 | """ |
---|
| 90 | |
---|
[7819] | 91 | class IStudentsContainer(IKofaObject): |
---|
[7096] | 92 | """A students container contains university students. |
---|
[6692] | 93 | |
---|
| 94 | """ |
---|
| 95 | def addStudent(student): |
---|
| 96 | """Add an IStudent object and subcontainers. |
---|
| 97 | |
---|
| 98 | """ |
---|
| 99 | |
---|
| 100 | def archive(id=None): |
---|
| 101 | """Create on-dist archive of students. |
---|
| 102 | |
---|
| 103 | If id is `None`, all students are archived. |
---|
| 104 | |
---|
| 105 | If id contains a single id string, only the respective |
---|
| 106 | students are archived. |
---|
| 107 | |
---|
| 108 | If id contains a list of id strings all of the respective |
---|
| 109 | students types are saved to disk. |
---|
| 110 | """ |
---|
| 111 | |
---|
| 112 | def clear(id=None, archive=True): |
---|
| 113 | """Remove students of type given by 'id'. |
---|
| 114 | |
---|
| 115 | Optionally archive the students. |
---|
| 116 | |
---|
| 117 | If id is `None`, all students are archived. |
---|
| 118 | |
---|
| 119 | If id contains a single id string, only the respective |
---|
| 120 | students are archived. |
---|
| 121 | |
---|
| 122 | If id contains a list of id strings all of the respective |
---|
| 123 | student types are saved to disk. |
---|
| 124 | |
---|
| 125 | If `archive` is ``False`` none of the archive-handling is done |
---|
| 126 | and respective students are simply removed from the |
---|
| 127 | database. |
---|
| 128 | """ |
---|
| 129 | |
---|
[8408] | 130 | unique_student_id = Attribute("""A unique student id.""") |
---|
| 131 | |
---|
[7819] | 132 | class IStudentNavigation(IKofaObject): |
---|
[8735] | 133 | """Interface needed for student navigation, logging, etc. |
---|
[7150] | 134 | |
---|
[6642] | 135 | """ |
---|
[8736] | 136 | student = Attribute('Student object of context.') |
---|
[7150] | 137 | |
---|
[8735] | 138 | def writeLogMessage(view, message): |
---|
| 139 | """Write a view specific log message into students.log. |
---|
| 140 | |
---|
| 141 | """ |
---|
| 142 | |
---|
[7819] | 143 | class IStudentBase(IKofaObject): |
---|
[6631] | 144 | """Representation of student base data. |
---|
[7150] | 145 | |
---|
[6621] | 146 | """ |
---|
[7062] | 147 | history = Attribute('Object history, a list of messages') |
---|
[6637] | 148 | state = Attribute('Returns the registration state of a student') |
---|
[6699] | 149 | password = Attribute('Encrypted password of a student') |
---|
[7203] | 150 | certcode = Attribute('The certificate code of any chosen study course') |
---|
| 151 | depcode = Attribute('The department code of any chosen study course') |
---|
| 152 | faccode = Attribute('The faculty code of any chosen study course') |
---|
[7062] | 153 | current_session = Attribute('The current session of the student') |
---|
[9142] | 154 | current_level = Attribute('The current level of the student') |
---|
[7641] | 155 | current_mode = Attribute('The current mode of the student') |
---|
[7364] | 156 | fullname = Attribute('All name parts separated by hyphens') |
---|
| 157 | display_fullname = Attribute('The fullname of an applicant') |
---|
[8969] | 158 | is_postgrad = Attribute('True if postgraduate student') |
---|
[6637] | 159 | |
---|
[8983] | 160 | suspended = schema.Bool( |
---|
| 161 | title = _(u'Account suspended'), |
---|
| 162 | default = False, |
---|
[9035] | 163 | required = False, |
---|
[8983] | 164 | ) |
---|
| 165 | |
---|
[6665] | 166 | student_id = schema.TextLine( |
---|
[7723] | 167 | title = _(u'Student Id'), |
---|
[6849] | 168 | required = False, |
---|
[6665] | 169 | ) |
---|
| 170 | |
---|
[7357] | 171 | firstname = schema.TextLine( |
---|
[7723] | 172 | title = _(u'First Name'), |
---|
[6621] | 173 | required = True, |
---|
| 174 | ) |
---|
| 175 | |
---|
[7357] | 176 | middlename = schema.TextLine( |
---|
[7723] | 177 | title = _(u'Middle Name'), |
---|
[7357] | 178 | required = False, |
---|
| 179 | ) |
---|
| 180 | |
---|
| 181 | lastname = schema.TextLine( |
---|
[7723] | 182 | title = _(u'Last Name (Surname)'), |
---|
[7357] | 183 | required = True, |
---|
| 184 | ) |
---|
| 185 | |
---|
[6996] | 186 | sex = schema.Choice( |
---|
[7723] | 187 | title = _(u'Sex'), |
---|
[6996] | 188 | source = GenderSource(), |
---|
| 189 | required = True, |
---|
| 190 | ) |
---|
| 191 | |
---|
[6788] | 192 | reg_number = TextLineChoice( |
---|
[7723] | 193 | title = _(u'Registration Number'), |
---|
[6696] | 194 | required = True, |
---|
| 195 | readonly = False, |
---|
[6788] | 196 | source = contextual_reg_num_source, |
---|
[6696] | 197 | ) |
---|
| 198 | |
---|
[6788] | 199 | matric_number = TextLineChoice( |
---|
[7723] | 200 | title = _(u'Matriculation Number'), |
---|
[6750] | 201 | required = False, |
---|
| 202 | readonly = False, |
---|
[6788] | 203 | source = contextual_mat_num_source, |
---|
[6750] | 204 | ) |
---|
| 205 | |
---|
[6769] | 206 | adm_code = schema.TextLine( |
---|
[7723] | 207 | title = _(u'PWD Activation Code'), |
---|
[6769] | 208 | required = False, |
---|
[8977] | 209 | readonly = False, |
---|
[6769] | 210 | ) |
---|
| 211 | |
---|
[7133] | 212 | email = schema.ASCIILine( |
---|
[7723] | 213 | title = _(u'Email'), |
---|
[7133] | 214 | required = False, |
---|
| 215 | constraint=validate_email, |
---|
| 216 | ) |
---|
[8176] | 217 | phone = PhoneNumber( |
---|
[7723] | 218 | title = _(u'Phone'), |
---|
[7331] | 219 | description = u'', |
---|
[7133] | 220 | required = False, |
---|
| 221 | ) |
---|
| 222 | |
---|
[9131] | 223 | def transfer(certificate, current_session, |
---|
| 224 | current_level, current_verdict): |
---|
| 225 | """ Creates a new studycourse and backups the old one. |
---|
| 226 | |
---|
| 227 | """ |
---|
| 228 | |
---|
[7993] | 229 | class IUGStudentClearance(IKofaObject): |
---|
| 230 | """Representation of undergraduate student clearance data. |
---|
[7150] | 231 | |
---|
[6631] | 232 | """ |
---|
[8160] | 233 | date_of_birth = FormattedDate( |
---|
[7723] | 234 | title = _(u'Date of Birth'), |
---|
[6631] | 235 | required = True, |
---|
[8160] | 236 | show_year = True, |
---|
[6631] | 237 | ) |
---|
| 238 | |
---|
[6695] | 239 | clearance_locked = schema.Bool( |
---|
[7723] | 240 | title = _(u'Clearance form locked'), |
---|
[6695] | 241 | default = False, |
---|
[9035] | 242 | required = False, |
---|
[6695] | 243 | ) |
---|
| 244 | |
---|
[6769] | 245 | clr_code = schema.TextLine( |
---|
[7723] | 246 | title = _(u'CLR Activation Code'), |
---|
[6769] | 247 | required = False, |
---|
[8977] | 248 | readonly = False, |
---|
[6769] | 249 | ) |
---|
| 250 | |
---|
[7523] | 251 | nationality = schema.Choice( |
---|
[8069] | 252 | vocabulary = nats_vocab, |
---|
[7723] | 253 | title = _(u'Nationality'), |
---|
[7983] | 254 | required = False, |
---|
[7523] | 255 | ) |
---|
| 256 | |
---|
[7993] | 257 | class IPGStudentClearance(IUGStudentClearance): |
---|
| 258 | """Representation of postgraduate student clearance data. |
---|
| 259 | |
---|
| 260 | """ |
---|
| 261 | employer = schema.TextLine( |
---|
| 262 | title = _(u'Employer'), |
---|
| 263 | required = False, |
---|
| 264 | readonly = False, |
---|
| 265 | ) |
---|
| 266 | |
---|
[7819] | 267 | class IStudentPersonal(IKofaObject): |
---|
[6631] | 268 | """Representation of student personal data. |
---|
[7150] | 269 | |
---|
[6631] | 270 | """ |
---|
[6651] | 271 | perm_address = schema.Text( |
---|
[7723] | 272 | title = _(u'Permanent Address'), |
---|
[6631] | 273 | required = False, |
---|
| 274 | ) |
---|
| 275 | |
---|
[8008] | 276 | class IStudent(IStudentBase,IUGStudentClearance,IPGStudentClearance, |
---|
| 277 | IStudentPersonal): |
---|
[6631] | 278 | """Representation of a student. |
---|
[7150] | 279 | |
---|
[6631] | 280 | """ |
---|
| 281 | |
---|
[6849] | 282 | class IStudentUpdateByRegNo(IStudent): |
---|
| 283 | """Representation of a student. Skip regular reg_number validation. |
---|
[7150] | 284 | |
---|
[6849] | 285 | """ |
---|
| 286 | reg_number = schema.TextLine( |
---|
[7723] | 287 | title = _(u'Registration Number'), |
---|
[6849] | 288 | required = False, |
---|
| 289 | ) |
---|
| 290 | |
---|
| 291 | class IStudentUpdateByMatricNo(IStudent): |
---|
| 292 | """Representation of a student. Skip regular matric_number validation. |
---|
[7150] | 293 | |
---|
[6849] | 294 | """ |
---|
| 295 | matric_number = schema.TextLine( |
---|
[7723] | 296 | title = _(u'Matriculation Number'), |
---|
[6849] | 297 | required = False, |
---|
| 298 | ) |
---|
| 299 | |
---|
[8779] | 300 | class IStudentRequestPW(IStudent): |
---|
| 301 | """Representation of an student for first-time password request. |
---|
| 302 | |
---|
| 303 | This interface is used when students use the requestpw page to |
---|
| 304 | login for the the first time. |
---|
| 305 | """ |
---|
[8854] | 306 | number = schema.TextLine( |
---|
| 307 | title = _(u'Registr. or Matric. Number'), |
---|
[8779] | 308 | required = True, |
---|
| 309 | ) |
---|
| 310 | |
---|
| 311 | firstname = schema.TextLine( |
---|
| 312 | title = _(u'First Name'), |
---|
| 313 | required = True, |
---|
| 314 | ) |
---|
| 315 | |
---|
| 316 | email = schema.ASCIILine( |
---|
| 317 | title = _(u'Email Address'), |
---|
| 318 | required = True, |
---|
| 319 | constraint=validate_email, |
---|
| 320 | ) |
---|
| 321 | |
---|
[7819] | 322 | class IStudentStudyCourse(IKofaObject): |
---|
[6633] | 323 | """A container for student study levels. |
---|
| 324 | |
---|
| 325 | """ |
---|
[6648] | 326 | certificate = schema.Choice( |
---|
[7723] | 327 | title = _(u'Certificate'), |
---|
[6648] | 328 | source = CertificateSource(), |
---|
[7209] | 329 | required = False, |
---|
[6633] | 330 | ) |
---|
[6635] | 331 | |
---|
[6996] | 332 | entry_mode = schema.Choice( |
---|
[7723] | 333 | title = _(u'Entry Mode'), |
---|
[7681] | 334 | source = StudyModeSource(), |
---|
[6996] | 335 | required = True, |
---|
| 336 | readonly = False, |
---|
| 337 | ) |
---|
| 338 | |
---|
| 339 | entry_session = schema.Choice( |
---|
[7723] | 340 | title = _(u'Entry Session'), |
---|
[6996] | 341 | source = academic_sessions_vocab, |
---|
[7425] | 342 | #default = datetime.now().year, |
---|
[6996] | 343 | required = True, |
---|
| 344 | readonly = False, |
---|
| 345 | ) |
---|
| 346 | |
---|
[6724] | 347 | current_session = schema.Choice( |
---|
[7723] | 348 | title = _(u'Current Session'), |
---|
[6744] | 349 | source = academic_sessions_vocab, |
---|
[6724] | 350 | required = True, |
---|
[6996] | 351 | readonly = False, |
---|
[6724] | 352 | ) |
---|
| 353 | |
---|
| 354 | current_level = schema.Choice( |
---|
[7723] | 355 | title = _(u'Current Level'), |
---|
[6725] | 356 | source = StudyLevelSource(), |
---|
| 357 | required = False, |
---|
[6996] | 358 | readonly = False, |
---|
[6724] | 359 | ) |
---|
| 360 | |
---|
| 361 | current_verdict = schema.Choice( |
---|
[7723] | 362 | title = _(u'Current Verdict'), |
---|
[7619] | 363 | source = VerdictSource(), |
---|
[8820] | 364 | default = '0', |
---|
[6725] | 365 | required = False, |
---|
[6724] | 366 | ) |
---|
| 367 | |
---|
| 368 | previous_verdict = schema.Choice( |
---|
[7723] | 369 | title = _(u'Previous Verdict'), |
---|
[7619] | 370 | source = VerdictSource(), |
---|
[8820] | 371 | default = '0', |
---|
[6725] | 372 | required = False, |
---|
[6724] | 373 | ) |
---|
| 374 | |
---|
[9138] | 375 | class IStudentStudyCourseTransfer(IStudentStudyCourse): |
---|
| 376 | """An student transfers. |
---|
| 377 | |
---|
| 378 | """ |
---|
| 379 | |
---|
| 380 | certificate = schema.Choice( |
---|
| 381 | title = _(u'Certificate'), |
---|
| 382 | source = CertificateSource(), |
---|
| 383 | required = True, |
---|
| 384 | ) |
---|
| 385 | |
---|
| 386 | current_level = schema.Choice( |
---|
| 387 | title = _(u'Current Level'), |
---|
| 388 | source = StudyLevelSource(), |
---|
| 389 | required = True, |
---|
| 390 | readonly = False, |
---|
| 391 | ) |
---|
| 392 | |
---|
| 393 | |
---|
| 394 | IStudentStudyCourseTransfer['certificate'].order = IStudentStudyCourse[ |
---|
| 395 | 'certificate'].order |
---|
| 396 | IStudentStudyCourseTransfer['current_level'].order = IStudentStudyCourse[ |
---|
| 397 | 'current_level'].order |
---|
| 398 | |
---|
[7951] | 399 | class IStudentVerdictUpdate(IKofaObject): |
---|
| 400 | """A interface for verdict imports. |
---|
| 401 | |
---|
| 402 | """ |
---|
| 403 | |
---|
| 404 | current_verdict = schema.Choice( |
---|
| 405 | title = _(u'Current Verdict'), |
---|
| 406 | source = VerdictSource(), |
---|
| 407 | required = True, |
---|
| 408 | ) |
---|
| 409 | |
---|
| 410 | current_session = schema.Choice( |
---|
| 411 | title = _(u'Current Session'), |
---|
| 412 | source = academic_sessions_vocab, |
---|
| 413 | required = True, |
---|
| 414 | ) |
---|
| 415 | |
---|
| 416 | current_level = schema.Choice( |
---|
| 417 | title = _(u'Current Level'), |
---|
| 418 | source = StudyLevelSource(), |
---|
| 419 | required = True, |
---|
| 420 | ) |
---|
| 421 | |
---|
[7819] | 422 | class IStudentStudyLevel(IKofaObject): |
---|
[6774] | 423 | """A container for course tickets. |
---|
| 424 | |
---|
| 425 | """ |
---|
| 426 | level = Attribute('The level code') |
---|
[6793] | 427 | validation_date = Attribute('The date of validation') |
---|
| 428 | validated_by = Attribute('User Id of course adviser') |
---|
[6774] | 429 | |
---|
[6793] | 430 | level_session = schema.Choice( |
---|
[7723] | 431 | title = _(u'Session'), |
---|
[6793] | 432 | source = academic_sessions_vocab, |
---|
| 433 | required = True, |
---|
| 434 | ) |
---|
[6781] | 435 | |
---|
[6793] | 436 | level_verdict = schema.Choice( |
---|
[7723] | 437 | title = _(u'Verdict'), |
---|
[7619] | 438 | source = VerdictSource(), |
---|
[8820] | 439 | default = '0', |
---|
[6793] | 440 | required = False, |
---|
| 441 | ) |
---|
| 442 | |
---|
[8920] | 443 | def addCourseTicket(ticket, course): |
---|
[8182] | 444 | """Add a course ticket object. |
---|
| 445 | """ |
---|
| 446 | |
---|
[7819] | 447 | class ICourseTicket(IKofaObject): |
---|
[6781] | 448 | """A course ticket. |
---|
| 449 | |
---|
| 450 | """ |
---|
[6783] | 451 | code = Attribute('code of the original course') |
---|
| 452 | title = Attribute('title of the original course') |
---|
| 453 | credits = Attribute('credits of the original course') |
---|
| 454 | passmark = Attribute('passmark of the original course') |
---|
| 455 | semester = Attribute('semester of the original course') |
---|
[7304] | 456 | fcode = Attribute('faculty code of the original course') |
---|
| 457 | dcode = Attribute('department code of the original course') |
---|
[6781] | 458 | |
---|
[7665] | 459 | mandatory = schema.Bool( |
---|
[7723] | 460 | title = _(u'Mandatory'), |
---|
[6795] | 461 | default = False, |
---|
| 462 | required = False, |
---|
| 463 | readonly = False, |
---|
| 464 | ) |
---|
| 465 | |
---|
[6781] | 466 | score = schema.Int( |
---|
[7723] | 467 | title = _(u'Score'), |
---|
[6781] | 468 | default = 0, |
---|
| 469 | required = False, |
---|
| 470 | readonly = False, |
---|
| 471 | ) |
---|
| 472 | |
---|
[6806] | 473 | automatic = schema.Bool( |
---|
[7723] | 474 | title = _(u'Automatical Creation'), |
---|
[6806] | 475 | default = False, |
---|
| 476 | required = False, |
---|
| 477 | readonly = True, |
---|
| 478 | ) |
---|
| 479 | |
---|
[7661] | 480 | carry_over = schema.Bool( |
---|
[7723] | 481 | title = _(u'Carry-over Course'), |
---|
[7661] | 482 | default = False, |
---|
| 483 | required = False, |
---|
| 484 | readonly = False, |
---|
| 485 | ) |
---|
| 486 | |
---|
[7633] | 487 | def getLevel(): |
---|
| 488 | """Returns the id of the level the ticket has been added to. |
---|
| 489 | """ |
---|
| 490 | |
---|
| 491 | def getLevelSession(): |
---|
| 492 | """Returns the session of the level the ticket has been added to. |
---|
| 493 | """ |
---|
| 494 | |
---|
[6795] | 495 | class ICourseTicketAdd(ICourseTicket): |
---|
[7150] | 496 | """An interface for adding course tickets. |
---|
[6795] | 497 | |
---|
| 498 | """ |
---|
| 499 | course = schema.Choice( |
---|
[7723] | 500 | title = _(u'Course'), |
---|
[6795] | 501 | source = CourseSource(), |
---|
| 502 | readonly = False, |
---|
| 503 | ) |
---|
| 504 | |
---|
[7819] | 505 | class IStudentAccommodation(IKofaObject): |
---|
[6635] | 506 | """A container for student accommodation objects. |
---|
| 507 | |
---|
| 508 | """ |
---|
| 509 | |
---|
[7819] | 510 | class IBedTicket(IKofaObject): |
---|
[6989] | 511 | """A ticket for accommodation booking. |
---|
| 512 | |
---|
| 513 | """ |
---|
[6996] | 514 | bed = Attribute('The bed object.') |
---|
| 515 | |
---|
| 516 | bed_coordinates = schema.TextLine( |
---|
[7723] | 517 | title = _(u'Bed Coordinates'), |
---|
[6992] | 518 | required = False, |
---|
[7014] | 519 | readonly = False, |
---|
[6992] | 520 | ) |
---|
| 521 | |
---|
[6996] | 522 | bed_type = schema.TextLine( |
---|
[7723] | 523 | title = _(u'Bed Type'), |
---|
[6996] | 524 | required = False, |
---|
[7014] | 525 | readonly = False, |
---|
[6996] | 526 | ) |
---|
| 527 | |
---|
[6992] | 528 | booking_session = schema.Choice( |
---|
[7723] | 529 | title = _(u'Session'), |
---|
[6992] | 530 | source = academic_sessions_vocab, |
---|
| 531 | required = True, |
---|
[7014] | 532 | readonly = True, |
---|
[6992] | 533 | ) |
---|
| 534 | |
---|
[8170] | 535 | booking_date = schema.Datetime( |
---|
[7723] | 536 | title = _(u'Booking Date'), |
---|
[6992] | 537 | required = False, |
---|
[7014] | 538 | readonly = True, |
---|
[6992] | 539 | ) |
---|
| 540 | |
---|
| 541 | booking_code = schema.TextLine( |
---|
[7723] | 542 | title = _(u'Booking Activation Code'), |
---|
[6992] | 543 | required = False, |
---|
[7014] | 544 | readonly = True, |
---|
[6992] | 545 | ) |
---|
| 546 | |
---|
[6994] | 547 | def getSessionString(): |
---|
[7633] | 548 | """Returns the title of academic_sessions_vocab term. |
---|
[7150] | 549 | |
---|
[6994] | 550 | """ |
---|
[6992] | 551 | |
---|
[6860] | 552 | class IStudentPaymentsContainer(IPaymentsContainer): |
---|
[6635] | 553 | """A container for student payment objects. |
---|
| 554 | |
---|
| 555 | """ |
---|
| 556 | |
---|
[6877] | 557 | class IStudentOnlinePayment(IOnlinePayment): |
---|
| 558 | """A student payment via payment gateways. |
---|
| 559 | |
---|
| 560 | """ |
---|
| 561 | |
---|
[8268] | 562 | p_level = schema.Int( |
---|
| 563 | title = _(u'Payment Level'), |
---|
| 564 | required = False, |
---|
| 565 | readonly = True, |
---|
| 566 | ) |
---|
[6877] | 567 | |
---|
[8422] | 568 | def doAfterStudentPayment(): |
---|
| 569 | """Process student after payment was made. |
---|
| 570 | |
---|
| 571 | """ |
---|
| 572 | |
---|
[8453] | 573 | def doAfterStudentPaymentApproval(): |
---|
| 574 | """Process student after payment was approved. |
---|
| 575 | |
---|
| 576 | """ |
---|
| 577 | |
---|
[8420] | 578 | def approveStudentPayment(): |
---|
[8422] | 579 | """Approve payment and process student. |
---|
[8420] | 580 | |
---|
| 581 | """ |
---|
| 582 | |
---|
[8268] | 583 | IStudentOnlinePayment['p_level'].order = IStudentOnlinePayment[ |
---|
| 584 | 'p_session'].order |
---|
[8408] | 585 | |
---|
| 586 | class ICSVStudentExporter(ICSVExporter): |
---|
| 587 | """A regular ICSVExporter that additionally supports exporting |
---|
| 588 | data from a given student object. |
---|
| 589 | """ |
---|
| 590 | |
---|
| 591 | def export_student(student, filepath=None): |
---|
| 592 | """Export data for a given student. |
---|
| 593 | """ |
---|