| 1 | #-*- mode: python; mode: fold -*- |
|---|
| 2 | from Globals import InitializeClass |
|---|
| 3 | from AccessControl import ClassSecurityInfo |
|---|
| 4 | |
|---|
| 5 | from Products.CMFCore.utils import UniqueObject, getToolByName |
|---|
| 6 | from Products.CMFCore.permissions import View |
|---|
| 7 | from Products.CMFCore.permissions import ModifyPortalContent |
|---|
| 8 | from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder |
|---|
| 9 | #from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument |
|---|
| 10 | from Products.CPSDocument.CPSDocument import CPSDocument |
|---|
| 11 | from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder |
|---|
| 12 | from Products.WAeUP_SRP.WAeUPTables import AccommodationTable |
|---|
| 13 | import Globals |
|---|
| 14 | import DateTime |
|---|
| 15 | import re |
|---|
| 16 | p_home = Globals.package_home(globals()) |
|---|
| 17 | i_home = Globals.INSTANCE_HOME |
|---|
| 18 | |
|---|
| 19 | class 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 | |
|---|
| 32 | InitializeClass(PaymentsFolder) |
|---|
| 33 | |
|---|
| 34 | def 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 | |
|---|
| 40 | class 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 | |
|---|
| 62 | InitializeClass(Payment) |
|---|
| 63 | |
|---|
| 64 | def addPayment(container, id, REQUEST=None, **kw): |
|---|
| 65 | """Add a Payment.""" |
|---|
| 66 | ob = Payment(id, **kw) |
|---|
| 67 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
|---|
| 68 | ###) |
|---|