Backporting MDL-16715 to 18_STABLE (new transid codes). Credit goes to Ethem Elvice.

This commit is contained in:
stronk7
2008-09-27 17:35:39 +00:00
parent 02d0084a51
commit 97f4bb9fde
5 changed files with 46 additions and 6 deletions
+1 -1
View File
@@ -295,7 +295,7 @@ function authorize_action(&$order, &$message, &$extra, $action=AN_ACTION_NONE, $
$responsecode = intval($response[0]);
if ($responsecode == AN_APPROVED || $responsecode == AN_REVIEW)
{
$transid = intval($response[6]);
$transid = floatval($response[6]);
if ($test || $transid == 0) {
return $responsecode; // don't update original transaction in test mode.
}
+3 -3
View File
@@ -12,7 +12,7 @@
<FIELD NAME="ccname" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="refundinfo" NEXT="courseid"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="ccname" NEXT="userid"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="transid"/>
<FIELD NAME="transid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="status"/>
<FIELD NAME="transid" TYPE="int" LENGTH="20" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="userid" NEXT="status"/>
<FIELD NAME="status" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="transid" NEXT="timecreated"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="status" NEXT="settletime"/>
<FIELD NAME="settletime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="timecreated" NEXT="amount"/>
@@ -35,7 +35,7 @@
<FIELD NAME="orderid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="status"/>
<FIELD NAME="status" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="orderid" NEXT="amount"/>
<FIELD NAME="amount" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="status" NEXT="transid"/>
<FIELD NAME="transid" TYPE="int" LENGTH="10" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="amount" NEXT="settletime"/>
<FIELD NAME="transid" TYPE="int" LENGTH="20" NOTNULL="false" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="amount" NEXT="settletime"/>
<FIELD NAME="settletime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="transid"/>
</FIELDS>
<KEYS>
@@ -47,4 +47,4 @@
</INDEXES>
</TABLE>
</TABLES>
</XMLDB>
</XMLDB>
+40
View File
@@ -59,6 +59,46 @@ function xmldb_enrol_authorize_upgrade($oldversion=0) {
}
}
if ($result && $oldversion < 2006112902) {
/// enrol_authorize.transid
/// Define index transid (not unique) to be dropped form enrol_authorize
$table = new XMLDBTable('enrol_authorize');
$index = new XMLDBIndex('transid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
drop_index($table, $index);
/// Changing precision of field transid on table enrol_authorize to (20)
$table = new XMLDBTable('enrol_authorize');
$field = new XMLDBField('transid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'userid');
change_field_precision($table, $field);
/// Launch add index transid again
$table = new XMLDBTable('enrol_authorize');
$index = new XMLDBIndex('transid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
add_index($table, $index);
/// enrol_authorize_refunds.transid
/// Define index transid (not unique) to be dropped form enrol_authorize_refunds
$table = new XMLDBTable('enrol_authorize_refunds');
$index = new XMLDBIndex('transid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
drop_index($table, $index);
/// Changing precision of field transid on table enrol_authorize_refunds to (20)
$table = new XMLDBTable('enrol_authorize_refunds');
$field = new XMLDBField('transid');
$field->setAttributes(XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, null, null, null, null, '0', 'amount');
change_field_precision($table, $field);
/// Launch add index transid again
$table = new XMLDBTable('enrol_authorize_refunds');
$index = new XMLDBIndex('transid');
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('transid'));
add_index($table, $index);
}
return $result;
}
+1 -1
View File
@@ -561,7 +561,7 @@ function authorize_get_status_action($order)
$canmanage = has_capability('enrol/authorize:managepayments', get_context_instance(CONTEXT_COURSE, $order->courseid));
if (intval($order->transid) == 0) { // test transaction or new order
if (floatval($order->transid) == 0) { // test transaction or new order
if ($order->timecreated < $newordertime) {
if ($canmanage) {
$ret->actions = array(ORDER_DELETE);
+1 -1
View File
@@ -1,6 +1,6 @@
<?php // $Id$
$plugin->version = 2006112901;
$plugin->version = 2006112902;
$plugin->requires = 2006100401;
?>