Changeset 12513


Ignore:
Timestamp:
24 Jan 2015, 09:27:40 (10 years ago)
Author:
Henrik Bettermann
Message:

Check if p_id exists in payments_catalog when importing payment tickets in create mode.

Location:
main/waeup.kofa/trunk
Files:
4 edited

Legend:

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

    r12469 r12513  
    55=======================
    66
    7 * No changes yet.
     7* Check if p_id exists in payments_catalog when importing payment tickets in
     8  create mode.
    89
    910
  • main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py

    r12180 r12513  
    793793                errs.append(('p_id','invalid format'))
    794794                return errs, inv_errs, conv_dict
     795        # Requirement added on 24/01/2015: p_id must be portal-wide unique.
     796        if mode == 'create':
     797            cat = getUtility(ICatalog, name='payments_catalog')
     798            results = list(cat.searchResults(p_id=(p_id, p_id)))
     799            if len(results) > 0:
     800                sids = [payment.student.student_id for payment in results]
     801                sids_string = ''
     802                for id in sids:
     803                    sids_string += '%s ' % id
     804                errs.append(('p_id','p_id exists in %s' % sids_string))
     805                return errs, inv_errs, conv_dict
    795806        return errs, inv_errs, conv_dict
    796807
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r12415 r12513  
    288288        # XXX: there is no addPayment method to give predictable names
    289289        self.payment = student['payments']['my-payment'] = payment
     290        notify(grok.ObjectModifiedEvent(self.payment))
    290291        return payment
    291292
     
    10651066            dict(p_id=p_id))
    10661067        self.assertEqual(len(errs),0)
     1068        dup_payment = createObject(u'waeup.StudentOnlinePayment')
     1069        dup_payment.p_id = 'XYZ-99-1234567890'
     1070        self.student['payments'][dup_payment.p_id] = dup_payment
     1071        errs, inv_errs, conv_dict = self.processor.checkConversion(
     1072            dict(p_id='XYZ-99-1234567890'), mode='create')
     1073        self.assertEqual(len(errs),1)
     1074        self.assertEqual(errs[0], ('p_id', u'p_id exists in K1000000 '))
    10671075
    10681076    def test_import(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py

    r12414 r12513  
    183183
    184184    def getEntry(self, row, site):
    185         """Get the parent object for the entry in ``row``.
     185        """Get the object for the entry in ``row``.
    186186        """
    187187        raise NotImplementedError('method not implemented')
Note: See TracChangeset for help on using the changeset viewer.