Changeset 9467 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 30 Oct 2012, 17:31:43 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r9421 r9467 679 679 # by Excel or Calc 680 680 p_id = p_id.strip('#') 681 if not p_id.startswith('p'):681 if len(p_id.split('-')) != 3 and not p_id.startswith('p'): 682 682 # For data migration from old SRP only 683 683 p_id = 'p' + p_id[7:] + '0' … … 699 699 parent = self.getParent(row, site) 700 700 p_id = row['p_id'].strip('#') 701 if not p_id.startswith('p'):701 if len(p_id.split('-')) != 3 and not p_id.startswith('p'): 702 702 # For data migration from old SRP 703 703 obj.p_id = 'p' + p_id[7:] + '0' … … 736 736 errs.append(('p_id','invalid length')) 737 737 return errs, inv_errs, conv_dict 738 elif len(p_id.split('-')) == 3: 739 # The SRP used either pins as keys ... 740 if len(p_id.split('-')[2]) != 10: 741 errs.append(('p_id','invalid pin')) 742 return errs, inv_errs, conv_dict 738 743 else: 744 # ... or order_ids. 739 745 if not len(p_id) == 19: 740 746 errs.append(('p_id','invalid length')) -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9457 r9467 27 27 from zope.catalog.interfaces import ICatalog 28 28 from zope.component import queryUtility, getUtility, createObject 29 from zope.schema.interfaces import ConstraintNotSatisfied 29 from zope.schema.interfaces import ConstraintNotSatisfied, RequiredMissing 30 30 from zope.formlib.textwidgets import BytesDisplayWidget 31 31 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState … … 2108 2108 except KeyError: 2109 2109 self.flash(_('This level exists.')) 2110 except RequiredMissing: 2111 self.flash(_('Your data are incomplete')) 2110 2112 self.redirect(self.url(self.context)) 2111 2113 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_payment_data.csv
r9466 r9467 3 3 100001,unpaid,schoolfee,3816951290712593757,,2010,0,BTECHBDT,19500.1,0942,Z0,2010-11-25 20:16:33.757 WAT,online,0 4 4 ,paid,schoolfee,p1266236341955,3,2009,19500,BTECHBDT,19500,0615,00,2010/02/15 13:19:01,online,1 5 ,paid,schoolfee,ABC-11-1234567890,3,2011,19500,BTECHBDT,19500.6,,SC,2010/02/15 13:19:01,sc,1 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r9466 r9467 909 909 payment1.p_id = 'nonsense' 910 910 # payment1.p_id will be replaced if p_id doesn't start with 'p' 911 # and is not an old PIN 911 912 self.processor.addEntry( 912 913 payment2, dict(student_id=self.student.student_id, p_id='XXXXXX456'), … … 923 924 self.assertEqual(len(errs),0) 924 925 errs, inv_errs, conv_dict = self.processor.checkConversion( 926 dict(p_id='ABC-11-1234567890')) 927 self.assertEqual(len(errs),0) 928 errs, inv_errs, conv_dict = self.processor.checkConversion( 925 929 dict(p_id='nonsense')) 926 930 self.assertEqual(len(errs),1) … … 935 939 self.csv_file, PAYMENT_HEADER_FIELDS,'create') 936 940 self.assertEqual(num_warns,0) 941 937 942 payment = self.processor.getEntry(dict(reg_number='1', 938 943 p_id='p2907979737440'), self.app) … … 942 947 self.assertEqual(cdate, "2010-11-26 18:59:33") 943 948 self.assertEqual(str(payment.creation_date.tzinfo),'UTC') 949 944 950 payment = self.processor.getEntry(dict(matric_number='100001', 945 951 p_id='p2907125937570'), self.app) … … 953 959 self.assertEqual(cdate, "2010-11-25 21:16:33") 954 960 self.assertEqual(str(payment.creation_date.tzinfo),'UTC') 961 962 payment = self.processor.getEntry(dict(reg_number='3', 963 p_id='ABC-11-1234567890'), self.app) 964 self.assertEqual(payment.amount_auth, 19500.6) 965 955 966 shutil.rmtree(os.path.dirname(fin_file)) 956 967 logcontent = open(self.logfile).read() … … 961 972 'p_category=schoolfee, amount_auth=19500.0, p_current=True, ' 962 973 'p_id=p1266236341955, r_code=00, r_amount_approved=19500.0, ' 974 'p_state=paid' 975 in logcontent) 976 self.assertTrue( 977 'INFO - system - K1000001 - Payment ticket updated: ' 978 'p_item=BTECHBDT, creation_date=2010-02-15 13:19:01+00:00, ' 979 'p_category=schoolfee, amount_auth=19500.6, p_current=True, ' 980 'p_id=ABC-11-1234567890, r_code=SC, r_amount_approved=19500.0, ' 963 981 'p_state=paid' 964 982 in logcontent)
Note: See TracChangeset for help on using the changeset viewer.