Ignore:
Timestamp:
27 Feb 2015, 21:56:34 (10 years ago)
Author:
Henrik Bettermann
Message:

Show validity period on contract pages and slips.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py

    r12633 r12634  
    5151from waeup.ikoba.mandates.mandate import PasswordMandate
    5252from waeup.ikoba.widgets.hrefwidget import HREFDisplayWidget
    53 from waeup.ikoba.utils.helpers import get_current_principal, to_timezone, now
     53from waeup.ikoba.utils.helpers import (
     54    get_current_principal, to_timezone, now, format_date)
    5455from waeup.ikoba.customers.interfaces import (
    5556    ICustomer, ICustomersContainer, ICustomerRequestPW, ICustomersUtils,
     
    15931594
    15941595    @property
     1596    def validity_period(self):
     1597        if self.context.valid_from or self.context.valid_to:
     1598            return "%s - %s" % (format_date(self.context.valid_from, self.request),
     1599                                format_date(self.context.valid_to, self.request))
     1600        return
     1601
     1602    @property
    15951603    def label(self):
    15961604        portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/contractpage.pt

    r12593 r12634  
    2626    </tr>
    2727    <tal:widgets content="structure provider:widgets" />
     28    <tr>
     29      <td i18n:translate="" class="fieldname">
     30        Validity Period:
     31      </td>
     32      <td>
     33        <span tal:content="python: layout.formatDate(context.valid_from)">
     34          VALIDFROM
     35        </span> -
     36        <span tal:content="python: layout.formatDate(context.valid_to)">
     37          VALIDTO
     38        </span>
     39      </td>
     40    </tr>
    2841  </tbody>
    2942</table>
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12593 r12634  
    14441444        self.contract.product_object = self.product
    14451445        self.contract.tc_dict = {'en': u'<strong>Hello world</strong>'}
     1446        self.contract.valid_from = date(2015, 12, 4)
     1447        self.contract.valid_to = 'anything'
    14461448        self.contract.title = u'Contract Title'
    14471449        self.browser.open(self.customer_path + '/contracts/CON1')
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/utils.py

    r12526 r12634  
    410410                data.extend(creator.fromStringList(customer.history.messages))
    411411
     412        # Insert validity period
     413        if getattr(view, 'validity_period', None):
     414            vp_translation = trans(_('Validity Period'), portal_language)
     415            data.append(Paragraph(vp_translation, HEADING_STYLE))
     416            vp = view.validity_period
     417            data.append(Paragraph(vp, NOTE_STYLE))
     418
    412419        # Insert content tables (optionally on second page)
    413         if hasattr(view, 'tabletitle'):
     420        if getattr(view, 'tabletitle', None):
    414421            for i in range(len(view.tabletitle)):
    415422                if tabledata[i] and tableheader[i]:
     
    422429
    423430        # Insert terms and conditions
    424         if hasattr(view, 'terms_and_conditions'):
     431        if getattr(view, 'terms_and_conditions', None):
    425432            tc_translation = trans(_('Terms and Conditions'), portal_language)
    426433            data.append(Paragraph(tc_translation, HEADING_STYLE))
Note: See TracChangeset for help on using the changeset viewer.