Changeset 2845
- Timestamp:
- 3 Dec 2007, 21:14:20 (17 years ago)
- Location:
- WAeUP_SRP
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/Accommodation.py
r2823 r2845 10 10 from Products.CPSDocument.CPSDocument import CPSDocument 11 11 from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder 12 from Products.WAeUP_SRP.WAeUPTables import AccommodationTable 12 from Products.WAeUP_SRP.WAeUPTables import AccommodationTable,NOT_OCCUPIED 13 13 import logging 14 14 import csv,re,os … … 18 18 p_home = Globals.package_home(globals()) 19 19 i_home = Globals.INSTANCE_HOME 20 20 21 21 22 class AccoFolder(CPSDocument): ###( … … 47 48 for hall in halls: 48 49 #import pdb;pdb.set_trace() 49 h = hall.getContent()50 hall_doc = hall.getContent() 50 51 hall_gen = {} 51 52 hall_gen['name'] = hall.Title 52 53 count = 0 53 reserved = [(r.split('/')[0],int(r.split('/')[1])) for r in re.split(',|\.| ',h .reserved_rooms)54 reserved = [(r.split('/')[0],int(r.split('/')[1])) for r in re.split(',|\.| ',hall_doc.reserved_rooms) 54 55 if r] 55 #for block in range(1,int(h .nr_of_blocks)+1):56 # for block in 'ABCDEFGHIJ'[:int(h .nr_of_blocks)]:57 if set(h .blocks_for_female).intersection(set(h.blocks_for_male)):56 #for block in range(1,int(hall_doc.nr_of_blocks)+1): 57 # for block in 'ABCDEFGHIJ'[:int(hall_doc.nr_of_blocks)]: 58 if set(hall_doc.blocks_for_female).intersection(set(hall_doc.blocks_for_male)): 58 59 return self.accommodation.acco_folder_view(beds_generated=beds_generated) 59 for block in h .blocks_for_female + h.blocks_for_male:60 for block in hall_doc.blocks_for_female + hall_doc.blocks_for_male: 60 61 sex = 'male' 61 if block in h .blocks_for_female:62 if block in hall_doc.blocks_for_female: 62 63 sex = 'female' 63 for floor in range(1,int(h .nr_of_floors)+1):64 for room in range(1,int(h .rooms_per_floor)+1):65 for bed in 'ABCDEFGH'[:int(h .beds_per_room)]:64 for floor in range(1,int(hall_doc.nr_of_floors)+1): 65 for room in range(1,int(hall_doc.rooms_per_floor)+1): 66 for bed in 'ABCDEFGH'[:int(hall_doc.beds_per_room)]: 66 67 room_nr = floor*100 + room 67 68 bt = 're' 68 69 if (block,room_nr) in reserved: 69 70 bt = "reserved" 70 elif h .special_handling and not h.special_handling.startswith("no"):71 bt = h .special_handling72 elif bed in h .beds_for_fresh:71 elif hall_doc.special_handling and not hall_doc.special_handling.startswith("no"): 72 bt = hall_doc.special_handling 73 elif bed in hall_doc.beds_for_fresh: 73 74 bt = 'fr' 74 elif bed in h .beds_for_pre:75 elif bed in hall_doc.beds_for_pre: 75 76 bt = 'pr' 76 elif bed in h .beds_for_final:77 elif bed in hall_doc.beds_for_final: 77 78 bt = 'fi' 78 if h .special_handling.startswith("no_"):79 bt += "_" + h .special_handling[3:]79 if hall_doc.special_handling.startswith("no_"): 80 bt += "_" + hall_doc.special_handling[3:] 80 81 bt = "%(sex)s_%(bt)s" % vars() 81 82 uid = '%s_%s_%d_%s' % (hall.getId(),block,room_nr,bed) 83 d = {} 84 d['bed'] = uid 85 d['bed_type'] = bt 86 d['sort_id'] = getattr(hall_doc,'sort_id') 87 d['hall'] = hall.getId() 88 d['student'] = NOT_OCCUPIED 82 89 try: 83 freelist.addRecord(bed = uid, bed_type = bt,hall = hall.getId()) 90 #freelist.addRecord(bed = uid, bed_type = bt,hall = hall.getId()) 91 freelist.addRecord(**d) 84 92 count +=1 85 93 generated.append('"%(uid)s","%(bt)s"' % vars()) 86 94 except ValueError: 87 95 #freelist.modifyRecord(bed = uid, bed_type = bt,hall =hall.getId()) 96 #freelist.modifyRecord(**d) 88 97 pass 89 98 hall_gen['count']= count … … 239 248 ###) 240 249 250 ###) 251 241 252 class AccoHall(CPSDocument): ###( 242 253 """ 243 WAeUP AccoHall containing Departments254 WAeUP AccoHall 244 255 """ 245 256 meta_type = 'AccoHall' -
WAeUP_SRP/base/WAeUPTables.py
r2781 r2845 41 41 ADDING_SHEDULED = "adding_sheduled" 42 42 OBJECT_CREATED = "object_created" 43 NOT_OCCUPIED = 'not_occupied' 43 44 44 45 from interfaces import IWAeUPTable … … 486 487 name = self.name 487 488 WAeUPTable.__init__(self, name) 488 489 489 490 def searchAndReserveBed(self, student_id,bed_type): 490 records = self.searchResults({'student' : student_id}) 491 #records = self.searchResults({'student' : student_id}) 492 import pdb;pdb.set_trace() 493 records = self.evalAdvancedQuery(Eq('student',student_id)) 491 494 if len(records) > 0: 492 495 return -1,"Student with Id %s already booked bed %s." % (student_id,records[0].bed) 493 496 494 records = [r for r in self.searchResults({'bed_type' : bed_type}) if not r.student] 495 #import pdb;pdb.set_trace() 497 #records = [r for r in self.searchResults({'bed_type' : bed_type}) if not r.student] 498 query = Eq('bed_type',bed_type) & Eq('student',NOT_OCCUPIED) 499 records = self.evalAdvancedQuery(query,sortSpecs=('sort_id','bed')) 496 500 if len(records) == 0: 497 501 return -2,"No bed available" -
WAeUP_SRP/base/skins/waeup_accommodation/acco_folder_view.pt
r2825 r2845 53 53 <strong tal:content="row/title" /></a> </td> 54 54 <td tal:content="row/id"> </td> 55 55 <td tal:content="row/sort_id"> </td> 56 56 <td> 57 <a tal:condition="row/is_editable"57 <a tal:condition="row/is_editable" 58 58 href="edit" tal:attributes="href string:/${row/url}/external_edit_form" 59 59 target="edit" -
WAeUP_SRP/base/skins/waeup_accommodation/getAccoFolderInfo.py
r1447 r2845 12 12 return Info about the Accommodation-Folder 13 13 """ 14 try: 15 from Products.zdb import set_trace 16 except: 17 def set_trace(): 18 pass 14 19 request = context.REQUEST 15 20 … … 23 28 items = [] 24 29 is_editable = mtool.checkPermission('Modify portal content', context) 25 is_editable = False 26 halls = context.portal_catalog(portal_type='AccoHall') 27 for f in halls: 30 #is_editable = False 31 #halls = context.portal_catalog(portal_type='AccoHall') 32 for id,hall in context.objectItems(): 33 hall_doc = hall.getContent() 28 34 row = {} 29 row['id'] = f.id 30 row['title'] = f.Title 31 row['url'] = "%s/%s" % (context.absolute_url(),f.id) 35 row['id'] = id 36 row['title'] = hall_doc.Title() 37 row['sort_id'] = getattr(hall_doc,'sort_id',0) 38 row['url'] = "%s/%s" % (context.absolute_url(),id) 32 39 #fo = f.getObject() 33 40 #row['is_editable'] = mtool.checkPermission('Modify portal content', fo) 34 41 row['is_editable'] = is_editable 35 42 items.append(row) 43 items.sort(cmp=lambda x,y: cmp( x['sort_id'],y['sort_id'])) 36 44 info['items'] = items 37 45 return info -
WAeUP_SRP/base/skins/waeup_accommodation/getAccoHallInfo.py
r1914 r2845 12 12 return Info about a Accommodation Hall 13 13 """ 14 try: 15 from Products.zdb import set_trace 16 except: 17 def set_trace(): 18 pass 19 20 from Products.AdvancedQuery import Eq, Between, Le,In 14 21 15 22 def cmp_bed(a,b): … … 23 30 path_info = request.get('PATH_INFO').split('/') 24 31 mtool = context.portal_membership 25 pa = context.portal_accommodation 32 portal_accommodation = context.portal_accommodation 33 aq_accommodation = portal_accommodation.evalAdvancedQuery 26 34 info = {} 27 35 #dep_id = request.get('PATH_TRANSLATED').split('/')[-2] … … 30 38 info['choosen_ids'] = request.get('ids',[]) 31 39 info['doc'] = context.getContent() 32 bed_types = p a.uniqueValuesFor('bed_type')40 bed_types = portal_accommodation.uniqueValuesFor('bed_type') 33 41 bt_list = [] 34 42 bt_names = context.getBedTypeNames() 35 res = p a.uniqueValuesFor('student')36 all_booked = [st for st in res if st ]43 res = portal_accommodation.uniqueValuesFor('student') 44 all_booked = [st for st in res if st and st != 'not_occupied'] 37 45 booked_list = [] 38 #from Products.zdb import set_trace;set_trace()39 46 for bt in bed_types: 40 total = len(p a(bed_type=bt,hall=context.getId()))47 total = len(portal_accommodation(bed_type=bt,hall=context.getId())) 41 48 if total <= 1: 42 49 continue 43 booked = p a.searchResults({'bed_type': bt,50 booked = portal_accommodation.searchResults({'bed_type': bt, 44 51 'student':all_booked, 45 52 'hall': context.getId()}) … … 49 56 }) 50 57 booked_list.extend(booked) 58 # query = ~Eq('student','not_occupied') 59 # beds = aq_accommodation(query,sortSpecs=('bed_type',)) 60 # bt_list = [] 61 # bt_names = context.getBedTypeNames() 62 # bt = 'xxx' 63 # for bed in beds: 64 # if bt != bed.bed_type: 65 # bt = bed.bed_type 66 # total = len(aq_accommodation(Eq('bed_type',bt))) 67 # bt_list.append({'name': bt_names[bt], 68 # 'total': total, 69 # 'reserved': len(booked), 70 # }) 71 51 72 info['bed_types'] = bt_list 52 73 res_list = [] -
WAeUP_SRP/fceokene/profiles/default/accommodation.xml
r1556 r2845 3 3 <object name="portal_accommodation" meta_type="WAeUP Table"> 4 4 <column value="bed"/> 5 <column value="sort_id"/> 5 6 <column value="bed_type"/> 6 7 <column value="hall"/> … … 12 13 <indexed_attr value="bed_type"/> 13 14 </index> 15 <index name="sort_id" meta_type="FieldIndex"> 16 <indexed_attr value="sort_id"/> 17 </index> 14 18 <index name="student" meta_type="FieldIndex"> 15 19 <indexed_attr value="student"/> -
WAeUP_SRP/fceokene/profiles/default/layouts/payment.xml
r2836 r2845 9 9 <property name="validate_values_expr"></property> 10 10 <widget name="amount" meta_type="String Widget"> 11 <property name="title"> FeeAuthorized</property>11 <property name="title">Amount Authorized</property> 12 12 <property name="fields"> 13 13 <element value="amount"/> 14 14 </property> 15 <property name="label"> FeeAuthorized</property>16 <property name="label_edit"> FeeAuthorized</property>15 <property name="label">Amount Authorized</property> 16 <property name="label_edit">Amount Authorized</property> 17 17 <property name="readonly_layout_modes"> 18 18 <element value="edit"/> … … 115 115 <property name="hidden_readonly_layout_modes"/> 116 116 </widget> 117 <widget name="status" meta_type="Select Widget"> 118 <property name="title">Payment status</property> 119 <property name="fields"> 120 <element value="status"/> 121 </property> 122 <property name="is_required">False</property> 123 <property name="label">Payment Status</property> 124 <property name="label_edit">Payment Status</property> 125 <property name="readonly_layout_modes"/> 126 <property name="hidden_layout_modes"/> 127 <property name="hidden_readonly_layout_modes"/> 128 <property name="vocabulary">payment_status</property> 129 </widget> 130 <widget name="subject" meta_type="Select Widget"> 131 <property name="title">Payment Subject</property> 132 <property name="fields"> 133 <element value="subject"/> 134 </property> 135 <property name="is_required">False</property> 136 <property name="label">Payment Subject</property> 137 <property name="label_edit">Payment Subject</property> 138 <property name="readonly_layout_modes"/> 139 <property name="hidden_layout_modes"/> 140 <property name="hidden_readonly_layout_modes"/> 141 <property name="vocabulary">payment_subjects</property> 142 </widget> 143 <widget name="target" meta_type="String Widget"> 144 <property name="title">Payment Target</property> 145 <property name="fields"> 146 <element value="target"/> 147 </property> 148 <property name="is_required">False</property> 149 <property name="label">Payment for</property> 150 <property name="label_edit">Payment for</property> 151 <property name="readonly_layout_modes"/> 152 <property name="hidden_layout_modes"/> 153 <property name="hidden_readonly_layout_modes"/> 154 </widget> 155 <widget name="type" meta_type="Select Widget"> 156 <property name="title">Payment Type</property> 157 <property name="fields"> 158 <element value="type"/> 159 </property> 160 <property name="is_required">False</property> 161 <property name="label">Payment Type</property> 162 <property name="label_edit">Payment Type</property> 163 <property name="readonly_layout_modes"/> 164 <property name="hidden_layout_modes"/> 165 <property name="hidden_readonly_layout_modes"/> 166 <property name="vocabulary">payment_types</property> 167 </widget> 168 <widget name="session_id" meta_type="Select Widget"> 169 <property name="title">Session</property> 170 <property name="fields"> 171 <element value="session_id"/> 172 </property> 173 <property name="is_required">False</property> 174 <property name="label">Session</property> 175 <property name="label_edit">Session</property> 176 <property name="readonly_layout_modes"/> 177 <property name="hidden_layout_modes"/> 178 <property name="hidden_readonly_layout_modes"/> 179 <property name="vocabulary">sessions</property> 180 </widget> 117 181 <widget name="type_description" meta_type="String Widget"> 118 182 <property name="title">Payment Description</property> … … 123 187 <property name="label_edit">Payment Description</property> 124 188 <property name="display_width">40</property> 125 <property name="size_max">40</property> 189 <property name="size_max">40</property> 126 190 <property name="readonly_layout_modes"/> 127 191 <property name="hidden_layout_modes"/> … … 136 200 </row> 137 201 <row> 202 <cell name="status"/> 203 </row> 204 <row> 205 <cell name="type"/> 206 </row> 207 <row> 208 <cell name="subject"/> 209 </row> 210 <row> 211 <cell name="target"/> 212 </row> 213 <row> 214 <cell name="session_id"/> 215 </row> 216 <row> 138 217 <cell name="date"/> 139 218 </row> -
WAeUP_SRP/fceokene/profiles/default/schemas/payment.xml
r1613 r2845 2 2 <?xml-stylesheet type="text/xsl" href="schema.xsl"?> 3 3 <object name="payment" meta_type="CPS Schema"> 4 <field name="key" meta_type="CPS String Field"/> 4 5 <field name="date" meta_type="CPS DateTime Field"/> 5 6 <field name="type_code" meta_type="CPS String Field"/> 6 7 <field name="type_description" meta_type="CPS String Field" > 7 <property name="is_searchabletext"> True</property>8 <property name="is_searchabletext">False</property> 8 9 </field> 9 10 <field name="amount" meta_type="CPS String Field"/> 11 <field name="description" meta_type="CPS String Field"/> 12 <field name="subject" meta_type="CPS String Field"/> 13 <field name="type" meta_type="CPS String Field"/> 14 <field name="target" meta_type="CPS String Field"/> 15 <field name="status" meta_type="CPS String Field"/> 10 16 <field name="resp_pay_reference" meta_type="CPS String Field"/> 11 17 <field name="resp_desc" meta_type="CPS String Field"> 12 <property name="is_searchabletext"> True</property>18 <property name="is_searchabletext">False</property> 13 19 </field> 14 20 <field name="order_id" meta_type="CPS String Field"/> 21 <field name="session_id" meta_type="CPS String Field"/> 15 22 <field name="resp_code" meta_type="CPS String Field"/> 16 23 <field name="resp_card_num" meta_type="CPS String Field"/> 24 <field name="resp_date" meta_type="CPS DateTime Field"/> 17 25 <field name="resp_approved_amount" meta_type="CPS String Field"/> 18 26 </object>
Note: See TracChangeset for help on using the changeset viewer.