Ignore:
Timestamp:
25 Sep 2012, 16:48:40 (12 years ago)
Author:
Henrik Bettermann
Message:

Remove payment objects not only catalog entries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/WAeUPImport.py

    r8226 r9232  
    15431543   
    15441544   
    1545    
     1545
    15461546    def remove(self,mapping):
    15471547        order_id = mapping.get('order_id')
    1548         msg = ''
    1549         while True:
     1548        student_id = mapping.get('id')
     1549        msg = ''
     1550        while True:
     1551            if not student_id and order_id:
     1552                msg = 'student_id or order_id wrong'
     1553                break
     1554            students_folder = self.portal_url.getPortalObject().campus.students
     1555            payments_folder = getattr(getattr(students_folder,student_id),'payments',None)
     1556            payment_object_id = 'p' + order_id[6:]
     1557
     1558            if payments_folder is None:
     1559                msg = '%s: no payments folder' % student_id
     1560                break
     1561            if not getattr(payments_folder,payment_object_id,False):
     1562                msg = '%s: payment object with id %s does not exist' % (student_id,payment_object_id)
     1563                break
     1564
     1565            payments_folder.manage_delObjects((payment_object_id),)
     1566
    15501567            if self.payments_catalog.getRecordByKey(order_id) is None:
    15511568                msg =  "no payment record with order_id %(order_id)s" % vars()
Note: See TracChangeset for help on using the changeset viewer.