Changeset 16431 for main


Ignore:
Timestamp:
25 Mar 2021, 09:45:54 (4 years ago)
Author:
Henrik Bettermann
Message:

Add payment option (p_option) field to payment tickets and add
select box on online payment add form pages. Disable this feature
in the base package.

Location:
main/waeup.kofa/trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r16412 r16431  
    441.6.1.dev0 (unreleased)
    55=======================
     6
     7* Add payment option (`p_option`) field to payment tickets and add
     8  select box on online payment add form pages. Disable this feature
     9  in the base package.
    610
    711* Allow lecturers to export all course tickets, not only
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r16327 r16431  
    819819            self.redirect(self.url(self.context))
    820820            return
     821        if getattr(self.context, 'p_option', None):
     822            payment.p_option = self.context.p_option
    821823        self.context[payment.p_id] = payment
    822824        self.context.writeLogMessage(self, 'added: %s' % payment.p_id)
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/export.py

    r16069 r16431  
    162162        IApplicantOnlinePayment,
    163163        exclude_attribs=False,
    164         omit=['display_item']))) + (
     164        omit=['display_item', 'p_option']))) + (
    165165              'applicant_id',
    166166              'reg_number',
  • main/waeup.kofa/trunk/src/waeup/kofa/payments/interfaces.py

    r15792 r16431  
    3838    DICT_NAME = 'PAYMENT_CATEGORIES'
    3939
     40class PaymentOptionSource(ContextualDictSourceFactoryBase):
     41    """A payment option source delivers all options of a payment.
     42
     43    """
     44    #: name of dict to deliver from kofa utils.
     45    DICT_NAME = 'PAYMENT_OPTIONS'
     46
    4047class CombiPaymentCategorySource(ContextualDictSourceFactoryBase):
    4148    """A payment category source delivers all categories of payments.
     
    6168        source = PaymentCategorySource(),
    6269        required = True,
     70        )
     71
     72    p_option = schema.Choice(
     73        title = _(u'Payment Option'),
     74        source = PaymentOptionSource(),
     75        required = False,
    6376        )
    6477
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r16412 r16431  
    22412241        return sorted(categories.items(), key=lambda value: value[1])
    22422242
     2243    @property
     2244    def selectable_payment_options(self):
     2245        student = self.context.__parent__
     2246        options = getUtility(
     2247            IKofaUtils).selectable_payment_options(student)
     2248        return sorted(options.items(), key=lambda value: value[1])
     2249
    22432250    @action(_('Create ticket'), style='primary')
    22442251    def createTicket(self, **data):
    22452252        form = self.request.form
    22462253        p_category = form.get('form.p_category', None)
     2254        p_option = form.get('form.p_option', None)
    22472255        p_combi = form.get('form.p_combi', [])
    22482256        if isinstance(form.get('form.p_combi', None), unicode):
     
    22722280        if p_category == 'transfer':
    22732281            payment.p_item = form['new_programme']
     2282        if p_option:
     2283            payment.p_option = p_option
    22742284        self.context[payment.p_id] = payment
    22752285        self.flash(_('Payment ticket created.'))
     
    22872297    grok.context(IStudentPaymentsContainer)
    22882298    grok.name('addpp')
     2299    grok.template('previouspaymentaddform')
    22892300    grok.require('waeup.payStudent')
    22902301    form_fields = grok.AutoFields(IStudentPreviousPayment)
     
    22992310        return
    23002311
     2312    @property
     2313    def selectable_payment_options(self):
     2314        student = self.context.__parent__
     2315        options = getUtility(
     2316            IKofaUtils).selectable_payment_options(student)
     2317        return sorted(options.items(), key=lambda value: value[1])
     2318
    23012319    @action(_('Create ticket'), style='primary')
    23022320    def createTicket(self, **data):
    23032321        p_category = data['p_category']
     2322        p_option = data.get('p_option', None)
    23042323        previous_session = data.get('p_session', None)
    23052324        previous_level = data.get('p_level', None)
     
    23112330            self.flash(error, type="danger")
    23122331            return
     2332        if p_option:
     2333            payment.p_option = p_option
    23132334        self.context[payment.p_id] = payment
    23142335        self.flash(_('Payment ticket created.'))
     
    23272348    grok.context(IStudentPaymentsContainer)
    23282349    grok.name('addbp')
     2350    grok.template('previouspaymentaddform')
    23292351    grok.require('waeup.manageStudent')
    23302352    form_fields = grok.AutoFields(IStudentBalancePayment)
     
    23322354    pnav = 4
    23332355
     2356    @property
     2357    def selectable_payment_options(self):
     2358        student = self.context.__parent__
     2359        options = getUtility(
     2360            IKofaUtils).selectable_payment_options(student)
     2361        return sorted(options.items(), key=lambda value: value[1])
     2362
    23342363    @action(_('Create ticket'), style='primary')
    23352364    def createTicket(self, **data):
    23362365        p_category = data['p_category']
     2366        p_option = data.get('p_option', None)
    23372367        balance_session = data.get('balance_session', None)
    23382368        balance_level = data.get('balance_level', None)
     
    23462376            self.flash(error, type="danger")
    23472377            return
     2378        if p_option:
     2379            payment.p_option = p_option
    23482380        self.context[payment.p_id] = payment
    23492381        self.flash(_('Payment ticket created.'))
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/onlinepaymentaddform.pt

    r15664 r16431  
    1414                    tal:attributes="value python:item[0]">
    1515              <span tal:replace="python:item[1]">FEE CATEGORY</span>
     16            </option>
     17          </select>
     18        </td>
     19      </tr>
     20      <tr tal:condition="view/selectable_payment_options">
     21        <td class="fieldname">
     22          Payment Option:
     23        </td>
     24        <td>
     25          <select id="form.p_option" name="form.p_option" size="1"
     26                  class="form-control half" onclick="further()">
     27            <option tal:repeat="item view/selectable_payment_options"
     28                    tal:attributes="value python:item[0]">
     29              <span tal:replace="python:item[1]">PAYMENT OPTION</span>
    1630            </option>
    1731          </select>
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r16412 r16431  
    491491        sorted(iface_names(
    492492            IStudentOnlinePayment, exclude_attribs=False,
    493             omit=['display_item', 'certificate', 'student']))) + (
     493            omit=['display_item', 'certificate', 'student', 'p_option']))) + (
    494494            'student_id','state','current_session')
    495495    title = _(u'Student Payments (Data Backup)')
     
    520520        sorted(iface_names(
    521521            IStudentOnlinePayment, exclude_attribs=False,
    522             omit=['display_item', 'certificate', 'student', 'ac']))) + (
     522            omit=['display_item', 'certificate', 'student', 'ac', 'p_option']))) + (
    523523            'student_id','faccode', 'depcode', 'state','current_session')
    524524    title = _(u'Student Payments (Sorted Data)')
     
    640640        sorted(iface_names(
    641641            IStudentOnlinePayment, exclude_attribs=False,
    642             omit=['display_item', 'certificate', 'student']))) + (
     642            omit=['display_item', 'certificate', 'student', 'p_option']))) + (
    643643            'student_id','matric_number','reg_number',
    644644            'firstname', 'middlename', 'lastname','sex',
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r16299 r16431  
    188188        }
    189189
     190    #: If PAYMENT_OPTIONS is empty, payment option fields won't show up.
     191    PAYMENT_OPTIONS = {
     192        #'credit_card': 'Credit Card',
     193        #'debit_card': 'Debit Card',
     194        }
     195
    190196    def selectable_payment_categories(self, student):
    191197        return self.PAYMENT_CATEGORIES
     198
     199    def selectable_payment_options(self, student):
     200        return self.PAYMENT_OPTIONS
    192201
    193202    PREVIOUS_PAYMENT_CATEGORIES = deepcopy(PAYMENT_CATEGORIES)
Note: See TracChangeset for help on using the changeset viewer.