Ignore:
Timestamp:
11 Feb 2015, 14:26:10 (10 years ago)
Author:
Henrik Bettermann
Message:

Add 'T&C acceptance' confirmation box.

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

    r12580 r12593  
    13931393
    13941394    @property
     1395    def terms_and_conditions(self):
     1396        lang = self.request.cookies.get('ikoba.language')
     1397        html = self.context.tc_dict.get(lang,'')
     1398        if html =='':
     1399            portal_language = getUtility(IIkobaUtils).PORTAL_LANGUAGE
     1400            html = self.context.tc_dict.get(portal_language,'')
     1401        return html
     1402
     1403    @property
    13951404    def form_fields(self):
    13961405        return grok.AutoFields(self.context.form_fields_interface).omit(
     
    14161425    pnav = 4
    14171426    deletion_warning = _('Are you sure?')
     1427    terms_and_conditions = None
    14181428
    14191429    @property
     
    14491459    @action(_('Apply now (final submit)'), warning=WARNING_CON)
    14501460    def finalsubmit(self, **data):
     1461        if not self.request.form.get('confirm_tc', False):
     1462            self.flash(_('Please read the terms and conditions and '
     1463                     'confirm your acceptance of these by ticking '
     1464                     'the confirmation box.'), type="danger")
     1465            return
    14511466        msave(self, **data)
    14521467        IWorkflowInfo(self.context).fireTransition('submit')
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/contracteditpage.pt

    r12118 r12593  
    1111  <br />
    1212
     13  <tal:tc condition="python: view.terms_and_conditions and view.__name__ == 'edit'">
     14    <h4 i18n:domain="waeup.ikoba">
     15      <span i18n:translate="">Terms and Conditions</span>
     16    </h4>
     17    <tal:tc content="structure view/terms_and_conditions" />
     18    <br />
     19    <input id="confirm_tc" name="confirm_tc" type="checkbox" value="True"/>
     20    <span i18n:translate="">
     21        I confirm that I have read, understood and accepted the Terms & Conditions.
     22    </span>
     23   <br /><br />
     24  </tal:tc>
     25
    1326  <div tal:condition="view/availableActions">
    1427    <input tal:repeat="action view/actions"
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/contractpage.pt

    r12363 r12593  
    2929</table>
    3030
    31 <h4 i18n:domain="waeup.ikoba">
    32   <span i18n:translate="">Terms and Conditions</span>
    33 </h4>
    34 
    35 <tal:tc content="structure view/terms_and_conditions" />
     31<tal:tc condition="view/terms_and_conditions">
     32  <h4 i18n:domain="waeup.ikoba">
     33    <span i18n:translate="">Terms and Conditions</span>
     34  </h4>
     35  <tal:tc content="structure view/terms_and_conditions" />
     36</tal:tc>
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12585 r12593  
    14141414            '<a href="http://localhost/app/customers/K1000000/documents/DOC1">DOC1 -'
    14151415            in self.browser.contents)
    1416         # Customer can submit the form. The form is also saved.
     1416        # Customer can submit the form if confirmation box is ticket.
     1417        # The form is also saved.
    14171418        self.browser.getLink("Edit").click()
     1419        self.browser.getControl("Apply").click()
     1420        self.assertTrue('confirm your acceptance of these by ticking' in self.browser.contents)
     1421        self.assertEqual(contract.state, 'created')
     1422        self.browser.getControl(name="confirm_tc").value = True
    14181423        self.browser.getControl("Apply").click()
    14191424        self.assertEqual(contract.state, 'submitted')
Note: See TracChangeset for help on using the changeset viewer.