Ignore:
Timestamp:
10 Feb 2012, 20:26:34 (13 years ago)
Author:
Henrik Bettermann
Message:

We can use the hash symbol at the end of p_id in import files
to avoid annoying automatic number transformation
by Excel or Calc.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/batching.py

    r7623 r7626  
    561561        elif 'reg_number' in row.keys() and row['reg_number']:
    562562            reg_number = row['reg_number']
    563             #import pdb; pdb.set_trace()
    564563            cat = queryUtility(ICatalog, name='students_catalog')
    565564            results = list(
     
    586585        if payments is None:
    587586            return None
    588         if row['p_id'].startswith('p'):
    589             entry = payments.get(row['p_id'])
     587        # We can use the hash symbol at the end of p_id in import files
     588        # to avoid annoying automatic number transformation
     589        # by Excel or Calc
     590        p_id = row['p_id'].strip('#')
     591        if p_id.startswith('p'):
     592            entry = payments.get(p_id)
    590593        else:
    591594            # For data migration from old SRP
    592             entry = payments.get('p' + row['p_id'][6:])
     595            entry = payments.get('p' + p_id[6:])
    593596        return entry
    594597
    595598    def addEntry(self, obj, row, site):
    596599        parent = self.getParent(row, site)
    597         if not row['p_id'].startswith('p'):
     600        p_id = row['p_id'].strip('#')
     601        if not p_id.startswith('p'):
    598602            # For data migration from old SRP
    599             obj.p_id = 'p' + row['p_id'][6:]
     603            obj.p_id = 'p' + p_id[6:]
    600604            parent[obj.p_id] = obj
    601605        else:
    602             parent[row['p_id']] = obj
     606            parent[p_id] = obj
    603607        return
    604608
     
    610614            row, self.factory_name)
    611615        # We have to check p_id.
    612         if row['p_id'].startswith('p'):
    613             if not len(row['p_id']) == 14:
     616        p_id = row['p_id'].strip('#')
     617        if p_id.startswith('p'):
     618            if not len(p_id) == 14:
    614619                errs.append(('p_id','invalid length'))
    615620                return errs, inv_errs, conv_dict
    616621        else:
    617             if not len(row['p_id']) == 19:
     622            if not len(p_id) == 19:
    618623                errs.append(('p_id','invalid length'))
    619624                return errs, inv_errs, conv_dict
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/sample_payment_data.csv

    r7623 r7626  
    11p_state,p_category,r_pay_reference,r_desc,p_id,reg_number,session_id,r_amount_approved,p_item,amount_auth,r_card_num,r_code,creation_date,type,surcharge_1
    2 paid,schoolfee,GTB|WEB|FUT|26-11-2010|002295,Approved Successful,3816951290797973744,1,2010,19500,BTECHBDT,19500,0942,00,2010/11/26 19:59:33.744 GMT+1,online,0
     2paid,schoolfee,GTB|WEB|FUT|26-11-2010|002295,Approved Successful,3816951290797973744#,1,2010,19500,BTECHBDT,19500,0942,00,2010/11/26 19:59:33.744 GMT+1,online,0
    33unpaid,schoolfee,GTB|WEB|FUT|25-11-2010|,Transaction status unconfirmed,3816951290712593757,2,2010,0,BTECHBDT,19500,0942,Z0,2010/11/25 20:16:33.757 GMT+1,online,0
    44paid,schoolfee,UBA|WEB|FUT|15-02-2010|000517,Approved Successful,p1266236341955,3,2009,19500,BTECHBDT,19500,0615,00,2010/02/15 13:19:01.955 GMT+1,online,0
  • main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py

    r7624 r7626  
    361361            'Y': 'No previous verdict',
    362362            'X': 'New 300 level student',
    363             'Z': 'Successful student (provisional)'
     363            'Z': 'Successful student (provisional)',
    364364            'A1': 'First Class',
    365365            'A2': 'Second Class Upper',
Note: See TracChangeset for help on using the changeset viewer.