From c1a254588226151864c760b244c8d433e555d985 Mon Sep 17 00:00:00 2001 From: ethem Date: Thu, 29 Jun 2006 09:49:36 +0000 Subject: [PATCH] Bug #5941 - Myriad of problems with Paypal enrollmemts, au_enrol.patch Merged from 16 stable. --- enrol/authorize/enrol.php | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/enrol/authorize/enrol.php b/enrol/authorize/enrol.php index 333d87abc5189..15ed30bcaba3c 100755 --- a/enrol/authorize/enrol.php +++ b/enrol/authorize/enrol.php @@ -68,17 +68,10 @@ class enrolment_plugin_authorize * @param object $course Course info * @access public */ - function print_entry($course) - { + function print_entry($course) { global $CFG, $USER, $form; - if ($this->zero_cost($course) or isguest()) { - $manual = enrolment_factory::factory('manual'); - $manual->print_entry($course); - return; // No money for guests ;) - } - - $this->prevent_double_paid($course); + httpsrequired(); if (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') { if (empty($CFG->loginhttps)) { @@ -98,15 +91,30 @@ function print_entry($course) print_course($course, '80%'); if ($course->password) { - print_simple_box(get_string('choosemethod', 'enrol_authorize'), 'center'); - $password = ''; - include($CFG->dirroot.'/enrol/manual/enrol.html'); + print_heading(get_string('choosemethod', 'enrol_authorize'), 'center'); } print_simple_box_start('center'); - include($CFG->dirroot.'/enrol/authorize/enrol.html'); + if ($this->zero_cost($course)){ + echo '

'.get_string('nocostyet', 'enrol_authorize').'

'; + } else if (isguest()) { + $curcost = $this->get_course_cost($course); + echo '

'.get_string('paymentrequired').'

'; + echo '

'.get_string('cost').": $curcost[currency] $curcost[cost]".'

'; + echo '

'.get_string('loginsite').'

'; + echo '
'; + } else { + $this->prevent_double_paid($course); + include($CFG->dirroot.'/enrol/authorize/enrol.html'); + } + print_simple_box_end(); + if ($course->password) { + $password = ''; + include($CFG->dirroot.'/enrol/manual/enrol.html'); + } + print_footer(); } @@ -119,9 +127,12 @@ function print_entry($course) * @access public */ function check_entry($form, $course) { - if ((!empty($form->password)) or isguest() or $this->zero_cost($course)) { + if (!empty($course->password) and !empty($form->password)) { $manual = enrolment_factory::factory('manual'); $manual->check_entry($form, $course); + if (isset($manual->errormsg)) { + $this->errormsg = $manual->errormsg; + } } elseif ((!empty($form->ccsubmit)) and $this->validate_enrol_form($form)) { $this->cc_submit($form, $course); }