Changeset 3984
- Timestamp:
- 26 Feb 2009, 22:22:07 (16 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPImport.py
r3977 r3984 75 75 self.courses_catalog = waeup_tool.courses_catalog 76 76 self.course_results = waeup_tool.course_results 77 self.payments_catalog = waeup_tool.payments_catalog 77 78 self.applicants_catalog = waeup_tool.applicants_catalog 78 79 #self.mode = mode … … 826 827 d = {} 827 828 transition = mapping.get('reg_transition','admit') 828 if transition not in ('admit','return','pay_school_fee','validate_courses' ):829 if transition not in ('admit','return','pay_school_fee','validate_courses','graduate'): 829 830 msg = "no valid transition provided" 830 831 break … … 871 872 msg = '' 872 873 export_file = "%s/export/students_removed.csv" % (i_home) 874 reimport_file = "%s/export/students_for_reimport.csv" % (i_home) 873 875 874 #toexport = { 875 # 876 # 'personal': ('firstname', 877 # 'middlename', 878 # 'lastname', 879 # 'perm_address', 880 # ), 881 # 'clearance': ('lga', 882 # 'birthday', 883 # ) 884 # 885 # } 876 toexport_for_reimport = { 877 878 'personal': 879 ('firstname', 880 'middlename', 881 'lastname', 882 'sex', 883 'email', 884 'phone', 885 'perm_address', 886 ), 887 'clearance': 888 ('matric_no', 889 'nationality', 890 'lga', 891 'birthday', 892 ), 893 'application': 894 ('jamb_reg_no', 895 'entry_mode', 896 'entry_session', 897 'jamb_score', 898 'app_email', 899 'jamb_age', 900 'jamb_state', 901 'jamb_lga', 902 'jamb_sex', 903 ), 904 'study_course': 905 ('study_course', 906 'current_level', 907 'current_session', 908 'current_verdict', 909 'previous_verdict', 910 ) 911 } 886 912 887 913 sub_types = ['StudentApplication','StudentClearance','StudentPersonal','StudentStudyCourse'] … … 903 929 # begin export 904 930 line = [] 905 fields = [] 906 for f in self.students_catalog.schema(): 907 fields.append(f) 931 fields = ['student_id','reg_state','password'] 932 line_for_reimport = [] 933 fields_for_reimport = ['student_id','reg_state','password','import_mode'] 934 #fields = [] 935 #for f in self.students_catalog.schema(): 936 # fields.append(f) 908 937 for k in toexport.keys(): 909 938 for f in toexport[k]: 910 939 fields.append(f) 940 for k in toexport_for_reimport.keys(): 941 for f in toexport_for_reimport[k]: 942 fields_for_reimport.append(f) 911 943 if True: #not os.path.exists(export_file): 912 #headline = ','.join(fields).replace('level','current_level')913 944 headline = ','.join(fields) 914 headline = headline + ',password'915 945 open(export_file,"a").write(headline +'\n') 946 headline_for_reimport = ','.join(fields_for_reimport) 947 open(reimport_file,"a").write(headline_for_reimport +'\n') 916 948 format = '"%(' + ')s","%('.join(fields) + ')s"' 917 format = format + ',"%(password)s"'949 format_for_reimport = '"%(' + ')s","%('.join(fields_for_reimport) + ')s"' 918 950 res = self.students_catalog(id = student_id) 919 951 student = res[0] 920 952 student_obj = getattr(students_folder,student_id) 921 d = student.getFormattedStudentEntry(student) 953 #d = student.getFormattedStudentEntry(student) 954 d = {'student_id':student_id,'reg_state':student.review_state,'import_mode':'create'} 922 955 for k in toexport.keys()[0:]: 923 956 try: … … 934 967 line.append(format % d) 935 968 open(export_file,"a").write('\n'.join(line) +'\n') 969 line_for_reimport.append(format_for_reimport % d) 970 open(reimport_file,"a").write('\n'.join(line_for_reimport) +'\n') 936 971 self.course_results.getExportRemoveAllCourses(student_id = student_id, export = True, remove = True) 972 # self.course_results.getExportRemoveAllCourses(student_id = student_id, export = True, remove = False) 973 self.payments_catalog.getExportRemoveAllPayments(student_id = student_id, export = True, remove = True) 974 # self.payments_catalog.getExportRemoveAllPayments(student_id = student_id, export = True, remove = False) 975 self.waeup_tool.exportAllStudyLevels(student_id = student_id) 937 976 # end export 938 977 students_folder.manage_delObjects((student_id),) -
WAeUP_SRP/trunk/WAeUPTables.py
r3958 r3984 1697 1697 return courses 1698 1698 ###) 1699 1700 1699 1701 1700 1702 InitializeClass(CourseResults) … … 1795 1797 1796 1798 1799 def getExportRemoveAllPayments(self,student_id,export=False,remove=False): ###( 1800 "" 1801 query = Eq('student_id',student_id) 1802 pm_catalog = self.payments_catalog 1803 payments = pm_catalog.evalAdvancedQuery(query) 1804 payments_dic = [] 1805 fields = self.schema() 1806 format = '"%(' + ')s","%('.join(fields) + ')s"' 1807 for brain in payments: 1808 d = {} 1809 for field in fields: 1810 d[field] = getattr(brain,field,'') 1811 payments_dic.append(format % d) 1812 1813 if export: 1814 export_file = "%s/export/payments_removed.csv" % (i_home) 1815 file_handler = open(export_file,"a") 1816 headline = ','.join(fields) 1817 file_handler.write(headline +'\n') 1818 for line in payments_dic: 1819 file_handler.write(line +'\n') 1820 1821 if remove: 1822 for brain in payments: 1823 order_id = getattr(brain,'order_id','') 1824 pm_catalog.deleteRecord(order_id) 1825 1826 return payments_dic 1827 ###) 1828 1797 1829 InitializeClass(PaymentsCatalog) 1798 1830 -
WAeUP_SRP/trunk/WAeUPTool.py
r3973 r3984 1181 1181 l.getContent().edit(mapping={'Title': "Level %s" % level}) 1182 1182 ###) 1183 1184 1185 security.declareProtected(ModifyPortalContent,'makeStudentLevel') ###( 1186 def exportAllStudyLevels(self,student_id): 1187 "export the StudyLevels for a student" 1188 #import pdb;pdb.set_trace() 1189 logger = logging.getLogger('WAeUPTool.exportAllStudyLevels') 1190 students_folder = self.portal_url.getPortalObject().campus.students 1191 res = self.students_catalog(id=student_id) 1192 if res: 1193 st = res[0] 1194 course = st.course 1195 matric_no = st.matric_no 1196 level = st.level 1197 student_obj = getattr(self.portal_url.getPortalObject().campus.students,student_id) 1198 studycourse = getattr(student_obj,"study_course",None) 1199 levels = studycourse.objectIds() 1200 1201 stool = getToolByName(self, 'portal_schemas') 1202 schema = stool._getOb('student_study_level') 1203 fields = ['student_id','level'] 1204 fields.extend(schema.keys()) 1205 format = '"%(' + ')s","%('.join(fields) + ')s"' 1206 export_file = "%s/export/study_levels_removed.csv" % (i_home) 1207 file_handler = open(export_file,"a") 1208 headline = ','.join(fields) 1209 file_handler.write(headline +'\n') 1210 1211 for level in levels: 1212 level_object = getattr(studycourse,level) 1213 level_content = level_object.getContent() 1214 d = {'student_id':student_id,'level':level} 1215 for field in schema.keys(): 1216 d[field] = getattr(level_content,field,'') 1217 line = format % d 1218 file_handler.write(line +'\n') 1219 1220 ###) 1183 1221 1184 1222 security.declarePublic('getHallInfo') ###( -
WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_wf/definition.xml
r3747 r3984 226 226 <exit-transition transition_id="deactivate"/> 227 227 <exit-transition transition_id="pay_school_fee"/> 228 <exit-transition transition_id="graduate"/> 228 229 <permission-map name="Delete objects" acquired="False"> 229 230 <permission-role>Manager</permission-role>
Note: See TracChangeset for help on using the changeset viewer.