Permalink
Browse files

MDL-22788 upgrade enrol/paypal plugin to use enrolments

Patch by Eugene Venter
  • Loading branch information...
1 parent 74feb96 commit 24df3e1a064056d50115de6cd6161585ec7313bd Aaron Barnes committed Jul 19, 2010
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="enrol/paypal/db" VERSION="20060807" COMMENT="XMLDB file for Moodle enrol/paypal">
+<XMLDB PATH="enrol/paypal/db" VERSION="20100716" COMMENT="XMLDB file for Moodle enrol/paypal"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
+>
<TABLES>
<TABLE NAME="enrol_paypal" COMMENT="Holds all known information about PayPal transactions">
<FIELDS>
@@ -9,8 +12,9 @@
<FIELD NAME="receiver_id" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="receiver_email" NEXT="item_name"/>
<FIELD NAME="item_name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="receiver_id" NEXT="courseid"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="item_name" NEXT="userid"/>
- <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="courseid" NEXT="memo"/>
- <FIELD NAME="memo" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="userid" NEXT="tax"/>
+ <FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="courseid" NEXT="instanceid"/>
+ <FIELD NAME="instanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="userid" NEXT="memo"/>
+ <FIELD NAME="memo" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="instanceid" NEXT="tax"/>
<FIELD NAME="tax" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="memo" NEXT="option_name1"/>
<FIELD NAME="option_name1" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="tax" NEXT="option_selection1_x"/>
<FIELD NAME="option_selection1_x" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="option_name1" NEXT="option_name2"/>
@@ -25,8 +29,8 @@
<FIELD NAME="timeupdated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="payment_type"/>
</FIELDS>
<KEYS>
- <KEY NAME="primary" TYPE="primary" FIELDS="id" />
+ <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
-</XMLDB>
+</XMLDB>
View
@@ -1,7 +1,7 @@
<div align="center">
<p><?php print_string("paymentrequired") ?></p>
-<p><b><?php echo get_string("cost").": $CFG->enrol_currency $cost"; ?></b></p>
+<p><b><?php echo get_string("cost").": {$instance->currency} {$cost}"; ?></b></p>
<p><img alt="<?php print_string('paypalaccepted', 'enrol_paypal') ?>" src="https://www.paypal.com/en_US/i/logo/PayPal_mark_60x38.gif" /></p>
<p><?php print_string("paymentinstant") ?></p>
<?php
@@ -11,15 +11,15 @@
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="charset" value="utf-8" />
-<input type="hidden" name="business" value="<?php p($CFG->enrol_paypalbusiness)?>" />
+<input type="hidden" name="business" value="<?php p($this->get_config('paypalbusiness'))?>" />
<input type="hidden" name="item_name" value="<?php p($coursefullname) ?>" />
<input type="hidden" name="item_number" value="<?php p($courseshortname) ?>" />
<input type="hidden" name="quantity" value="1" />
<input type="hidden" name="on0" value="<?php print_string("user") ?>" />
<input type="hidden" name="os0" value="<?php p($userfullname) ?>" />
-<input type="hidden" name="custom" value="<?php echo "$USER->id-$course->id" ?>" />
+<input type="hidden" name="custom" value="<?php echo "{$USER->id}-{$course->id}-{$instance->id}" ?>" />
-<input type="hidden" name="currency_code" value="<?php p($CFG->enrol_currency) ?>" />
+<input type="hidden" name="currency_code" value="<?php p($instance->currency) ?>" />
<input type="hidden" name="amount" value="<?php p($cost) ?>" />
<input type="hidden" name="for_auction" value="false" />
Oops, something went wrong.

0 comments on commit 24df3e1

Please sign in to comment.