Changeset 2845 for WAeUP_SRP/base/skins


Ignore:
Timestamp:
3 Dec 2007, 21:14:20 (17 years ago)
Author:
joachim
Message:

add sort_id, additional fields in payment

Location:
WAeUP_SRP/base/skins/waeup_accommodation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_accommodation/acco_folder_view.pt

    r2825 r2845  
    5353              <strong tal:content="row/title" /></a> </td>
    5454            <td tal:content="row/id"> </td>
    55            
     55            <td tal:content="row/sort_id"> </td>
    5656            <td>
    57             <a tal:condition="row/is_editable"
     57              <a tal:condition="row/is_editable"
    5858                href="edit" tal:attributes="href string:/${row/url}/external_edit_form"
    5959                target="edit"
  • WAeUP_SRP/base/skins/waeup_accommodation/getAccoFolderInfo.py

    r1447 r2845  
    1212return Info about the Accommodation-Folder
    1313"""
     14try:
     15    from Products.zdb import set_trace
     16except:
     17    def set_trace():
     18        pass
    1419request = context.REQUEST
    1520
     
    2328items = []
    2429is_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')
     32for id,hall in context.objectItems():
     33    hall_doc = hall.getContent()
    2834    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)
    3239    #fo = f.getObject()
    3340    #row['is_editable'] = mtool.checkPermission('Modify portal content', fo)
    3441    row['is_editable'] = is_editable
    3542    items.append(row)
     43items.sort(cmp=lambda x,y: cmp( x['sort_id'],y['sort_id']))
    3644info['items'] = items
    3745return info
  • WAeUP_SRP/base/skins/waeup_accommodation/getAccoHallInfo.py

    r1914 r2845  
    1212return Info about a Accommodation Hall
    1313"""
     14try:
     15    from Products.zdb import set_trace
     16except:
     17    def set_trace():
     18        pass
     19   
     20from Products.AdvancedQuery import Eq, Between, Le,In
    1421
    1522def cmp_bed(a,b):
     
    2330path_info = request.get('PATH_INFO').split('/')
    2431mtool = context.portal_membership
    25 pa = context.portal_accommodation
     32portal_accommodation = context.portal_accommodation
     33aq_accommodation = portal_accommodation.evalAdvancedQuery
    2634info = {}
    2735#dep_id = request.get('PATH_TRANSLATED').split('/')[-2]
     
    3038info['choosen_ids'] = request.get('ids',[])
    3139info['doc'] = context.getContent()
    32 bed_types = pa.uniqueValuesFor('bed_type')
     40bed_types = portal_accommodation.uniqueValuesFor('bed_type')
    3341bt_list = []
    3442bt_names =  context.getBedTypeNames()
    35 res = pa.uniqueValuesFor('student')
    36 all_booked = [st for st in res if st]
     43res = portal_accommodation.uniqueValuesFor('student')
     44all_booked = [st for st in res if st and st != 'not_occupied']
    3745booked_list = []
    38 #from Products.zdb import set_trace;set_trace()
    3946for bt in bed_types:
    40     total = len(pa(bed_type=bt,hall=context.getId()))
     47    total = len(portal_accommodation(bed_type=bt,hall=context.getId()))
    4148    if total <= 1:
    4249        continue
    43     booked = pa.searchResults({'bed_type': bt,
     50    booked = portal_accommodation.searchResults({'bed_type': bt,
    4451                                 'student':all_booked,
    4552                                 'hall': context.getId()})
     
    4956                    })
    5057    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     
    5172info['bed_types'] = bt_list
    5273res_list = []
Note: See TracChangeset for help on using the changeset viewer.