Ignore:
Timestamp:
2 Apr 2008, 07:16:08 (17 years ago)
Author:
Henrik Bettermann
Message:

WAeUPTool.py: fix traceback

Accommodation.py: enable import of reserved beds

release_bed.py: remove maintenance fee

reserve_accommodation.py: enable bed change for reserved beds. To be done: check for existing acco object before creating it in line 128

change_bed.py: enable bed change for reserved beds

Location:
WAeUP_SRP/base/skins/waeup_accommodation
Files:
1 added
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_accommodation/change_bed.py

    r3206 r3406  
    4343            psm = 'No bed allocated for %s' % (student_id)
    4444            logger.info(psm)
    45             break
    46         allocated_bed = res[0]
    47         if allocated_bed.bed_type == status:
    48             logger.info('Status %s of %s has not changed.' % (status,student_id))
    49             psm='Student status has not changed!'
    50             break
    51             #return redirect("%s/%s/%s/waeup_document_view?portal_status_message=%s" % (students.absolute_url(),student_id,info['acco_id'],psm))
    52         logger.info('Bed status %s of %s has changed to %s.' % (allocated_bed.bed_type,student_id,status))
    53         query = Eq('bed_type',status) & Eq('student',context.portal_accommodation.not_occupied)
    54         records = context.portal_accommodation.evalAdvancedQuery(query)
    55         if len(records) < 1:
    56             psm='Bed change for %s failed, no free bed in category %s.' % (student_id,status)
    57             logger.info(psm)
    58             break
    59         beds.modifyRecord(bed=allocated_bed.bed,student=beds.not_occupied)
    60         logger.info('Bed %s released' % (allocated_bed.bed))
     45            pass
     46            #break
     47        elif res[0].bed_type.endswith("reserved"):
     48             logger.info('found reserved bed %s' % res[0].bed)
     49             pass       
     50        else:   
     51            allocated_bed = res[0]
     52            if allocated_bed.bed_type == status:
     53                logger.info('Status %s of %s has not changed.' % (status,student_id))
     54                psm='Student status has not changed!'
     55                break
     56                #return redirect("%s/%s/%s/waeup_document_view?portal_status_message=%s" % (students.absolute_url(),student_id,info['acco_id'],psm))
     57            logger.info('Bed status %s of %s has changed to %s.' % (allocated_bed.bed_type,student_id,status))
     58            query = Eq('bed_type',status) & Eq('student',context.portal_accommodation.not_occupied)
     59            records = context.portal_accommodation.evalAdvancedQuery(query)
     60            if len(records) < 1:
     61                psm='Bed change for %s failed, no free bed in category %s.' % (student_id,status)
     62                logger.info(psm)
     63                break
     64            beds.modifyRecord(bed=allocated_bed.bed,student=beds.not_occupied)
     65            logger.info('Bed %s released' % (allocated_bed.bed))
    6166        code,bed = beds.searchAndReserveBed(student_id,status)
    62         if code > 0:
     67        if code > -2:
    6368            d = {}
    6469            d['bed'] = bed
     
    7277            psm='Bed changed!'
    7378            break
    74             #return redirect("%s/%s/%s/waeup_document_view?portal_status_message=%s" % (students.absolute_url(),student_id,info['acco_id'],psm))
    75         #acco_doc = info['acco_doc']
    76         #acco_doc.edit(mapping={'bed':"-- cancelled by officer due to failed bed change request --"})
    7779        logger.info('Bed change for %s failed, code = %s' % (student_id,code))
    78         #logger.info('%s cancelled booking of bed %s by %s' % (member,bed,student_id))
    7980        psm='Bed change failed!'
     81        break
    8082    return redirect("%s/%s/%s/waeup_document_view?portal_status_message=%s" % (students.absolute_url(),student_id,info['acco_id'],psm))
    8183
  • WAeUP_SRP/base/skins/waeup_accommodation/release_bed.py

    r3049 r3406  
    4444    acco_cat.modifyRecord(bed=allocated_bed.bed,student=acco_cat.not_occupied)
    4545    acco_doc = context.getContent()
    46     acco_doc.edit(mapping={'bed':"-- cancelled by section officer --"})
     46    acco_doc.edit(mapping={'bed':"-- cancelled by section officer --",'acco_maint_fee':""})
    4747    logger.info('%s released bed of %s' % (member_id,student_id))
    4848    return redirect("%s" % (context.absolute_url()))
Note: See TracChangeset for help on using the changeset viewer.