Changeset 9467 for main


Ignore:
Timestamp:
30 Oct 2012, 17:31:43 (12 years ago)
Author:
Henrik Bettermann
Message:

We need to import old scratch card payments.

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  
    679679        # by Excel or Calc
    680680        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'):
    682682            # For data migration from old SRP only
    683683            p_id = 'p' + p_id[7:] + '0'
     
    699699        parent = self.getParent(row, site)
    700700        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'):
    702702            # For data migration from old SRP
    703703            obj.p_id = 'p' + p_id[7:] + '0'
     
    736736                errs.append(('p_id','invalid length'))
    737737                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
    738743        else:
     744            # ... or order_ids.
    739745            if not len(p_id) == 19:
    740746                errs.append(('p_id','invalid length'))
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r9457 r9467  
    2727from zope.catalog.interfaces import ICatalog
    2828from zope.component import queryUtility, getUtility, createObject
    29 from zope.schema.interfaces import ConstraintNotSatisfied
     29from zope.schema.interfaces import ConstraintNotSatisfied, RequiredMissing
    3030from zope.formlib.textwidgets import BytesDisplayWidget
    3131from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
     
    21082108        except KeyError:
    21092109            self.flash(_('This level exists.'))
     2110        except RequiredMissing:
     2111            self.flash(_('Your data are incomplete'))
    21102112        self.redirect(self.url(self.context))
    21112113        return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_payment_data.csv

    r9466 r9467  
    33100001,unpaid,schoolfee,3816951290712593757,,2010,0,BTECHBDT,19500.1,0942,Z0,2010-11-25 20:16:33.757 WAT,online,0
    44,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  
    909909        payment1.p_id = 'nonsense'
    910910        # payment1.p_id will be replaced if p_id doesn't start with 'p'
     911        # and is not an old PIN
    911912        self.processor.addEntry(
    912913            payment2, dict(student_id=self.student.student_id, p_id='XXXXXX456'),
     
    923924        self.assertEqual(len(errs),0)
    924925        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(
    925929            dict(p_id='nonsense'))
    926930        self.assertEqual(len(errs),1)
     
    935939            self.csv_file, PAYMENT_HEADER_FIELDS,'create')
    936940        self.assertEqual(num_warns,0)
     941
    937942        payment = self.processor.getEntry(dict(reg_number='1',
    938943            p_id='p2907979737440'), self.app)
     
    942947        self.assertEqual(cdate, "2010-11-26 18:59:33")
    943948        self.assertEqual(str(payment.creation_date.tzinfo),'UTC')
     949
    944950        payment = self.processor.getEntry(dict(matric_number='100001',
    945951            p_id='p2907125937570'), self.app)
     
    953959        self.assertEqual(cdate, "2010-11-25 21:16:33")
    954960        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
    955966        shutil.rmtree(os.path.dirname(fin_file))
    956967        logcontent = open(self.logfile).read()
     
    961972            'p_category=schoolfee, amount_auth=19500.0, p_current=True, '
    962973            '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, '
    963981            'p_state=paid'
    964982            in logcontent)
Note: See TracChangeset for help on using the changeset viewer.