Ignore:
Timestamp:
7 Jun 2016, 20:08:05 (9 years ago)
Author:
Henrik Bettermann
Message:

Remove application fee fallback option. This option has never been used and is confusing.

Hide Payment Tickets section on application pages if fee isn't set.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r13429 r13886  
    557557
    558558    @property
     559    def display_payments(self):
     560        if self.context.special:
     561            return True
     562        return getattr(self.context.__parent__, 'application_fee', None)
     563
     564    @property
    559565    def form_fields(self):
    560566        if self.context.special:
     
    887893    display_actions = [[_('Save'), _('Finally Submit')],
    888894        [_('Add online payment ticket'),_('Remove selected tickets')]]
     895
     896    @property
     897    def display_payments(self):
     898        if self.context.special:
     899            return True
     900        return getattr(self.context.__parent__, 'application_fee', None)
    889901
    890902    @property
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicantdisplaypage.pt

    r11599 r13886  
    3838  </tbody>
    3939</table>
    40 <h3 i18n:domain="waeup.kofa" i18n:translate="">
    41     Payment Tickets
    42 </h3>
    43 <table i18n:domain="waeup.kofa" class="table table-condensed">
    44   <thead>
    45     <tr>
    46       <th i18n:translate="">Payment Id</th>
    47       <th i18n:translate="">Creation Date</th>
    48       <th i18n:translate="">Payment Date</th>
    49       <th i18n:translate="">Category</th>
    50       <th i18n:translate="">Item</th>
    51       <th i18n:translate="">State</th>
    52     </tr>
    53   </thead>
    54   <tbody>
    55     <tr tal:repeat="value context/values">
    56       <td> <a tal:attributes="href python:view.url(value)">
    57       <span tal:content="value/p_id">PID</span></a></td>
    58       <td tal:content="python: layout.formatDatetime(value.creation_date)">CREATION DATE</td>
    59       <td tal:content="python: layout.formatDatetime(value.payment_date)">PAYMENT DATE</td>
    60       <td tal:content ="value/category">CATEGORY</td>
    61       <td tal:content ="value/display_item">ITEM</td>
    62       <td tal:content ="value/p_state_title">STATE</td>
    63     </tr>
    64   </tbody>
    65 </table>
     40<tal:payments condition="view/display_payments">
     41  <h3 i18n:domain="waeup.kofa" i18n:translate="">
     42      Payment Tickets
     43  </h3>
     44  <table i18n:domain="waeup.kofa" class="table table-condensed">
     45    <thead>
     46      <tr>
     47        <th i18n:translate="">Payment Id</th>
     48        <th i18n:translate="">Creation Date</th>
     49        <th i18n:translate="">Payment Date</th>
     50        <th i18n:translate="">Category</th>
     51        <th i18n:translate="">Item</th>
     52        <th i18n:translate="">State</th>
     53      </tr>
     54    </thead>
     55    <tbody>
     56      <tr tal:repeat="value context/values">
     57        <td> <a tal:attributes="href python:view.url(value)">
     58        <span tal:content="value/p_id">PID</span></a></td>
     59        <td tal:content="python: layout.formatDatetime(value.creation_date)">CREATION DATE</td>
     60        <td tal:content="python: layout.formatDatetime(value.payment_date)">PAYMENT DATE</td>
     61        <td tal:content ="value/category">CATEGORY</td>
     62        <td tal:content ="value/display_item">ITEM</td>
     63        <td tal:content ="value/p_state_title">STATE</td>
     64      </tr>
     65    </tbody>
     66  </table>
     67</tal:payments>
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicanteditpage.pt

    r12886 r13886  
    8787  </div>
    8888
    89   <br /><br />
    90   <h3 i18n:translate="">
    91       Payment Tickets
    92   </h3>
     89  <tal:payments condition="view/display_payments">
     90    <br /><br />
     91    <h3 i18n:translate="">
     92        Payment Tickets
     93    </h3>
    9394
    94   <table i18n:domain="waeup.kofa" class="table table-condensed">
    95     <thead>
    96     <tr>
    97       <th>&nbsp;</th>
    98       <th i18n:translate="">Payment Id</th>
    99       <th i18n:translate="">Creation Date</th>
    100       <th i18n:translate="">Payment Date</th>
    101       <th i18n:translate="">Category</th>
    102       <th i18n:translate="">Item</th>
    103       <th i18n:translate="">State</th>
    104     </tr>
    105     </thead>
    106     <tbody>
    107       <tr tal:repeat="cl context/values">
    108          <td>
    109           <input type="checkbox"
    110                  name="val_id"
    111                  tal:attributes="value cl/__name__"
    112          tal:condition="python: not view.unremovable(cl)" />
    113         </td>
    114         <td> <a tal:attributes="href python:view.url(cl)">
    115         <span tal:content="cl/p_id">PID</span></a></td>
    116         <td tal:content="python: layout.formatDatetime(cl.creation_date)">CREATION DATE</td>
    117         <td tal:content="python: layout.formatDatetime(cl.payment_date)">PAYMENT DATE</td>
    118       <td tal:content ="cl/category">CATEGORY</td>
    119       <td tal:content ="cl/display_item">ITEM</td>
    120       <td tal:content ="cl/p_state_title">STATE</td>
     95    <table i18n:domain="waeup.kofa" class="table table-condensed">
     96      <thead>
     97      <tr>
     98        <th>&nbsp;</th>
     99        <th i18n:translate="">Payment Id</th>
     100        <th i18n:translate="">Creation Date</th>
     101        <th i18n:translate="">Payment Date</th>
     102        <th i18n:translate="">Category</th>
     103        <th i18n:translate="">Item</th>
     104        <th i18n:translate="">State</th>
    121105      </tr>
    122     </tbody>
    123   </table>
     106      </thead>
     107      <tbody>
     108        <tr tal:repeat="cl context/values">
     109           <td>
     110            <input type="checkbox"
     111                 name="val_id"
     112                 tal:attributes="value cl/__name__"
     113           tal:condition="python: not view.unremovable(cl)" />
     114          </td>
     115          <td> <a tal:attributes="href python:view.url(cl)">
     116          <span tal:content="cl/p_id">PID</span></a></td>
     117          <td tal:content="python: layout.formatDatetime(cl.creation_date)">CREATION DATE</td>
     118          <td tal:content="python: layout.formatDatetime(cl.payment_date)">PAYMENT DATE</td>
     119        <td tal:content ="cl/category">CATEGORY</td>
     120        <td tal:content ="cl/display_item">ITEM</td>
     121        <td tal:content ="cl/p_state_title">STATE</td>
     122        </tr>
     123      </tbody>
     124    </table>
    124125
    125   <div tal:condition="view/availableActions">
    126     <span tal:repeat="action view/actions"
    127           tal:omit-tag="">
    128       <input tal:condition="python:action.label in view.display_actions[1]"
    129              tal:replace="structure action/render"/>
    130     </span>
    131   </div>
    132   <br />
    133   <p i18n:translate="" tal:condition="context/special">
    134     <strong>Notice:</strong> If you need to pay for another service,
    135     select the corresponding special application category above,
    136     click 'Save' and then 'Add online payment ticket' again.
    137   </p>
     126    <div tal:condition="view/availableActions">
     127      <span tal:repeat="action view/actions"
     128            tal:omit-tag="">
     129        <input tal:condition="python:action.label in view.display_actions[1]"
     130               tal:replace="structure action/render"/>
     131      </span>
     132    </div>
     133    <br />
     134    <p i18n:translate="" tal:condition="context/special">
     135      <strong>Notice:</strong> If you need to pay for another service,
     136      select the corresponding special application category above,
     137      click 'Save' and then 'Add online payment ticket' again.
     138    </p>
     139  </tal:payments>
    138140</form>
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r13657 r13886  
    887887        self.login()
    888888        self.browser.open(self.edit_path)
    889         # Payment tickets can't be created before the form has been validated
    890         self.browser.getControl("Add online payment ticket").click()
    891         self.assertTrue('Required input is missing' in self.browser.contents)
    892889        self.fill_correct_values()
    893890        # We have to save the form otherwise the filled fields will be cleared
     
    895892        # requires a filled form but does not save it
    896893        self.browser.getControl("Save").click()
     894        # Payment section does not appear if application fee isn't set
     895        self.assertFalse('Payment Tickets' in self.browser.contents)
     896        self.assertFalse('Add online payment' in self.browser.contents)
     897        self.applicantscontainer.application_fee = 200.0
     898        self.browser.open(self.edit_path)
    897899        self.browser.getControl("Add online payment ticket").click()
    898900        # Session object missing
     
    902904        configuration = SessionConfiguration()
    903905        configuration.academic_session = session_1
    904         configuration.application_fee = 200.0
    905906        self.app['configuration'].addSessionConfiguration(configuration)
    906907        self.browser.open(self.edit_path)
     
    910911        self.assertMatches('...Activation Code...',
    911912                           self.browser.contents)
     913        self.assertTrue(
     914            '<span>200.0</span>' in self.browser.contents)
    912915        # Payment ticket can be removed if they haven't received a
    913916        # valid callback
     
    10081011        return
    10091012
    1010     def test_pay_container_application_fee(self):
    1011         self.login()
    1012         self.browser.open(self.edit_path)
    1013         self.fill_correct_values()
    1014         self.browser.getControl("Save").click()
    1015         configuration = SessionConfiguration()
    1016         configuration.academic_session = session_1
    1017         self.applicantscontainer.application_fee = 120.0
    1018         configuration.application_fee = 9999.9
    1019         self.app['configuration'].addSessionConfiguration(configuration)
    1020         self.browser.open(self.edit_path)
    1021         self.browser.getControl("Add online payment ticket").click()
    1022         self.assertMatches('...Payment ticket created...',
    1023                            self.browser.contents)
    1024         self.assertMatches('...Payment ticket created...',
    1025                            self.browser.contents)
    1026         self.assertFalse(
    1027             '<span>9999.9</span>' in self.browser.contents)
    1028         self.assertTrue(
    1029             '<span>120.0</span>' in self.browser.contents)
    1030         self.assertTrue(
    1031             '<span>Application Fee</span>' in self.browser.contents)
    1032         return
    1033 
    10341013    def prepare_special_container(self):
    10351014        # Add special application container
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/utils.py

    r13216 r13886  
    7373        payment.p_category = 'application'
    7474        container_fee = container.application_fee
    75         if container_fee:
    76             payment.amount_auth = container_fee
    77             return
    78         payment.amount_auth = session_config.application_fee
    79         if payment.amount_auth in (0.0, None):
     75        if not container_fee:
    8076            return _('Amount could not be determined.')
     77        payment.amount_auth = container_fee
    8178        return
    8279
Note: See TracChangeset for help on using the changeset viewer.