Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug #5941 - Myriad of problems with Paypal enrollmemts, au_enrol.patch

  • Loading branch information...
commit a395180a812b905dc3cbc31f7bf5836bc6a65f6b 1 parent ce72ff9
ethem authored
Showing with 25 additions and 21 deletions.
  1. +25 −21 enrol/authorize/enrol.php
View
46 enrol/authorize/enrol.php
@@ -51,8 +51,7 @@ class enrolment_plugin_authorize
* @var array
* @access public
*/
- var $ccerrors = array(); // for this plugin
- var $errormsg; // for manual plugin
+ var $ccerrors = array();
/**
* Cron log.
@@ -69,20 +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');
- if (!empty($this->errormsg)) { // move to manual to allow showing error message
- $manual->errormsg = $this->errormsg;
- }
- $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)) {
@@ -102,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 '<div align="center"><p>'.get_string('nocostyet', 'enrol_authorize').'</p>';
+ } else if (isguest()) {
+ $curcost = $this->get_course_cost($course);
+ echo '<div align="center"><p>'.get_string('paymentrequired').'</p>';
+ echo '<p><b>'.get_string('cost').": $curcost[currency] $curcost[cost]".'</b></p>';
+ echo '<p><a href="'.$CFG->httpswwwroot.'/login/">'.get_string('loginsite').'</a></p>';
+ echo '</div>';
+ } 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();
}
@@ -123,11 +127,11 @@ 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 (!empty($manual->errormsg)) { // to show error message in $this->print_entry()
- $this->errormsg = $manual->errormsg;
+ if (isset($manual->errormsg)) {
+ $this->errormsg = $manual->errormsg;
}
} elseif ((!empty($form->ccsubmit)) and $this->validate_enrol_form($form)) {
$this->cc_submit($form, $course);
Please sign in to comment.
Something went wrong with that request. Please try again.