Ignore:
Timestamp:
24 Feb 2013, 08:29:24 (12 years ago)
Author:
Henrik Bettermann
Message:

FCEOkene wants to hide the bed coordinates if maintenance fee is not yet paid. Thus we need additional property attributes which return the p_item (payment tickets) and the bed_coordinates attributes (bed tickets) by default and can be easily customized to hide this information in certain cases. bed_coordinates and p_item must be omitted on forms. The new display_ attributes are displayed instead.

All packages must now be adjusted.

The 'cost-benefit ratio' of these kinds of customizations is quite bad and we should think about declining such customization requests. However, I started customization and these are the changed made in the base package.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/accommodation.py

    r9424 r9984  
    7676            return None
    7777
     78    @property
     79    def display_coordinates(self):
     80        return self.bed_coordinates
     81
    7882    def writeLogMessage(self, view, message):
    7983        return self.__parent__.__parent__.writeLogMessage(view, message)
     
    8387            self.booking_session).title
    8488
    85 BedTicket = attrs_to_fields(BedTicket)
     89BedTicket = attrs_to_fields(BedTicket, omit=['display_coordinates'])
     90
    8691
    8792# Bed tickets must be importable. So we might need a factory.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r9969 r9984  
    15961596    grok.name('index')
    15971597    grok.require('waeup.viewStudent')
    1598     form_fields = grok.AutoFields(IStudentOnlinePayment)
     1598    form_fields = grok.AutoFields(IStudentOnlinePayment).omit('p_item')
    15991599    form_fields[
    16001600        'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     
    16501650    grok.name('payment_slip.pdf')
    16511651    grok.require('waeup.viewStudent')
    1652     form_fields = grok.AutoFields(IStudentOnlinePayment)
     1652    form_fields = grok.AutoFields(IStudentOnlinePayment).omit('p_item')
    16531653    form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    16541654    form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     
    18721872        self.context.writeLogMessage(self, 'booked: %s' % bed.bed_id)
    18731873        self.flash(_('Bed ticket created and bed booked: ${a}',
    1874             mapping = {'a':bedticket.bed_coordinates}))
     1874            mapping = {'a':bedticket.display_coordinates}))
    18751875        self.redirect(self.url(self.context))
    18761876        return
     
    18821882    grok.name('index')
    18831883    grok.require('waeup.handleAccommodation')
    1884     form_fields = grok.AutoFields(IBedTicket)
     1884    form_fields = grok.AutoFields(IBedTicket).omit('bed_coordinates')
    18851885    form_fields['booking_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    18861886    pnav = 4
     
    18971897    grok.name('bed_allocation_slip.pdf')
    18981898    grok.require('waeup.handleAccommodation')
    1899     form_fields = grok.AutoFields(IBedTicket)
     1899    form_fields = grok.AutoFields(IBedTicket).omit('bed_coordinates')
    19001900    form_fields['booking_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    19011901    prefix = 'form'
     
    19931993        self.context.writeLogMessage(self, 'relocated: %s' % new_bed.bed_id)
    19941994        self.flash(_('Student relocated: ${a}',
    1995             mapping = {'a':self.context.bed_coordinates}))
     1995            mapping = {'a':self.context.display_coordinates}))
    19961996        self.redirect(self.url(self.context))
    19971997        return
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/accommodationmanagepage.pt

    r7811 r9984  
    2222        <span tal:content="python: cl.getSessionString()">PID</span></a></td>
    2323        <td tal:content="python: layout.formatDatetime(cl.booking_date)">DATE</td>
    24         <td tal:content="cl/bed_coordinates">COORDINATES</td>
     24        <td tal:content="cl/display_coordinates">COORDINATES</td>
    2525        <td tal:content="cl/bed_type">TYPE</td>
    2626      </tr>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/paymentsmanagepage.pt

    r9721 r9984  
    2929        <td tal:content="python: layout.formatDatetime(cl.payment_date)">PAYMENT DATE</td>
    3030      <td nowrap tal:content ="cl/category">CATEGORY</td>
    31       <td tal:content ="cl/p_item">ITEM</td>
     31      <td tal:content ="cl/display_item">ITEM</td>
    3232      <td tal:content ="cl/amount_auth">AMOUNT</td>
    3333      <td tal:content ="cl/p_session">SESSION</td>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r9983 r9984  
    283283    fields = tuple(
    284284        sorted(iface_names(
    285             IStudentOnlinePayment, exclude_attribs=False))) + (
    286                 'student_id','student_state','current_session')
     285            IStudentOnlinePayment, exclude_attribs=False,
     286            omit=['display_item']))) + (
     287            'student_id','student_state','current_session')
    287288
    288289    #: The title under which this exporter will be displayed
     
    311312    fields = tuple(
    312313        sorted(iface_names(
    313             IBedTicket, exclude_attribs=False))) + (
    314                 'student_id', 'actual_bed_type')
     314            IBedTicket, exclude_attribs=False,
     315            omit=['display_coordinates']))) + (
     316            'student_id', 'actual_bed_type')
    315317
    316318    #: The title under which this exporter will be displayed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r9962 r9984  
    674674
    675675    bed_coordinates = schema.TextLine(
     676        title = u'',
     677        required = True,
     678        readonly = False,
     679        )
     680
     681    display_coordinates = schema.TextLine(
    676682        title = _(u'Allocated Bed'),
    677         required = True,
    678         readonly = False,
     683        required = False,
     684        readonly = True,
    679685        )
    680686
  • main/waeup.kofa/trunk/src/waeup/kofa/students/payments.py

    r9733 r9984  
    139139
    140140
    141 StudentOnlinePayment = attrs_to_fields(StudentOnlinePayment)
     141StudentOnlinePayment = attrs_to_fields(
     142    StudentOnlinePayment, omit=['display_item'])
    142143
    143144class PaymentWebservice(grok.Adapter):
Note: See TracChangeset for help on using the changeset viewer.