source: WAeUP_SRP/trunk_not_used/Payment.py @ 2310

Last change on this file since 2310 was 1247, checked in by Henrik Bettermann, 18 years ago

online payment beautified

  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1#-*- mode: python; mode: fold -*-
2from Globals import InitializeClass
3from AccessControl import ClassSecurityInfo
4
5from Products.CMFCore.utils import UniqueObject, getToolByName
6from Products.CMFCore.permissions import View
7from Products.CMFCore.permissions import ModifyPortalContent
8from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder
9#from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument
10from Products.CPSDocument.CPSDocument import CPSDocument
11from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder
12from Products.WAeUP_SRP.WAeUPTables import AccommodationTable
13import Globals
14import DateTime
15import re
16p_home = Globals.package_home(globals())
17i_home = Globals.INSTANCE_HOME
18
19class PaymentsFolder(CPSDocument): ###(
20    """
21    WAeUP PaymentsFolder containing Paymentsmmodation halls
22    """
23    meta_type = 'PaymentsFolder'
24    portal_type = meta_type
25    security = ClassSecurityInfo()
26
27    security.declareProtected(View,"Title")
28    def Title(self):
29        """compose title"""
30        return "Payments"
31
32InitializeClass(PaymentsFolder)
33
34def addPaymentsFolder(container, id, REQUEST=None, **kw):
35    """Add a PaymentsFolder."""
36    ob = PaymentsFolder(id, **kw)
37    return CPSBase_adder(container, ob, REQUEST=REQUEST)
38###)
39
40class Payment(CPSDocument): ###(
41    """
42    WAeUP Payment containing Departments
43    """
44    meta_type = 'Payment'
45    portal_type = meta_type
46    security = ClassSecurityInfo()
47
48    security.declareProtected(View,"Title") ###(
49    def Title(self):
50        """compose title"""
51        content = self.getContent()
52        description = getattr(content,'type_description','')
53        d = getattr(content,'date','')
54        #pay_date = "%s/%s/%s %s:%s:%s" %(d[:2],d[2:4],d[4:6],d[6:8],d[8:10],d[10:])
55        pay_date = d.strftime("%d/%m/%y %H:%M:%S")
56        amount = getattr(content,'amount','')
57        if not (description or pay_date or amount):
58            return self.getId()
59        return "%(description)s, Naira %(amount)s, %(pay_date)s" % vars()
60    ###)
61
62InitializeClass(Payment)
63
64def addPayment(container, id, REQUEST=None, **kw):
65    """Add a Payment."""
66    ob = Payment(id, **kw)
67    return CPSBase_adder(container, ob, REQUEST=REQUEST)
68###)
Note: See TracBrowser for help on using the repository browser.