Changeset 6940 for main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
- Timestamp:
- 25 Oct 2011, 08:52:28 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6937 r6940 48 48 from waeup.sirp.students.utils import getPaymentDetails 49 49 from waeup.sirp.browser.resources import toggleall 50 from waeup.sirp.authentication import get_principal_role_manager 50 51 51 52 # Save function used for save methods in manager pages … … 770 771 return 771 772 773 # We don't need the display form page yet 772 774 class PaymentsDisplayFormPage(WAeUPDisplayFormPage): 773 775 """ Page to display the student payments 774 776 """ 775 777 grok.context(IStudentPaymentsContainer) 776 grok.name(' index')778 grok.name('view') 777 779 grok.require('waeup.viewStudent') 778 780 form_fields = grok.AutoFields(IStudentPaymentsContainer) … … 796 798 return 797 799 800 # This manage form page is for both students and students officers. 798 801 class PaymentsManageFormPage(WAeUPEditFormPage): 799 802 """ Page to manage the student payments 800 803 """ 801 804 grok.context(IStudentPaymentsContainer) 802 grok.name(' manage')803 grok.require('waeup. manageStudents')805 grok.name('index') 806 grok.require('waeup.handleStudent') 804 807 form_fields = grok.AutoFields(IStudentPaymentsContainer) 805 808 grok.template('paymentsmanagepage') 806 809 title = 'Payments' 807 810 pnav = 4 811 812 def unremovable(self, ticket): 813 prm = get_principal_role_manager() 814 roles = [x[0] for x in prm.getRolesForPrincipal(self.request.principal.id)] 815 return ('waeup.Student' in roles and ticket.r_code) 808 816 809 817 def formatDatetime(self,datetimeobj): … … 829 837 else: 830 838 self.flash('No payment selected.') 831 self.redirect(self.url(self.context , '@@manage'))839 self.redirect(self.url(self.context)) 832 840 return 833 841 if not isinstance(child_id, list): … … 835 843 deleted = [] 836 844 for id in child_id: 837 try: 838 del self.context[id] 839 deleted.append(id) 840 except: 841 self.flash('Could not delete %s: %s: %s' % ( 842 id, sys.exc_info()[0], sys.exc_info()[1])) 845 # Students are not allowed to remove payment used tickets 846 if not self.unremovable(self.context[id]): 847 try: 848 del self.context[id] 849 deleted.append(id) 850 except: 851 self.flash('Could not delete %s: %s: %s' % ( 852 id, sys.exc_info()[0], sys.exc_info()[1])) 843 853 if len(deleted): 844 854 self.flash('Successfully removed: %s' % ', '.join(deleted)) 845 self.redirect(self.url(self.context , u'@@manage'))855 self.redirect(self.url(self.context)) 846 856 return 847 857 … … 850 860 self.redirect(self.url(self.context, '@@addop')) 851 861 852 class OnlinePaymentManageActionButton(ManageActionButton):853 grok.order(1)854 grok.context(IStudentPaymentsContainer)855 grok.view(PaymentsDisplayFormPage)856 grok.require('waeup.manageStudents')857 text = 'Manage payments'858 target = 'manage'862 #class OnlinePaymentManageActionButton(ManageActionButton): 863 # grok.order(1) 864 # grok.context(IStudentPaymentsContainer) 865 # grok.view(PaymentsDisplayFormPage) 866 # grok.require('waeup.manageStudents') 867 # text = 'Manage payments' 868 # target = 'manage' 859 869 860 870 class OnlinePaymentAddFormPage(WAeUPAddFormPage): … … 887 897 if error: 888 898 self.flash(error) 889 self.redirect(self.url(self.context , u'@@manage'))899 self.redirect(self.url(self.context)) 890 900 return 891 901 self.context[payment.p_id] = payment 892 902 self.flash('Payment ticket created.') 893 self.redirect(self.url(self.context , u'@@manage'))903 self.redirect(self.url(self.context)) 894 904 return 895 905 … … 935 945 pin, error = create_accesscode('CLR',0,student.student_id) 936 946 if error: 937 self.flash( error)947 self.flash('Valid callback received. ' + error) 938 948 return 939 949 self.context.ac = pin 940 return941 950 elif self.context.p_category == 'schoolfee': 942 951 # Create SFE access code 943 pin, error = create_accesscode('SFE',0 )952 pin, error = create_accesscode('SFE',0,student.student_id) 944 953 if error: 945 self.flash( error)954 self.flash('Valid callback received. ' + error) 946 955 return 947 956 self.context.ac = pin 948 return 957 self.flash('Valid callback received.') 958 return 949 959 950 960 def render(self): 951 self.redirect(self.url(self.context ))961 self.redirect(self.url(self.context, '@@index')) 952 962 return 953 963 … … 1335 1345 deleted = [] 1336 1346 for id in child_id: 1337 # Student are not allowed to remove core tickets1347 # Students are not allowed to remove core tickets 1338 1348 if not self.context[id].core_or_elective: 1339 1349 try:
Note: See TracChangeset for help on using the changeset viewer.