Changeset 3274 for WAeUP_SRP


Ignore:
Timestamp:
7 Mar 2008, 07:18:02 (17 years ago)
Author:
Henrik Bettermann
Message:

new title for payment objects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/Payment.py

    r2947 r3274  
    5757    security = ClassSecurityInfo()
    5858
    59     security.declareProtected(View,"Title") ###(
     59#    security.declareProtected(View,"Title")
     60#    def Title(self):
     61#        """compose title"""
     62#        content = self.getContent()
     63#        description = getattr(content,'type_description','')
     64#        d = getattr(content,'date','')
     65#        #pay_date = "%s/%s/%s %s:%s:%s" %(d[:2],d[2:4],d[4:6],d[6:8],d[8:10],d[10:])
     66#        pay_date = d.strftime("%d/%m/%y %H:%M:%S")
     67#        amount = getattr(content,'amount','')
     68#        if not (description or pay_date or amount):
     69#            return self.getId()
     70#        return "%(description)s, Naira %(amount)s, %(pay_date)s" % vars()
     71
     72    security.declareProtected(View,"Title")
    6073    def Title(self):
    6174        """compose title"""
    62         content = self.getContent()
    63         description = getattr(content,'type_description','')
    64         d = getattr(content,'date','')
    65         #pay_date = "%s/%s/%s %s:%s:%s" %(d[:2],d[2:4],d[4:6],d[6:8],d[8:10],d[10:])
    66         pay_date = d.strftime("%d/%m/%y %H:%M:%S")
    67         amount = getattr(content,'amount','')
    68         if not (description or pay_date or amount):
    69             return self.getId()
    70         return "%(description)s, Naira %(amount)s, %(pay_date)s" % vars()
    71     ###)
     75        payment = self.getContent()
     76        vocabularies = self.portal_vocabularies
     77       
     78        if payment.status == 'invalid':
     79            return "Invalid Payment, Naira %s, %s" % (payment.amount,
     80                                                      payment.date.strftime("%d/%m/%y %H:%M:%S"))             
     81       
     82        return "%s for Session %s, Naira %s, %s" % (vocabularies.payment_categories.get(payment.category),
     83                                                    vocabularies.sessions.get(payment.session_id),
     84                                                    payment.amount,
     85                                                    payment.date.strftime("%d/%m/%y %H:%M:%S"))       
     86
    7287
    7388    # update Payment is no longer necessary
     
    8196        ## should not be done online for all started objects (too many conflict errors)
    8297        if status and status != 'started' and not type_description.startswith('Transfer') and not force:
    83         #if status and not force: 
     98        #if status and not force:
    8499            return
    85100        wftool = self.portal_workflow
Note: See TracChangeset for help on using the changeset viewer.