Changeset 3988 for WAeUP_SRP/trunk
- Timestamp:
- 28 Feb 2009, 10:17:03 (16 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/Upload.py
r3360 r3988 12 12 from Products.WAeUP_SRP.WAeUPTables import AccommodationTable,NOT_OCCUPIED 13 13 from WAeUPImport import ApplicationImport,CertificateImport,CertificateCourseImport 14 from WAeUPImport import CourseImport,CourseResultImport 14 from WAeUPImport import CourseImport,CourseResultImport,PaymentImport 15 15 from WAeUPImport import DepartmentImport,FacultyImport,StudentImport,VerdictImport,StudentStudyLevelImport 16 16 from WAeUPImport import NO_KEY,IGNORE -
WAeUP_SRP/trunk/WAeUPImport.py
r3987 r3988 989 989 line_for_reimport.append(format_for_reimport % d) 990 990 open(reimport_file,"a").write('\n'.join(line_for_reimport) +'\n') 991 self.course_results. getExportRemoveAllCourses(student_id = student_id, export = True, remove = True)992 # self.course_results. getExportRemoveAllCourses(student_id = student_id, export = True, remove = False)993 self.payments_catalog. getExportRemoveAllPayments(student_id = student_id, export = True, remove = True)994 # self.payments_catalog. getExportRemoveAllPayments(student_id = student_id, export = True, remove = False)991 self.course_results.exportRemoveAllCourses(student_id = student_id, export = True, remove = True) 992 # self.course_results.exportRemoveAllCourses(student_id = student_id, export = True, remove = False) 993 self.payments_catalog.exportRemoveAllPayments(student_id = student_id, export = True, remove = True) 994 # self.payments_catalog.exportRemoveAllPayments(student_id = student_id, export = True, remove = False) 995 995 self.waeup_tool.exportAllStudyLevels(student_id = student_id) 996 996 # end export … … 1134 1134 "edit student levels and create StudentStudyLevel object if not existent" 1135 1135 wftool = self.portal_workflow 1136 logger = logging.getLogger('WAeUP Tool.mass_create_level')1136 logger = logging.getLogger('WAeUPImport.StudentStudyLevelImport.create') 1137 1137 students_folder = self.portal_url.getPortalObject().campus.students 1138 1138 student_id = mapping.get('id',None) … … 1177 1177 "edit student levels" 1178 1178 wftool = self.portal_workflow 1179 logger = logging.getLogger('WAeUP Tool.mass_edit_level')1179 logger = logging.getLogger('WAeUPImport.StudentStudyLevelImport.edit') 1180 1180 students_folder = self.portal_url.getPortalObject().campus.students 1181 1181 student_id = mapping.get('id',None) … … 1221 1221 "edit student verdicts and create StudentStudyLevel object if not existent" 1222 1222 wftool = self.portal_workflow 1223 logger = logging.getLogger('WAeUP Tool.mass_edit_verdict')1223 logger = logging.getLogger('WAeUPImport.VerdictImport.create') 1224 1224 students_folder = self.portal_url.getPortalObject().campus.students 1225 1225 student_id = mapping.get('id',None) … … 1310 1310 "edit student verdicts" 1311 1311 wftool = self.portal_workflow 1312 logger = logging.getLogger('WAeUP Tool.mass_edit_verdict')1312 logger = logging.getLogger('WAeUPImport.VerdictImport.edit') 1313 1313 students_folder = self.portal_url.getPortalObject().campus.students 1314 1314 student_id = mapping.get('id',None) … … 1389 1389 ###) 1390 1390 1391 def edit_old(self,mapping): ###( 1392 "edit student verdicts" 1391 1392 1393 class PaymentImport(WAeUPImport):###( 1394 """ PaymentImport """ 1395 name = "payment" 1396 plural_name = "%ss" % name 1397 commit_after = 1000000 1398 required_modes = ('create',) 1399 1400 def create(self,mapping): ###( 1401 "create payment object" 1393 1402 wftool = self.portal_workflow 1394 logger = logging.getLogger('WAeUP Tool.mass_edit_verdict')1403 logger = logging.getLogger('WAeUPImport.PaymentImport.create') 1395 1404 students_folder = self.portal_url.getPortalObject().campus.students 1396 1405 student_id = mapping.get('id',None) 1397 matric_no = mapping.get('matric_no',None) 1406 order_id = key= mapping.get('order_id',None) 1407 payment_type = mapping.get('type',None) 1398 1408 editable_keys = mapping.keys() 1399 1409 key = '' 1400 while True: 1401 msg = '' 1402 if student_id: 1403 student_record = self.students_catalog.getRecordByKey(student_id) 1404 if student_record is None: 1405 #return '',"no student with id %s" % student_id 1406 msg = "no student with id %s" % student_id 1410 msg = '' 1411 while True: 1412 result = self.findStudent('create',student_id=student_id) 1413 msg = result['msg'] 1414 if msg: 1415 break 1416 if payment_type == 'sc': 1417 hyphen = order_id.rfind('-') 1418 if not hyphen > -1: 1419 msg = '%s: wrong order_id of sc payment' % student_id 1407 1420 break 1408 if matric_no and student_record.matric_no and matric_no != student_record.matric_no: 1409 msg = 'student %s: matric_no %s does not match %s' % (student_record.id, 1410 student_record.matric_no, 1411 matric_no) 1412 break 1413 mapping['matric_no'] = student_record.matric_no 1414 elif matric_no: 1415 res = self.students_catalog(matric_no = matric_no) 1416 if not res: 1417 msg = "no student with matric_no %s" % matric_no 1418 break 1419 student_record = res[0] 1420 editable_keys.remove('matric_no') 1421 payment_object_id = 'p' + order_id[hyphen+1:] 1422 elif payment_type == 'online': 1423 payment_object_id = 'p' + order_id[6:] 1421 1424 else: 1422 msg = "no id or matric_no specified" 1423 break 1425 msg = '%s: no payment type defined' % student_id 1426 break 1427 student_record = result['student_record'] 1424 1428 student_id = student_record.id 1429 1425 1430 mapping['id'] = student_id 1426 d = {} 1427 #import pdb;pdb.set_trace() 1428 any_change = False 1429 #special treatment for StudentStudyLevel 1430 current_session = d['session'] = mapping.get('current_session','') 1431 if current_session and student_record.session != current_session: 1432 msg = 'student %s: imported session %s does not match current_session %s' % (student_id, 1433 current_session, 1434 student_record.session) 1435 break 1436 current_level = mapping.get('current_level','') 1437 if not current_level.isdigit(): 1438 msg = 'student %s: imported level is empty' % (student_id,) 1439 break 1440 if current_level and student_record.level != current_level: 1441 msg = 'student %s: imported level %s does not match current_level %s' % (student_id, 1442 current_level, 1443 student_record.level) 1444 break 1445 student_review_state = student_record.review_state 1446 if student_review_state == 'deactivated': 1447 msg = "student %s in review_state %s" % (student_id, student_review_state) 1448 break 1449 if student_review_state not in ('courses_validated','returning'): 1450 msg = "student %s in wrong review_state %s" % (student_id, student_review_state) 1451 break 1452 student_obj = getattr(students_folder,student_id) 1453 # f2t = self.field2types_student 1454 study_course_obj = getattr(student_obj,'study_course',None) 1455 if study_course_obj is None: 1456 msg = 'student %s: no study_course object' % student_id 1457 break 1458 level_obj = getattr(study_course_obj,current_level,None) 1459 if level_obj is None: 1460 msg = 'student %s: no study_level object for level %s' % (student_id, 1461 current_level) 1462 break 1463 verdict = d['verdict'] = d['current_verdict'] = mapping.get('current_verdict','') 1464 1465 #if verdict == student_record.verdict: 1466 # msg = 'student %s: verdict already set to %s' % (student_id, 1467 # verdict) 1468 1469 level_review_state = wftool.getInfoFor(level_obj,'review_state',None) 1470 if level_review_state != "closed": 1471 wftool.doActionFor(level_obj,'close') 1472 # msg = 'student %s: level %s is not closed' % (student_id, 1473 # current_level) 1474 1475 study_course_obj.getContent().edit(mapping = d) 1476 level_obj.getContent().edit(mapping = d) 1477 if student_review_state != "returning": 1478 wftool.doActionFor(student_obj,'return') 1479 # try: 1480 # wftool.doActionFor(level_obj,'close') 1481 # except: 1482 # pass 1483 break 1484 return student_id,msg,mapping 1485 ###) 1431 payments_folder = getattr(getattr(students_folder,student_id),'payments',None) 1432 if payments_folder is None: 1433 msg = '%s: no payments folder' % student_id 1434 break 1435 if getattr(payments_folder,payment_object_id,False): 1436 msg = '%s: payment object with id %s exists' % (student_id,payment_object_id) 1437 break 1438 try: 1439 #import pdb;pdb.set_trace() 1440 payments_folder.invokeFactory('Payment',"%s" % payment_object_id) 1441 payment_obj = getattr(payments_folder,"%s" % payment_object_id) 1442 except: 1443 msg = '%s: payment object %s cannot be created' % (student_id,payment_object_id) 1444 break 1445 payment_obj.getContent().edit(mapping = mapping) 1446 wftool.doActionFor(payment_obj,'close') 1447 break 1448 return key,msg,mapping 1449 ###) 1450 1451 1486 1452 ###) -
WAeUP_SRP/trunk/WAeUPTables.py
r3984 r3988 1668 1668 ###) 1669 1669 1670 def getExportRemoveAllCourses(self,student_id,export=False,remove=False): ###(1670 def exportRemoveAllCourses(self,student_id,export=False,remove=False): ###( 1671 1671 "" 1672 1672 query = Eq('student_id',student_id) … … 1797 1797 1798 1798 1799 def getExportRemoveAllPayments(self,student_id,export=False,remove=False): ###(1799 def exportRemoveAllPayments(self,student_id,export=False,remove=False): ###( 1800 1800 "" 1801 1801 query = Eq('student_id',student_id) -
WAeUP_SRP/trunk/WAeUPTool.py
r3984 r3988 44 44 from Globals import package_home,INSTANCE_HOME 45 45 from WAeUPImport import ApplicationImport,CertificateImport,CertificateCourseImport 46 from WAeUPImport import CourseImport,CourseResultImport,StudentStudyLevelImport 46 from WAeUPImport import CourseImport,CourseResultImport,StudentStudyLevelImport,PaymentImport 47 47 from WAeUPImport import DepartmentImport,FacultyImport,StudentImport,VerdictImport 48 48 from utils import makeDigest -
WAeUP_SRP/trunk/patches/PatchExtendedWidgetsCPSDateTimeWidget.py
r3673 r3988 10 10 field_id = self.fields[0] 11 11 widget_id = self.getWidgetId() 12 if datastructure.has_key(widget_id + '_date'): 13 date = datastructure[widget_id + '_date'].strip() 14 else: 15 date = datastructure[widget_id].strip() 16 if datastructure.has_key(widget_id + '_hour'): 17 hour = datastructure[widget_id + '_hour'].strip() 18 else: 19 hour = self.time_hour_default 20 if datastructure.has_key(widget_id + '_minute'): 21 minute = datastructure[widget_id + '_minute'].strip() 22 else: 23 minute = self.time_minutes_default 24 25 if not (date): 26 if self.is_required: 27 datastructure[widget_id] = '' 28 datastructure.setError(widget_id, 'cpsschemas_err_required') 29 return 0 30 else: 31 datamodel[field_id] = None 32 return 1 33 #import pdb;pdb.set_trace() 34 if self.view_format.startswith('iso8601'): 35 if re.match(r'^[0-9]+-[0-9]{2}-[0-9]{2}', date) is not None: 36 y, m, d = date.split('-') 37 else: 12 13 if self.view_format == 'import': 14 try: 15 dt = datastructure[widget_id].strip() 16 date,time,dummy = dt.split() 17 y,m,d = date.split('/') 18 hour,minute,second = time.split(':') 19 except: 38 20 datastructure.setError(widget_id, 'cpsschemas_err_date') 39 21 return 0 22 if not (date): 23 if self.is_required: 24 datastructure[widget_id] = '' 25 datastructure.setError(widget_id, 'cpsschemas_err_required') 26 return 0 27 else: 28 datamodel[field_id] = None 29 return 1 40 30 else: 41 if re.match(r'^[0-9]?[0-9][/,\-,\.][0-9]?[0-9][/,\-,\.][0-9]{2,4}$', date) is not None: 42 d, m, y = re.split(r'[/,\-,\.]',date) # always use d/m/y and use /,- or . as separator 43 #d, m, y = date.split('/') # always use d/m/y 44 # locale = self.translation_service.getSelectedLanguage() 45 # if False and locale in ('en', 'hu'): 46 # m, d, y = date.split('/') 47 # else: 31 if datastructure.has_key(widget_id + '_date'): 32 date = datastructure[widget_id + '_date'].strip() 48 33 else: 49 datastructure.setError(widget_id, 'cpsschemas_err_date') 50 return 0 34 date = datastructure[widget_id].strip() 35 if datastructure.has_key(widget_id + '_hour'): 36 hour = datastructure[widget_id + '_hour'].strip() 37 else: 38 hour = self.time_hour_default 39 if datastructure.has_key(widget_id + '_minute'): 40 minute = datastructure[widget_id + '_minute'].strip() 41 else: 42 minute = self.time_minutes_default 43 44 if not (date): 45 if self.is_required: 46 datastructure[widget_id] = '' 47 datastructure.setError(widget_id, 'cpsschemas_err_required') 48 return 0 49 else: 50 datamodel[field_id] = None 51 return 1 52 53 #import pdb;pdb.set_trace() 54 if self.view_format.startswith('iso8601'): 55 if re.match(r'^[0-9]+-[0-9]{2}-[0-9]{2}', date) is not None: 56 y, m, d = date.split('-') 57 else: 58 datastructure.setError(widget_id, 'cpsschemas_err_date') 59 return 0 60 else: 61 if re.match(r'^[0-9]?[0-9][/,\-,\.][0-9]?[0-9][/,\-,\.][0-9]{2,4}$', date) is not None: 62 d, m, y = re.split(r'[/,\-,\.]',date) # always use d/m/y and use /,- or . as separator 63 #d, m, y = date.split('/') # always use d/m/y 64 # locale = self.translation_service.getSelectedLanguage() 65 # if False and locale in ('en', 'hu'): 66 # m, d, y = date.split('/') 67 # else: 68 else: 69 datastructure.setError(widget_id, 'cpsschemas_err_date') 70 return 0 51 71 52 72 try: -
WAeUP_SRP/trunk/profiles/default/layouts.xml
r3858 r3988 79 79 <object name="import_verdict" meta_type="CPS Layout"/> 80 80 <object name="import_student_study_level" meta_type="CPS Layout"/> 81 <object name="import_payment" meta_type="CPS Layout"/> 81 82 82 83 <object name="department" meta_type="CPS Layout"/> -
WAeUP_SRP/trunk/profiles/default/layouts/import_student.xml
r3987 r3988 245 245 </widget> 246 246 247 <widget name="app_ac_date" meta_type=" StringWidget">247 <widget name="app_ac_date" meta_type="DateTime Widget"> 248 248 <property name="fields"> 249 249 <element value="app_ac_date"/> 250 250 </property> 251 </widget> 251 <property name="view_format">import</property> 252 </widget> 252 253 253 254 <widget name="app_mobile" meta_type="String Widget"> … … 257 258 </widget> 258 259 259 <widget name="request_date" meta_type=" StringWidget">260 <widget name="request_date" meta_type="DateTime Widget"> 260 261 <property name="fields"> 261 262 <element value="request_date"/> 262 263 </property> 264 <property name="view_format">import</property> 263 265 </widget> 264 266 … … 269 271 </widget> 270 272 271 <widget name="cleared_date" meta_type=" StringWidget">273 <widget name="cleared_date" meta_type="DateTime Widget"> 272 274 <property name="fields"> 273 275 <element value="cleared_date"/> 274 276 </property> 277 <property name="view_format">import</property> 275 278 </widget> 276 279 -
WAeUP_SRP/trunk/profiles/default/schemas.xml
r3858 r3988 61 61 <object name="import_verdict" meta_type="CPS Schema"/> 62 62 <object name="import_student_study_level" meta_type="CPS Schema"/> 63 <object name="import_payment" meta_type="CPS Schema"/> 63 64 64 65 <object name="course" meta_type="CPS Schema"/> -
WAeUP_SRP/trunk/profiles/default/vocabularies/import_names.xml
r3689 r3988 16 16 <item key="certificate" msgid="">Certificate Data</item> 17 17 <item key="certificate_course" msgid="">Certificate Course Data</item> 18 <item key="payment" msgid="">Payment Data</item> 18 19 </object> -
WAeUP_SRP/trunk/skins/waeup_epayment/payment_receipt.pt
r3310 r3988 112 112 <tr> 113 113 <td width="220px">Transaction Date:</td> 114 <td><span tal:content= "python:pm.date.ISO()"/></td>114 <td><span tal:content='python:pm.date.strftime("%d/%m/%y %H:%M:%S")' /></td> 115 115 </tr> 116 116 <tr>
Note: See TracChangeset for help on using the changeset viewer.