Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fmido88 committed Feb 26, 2024
2 parents fb9c852 + 0486bb4 commit 49f83a3
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 4 deletions.
1 change: 1 addition & 0 deletions classes/output/wallet_balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public function export_for_template(renderer_base $output) {
$tempctx->transfer = !empty($transferenabled) ? $transfer : false;
$tempctx->referral = !empty($refenabled) ? $referral : false;
$tempctx->policy = !empty($policy) ? $policy : false;
$tempctx->walleturl = (new moodle_url('/enrol/wallet/wallet.php#linkbalance'))->out();
}
$tempctx->currentuser = $this->currentuser;
return $tempctx;
Expand Down
4 changes: 2 additions & 2 deletions db/install.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="enrol/wallet/db" VERSION="20240220" COMMENT="XMLDB file for Moodle enrol/wallet"
<XMLDB PATH="enrol/wallet/db" VERSION="20240226" COMMENT="XMLDB file for Moodle enrol/wallet"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
Expand Down Expand Up @@ -89,7 +89,7 @@
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="cond" TYPE="number" LENGTH="10" NOTNULL="true" SEQUENCE="false" DECIMALS="5"/>
<FIELD NAME="percent" TYPE="int" LENGTH="3" NOTNULL="true" SEQUENCE="false"/>
<FIELD NAME="percent" TYPE="number" LENGTH="3" NOTNULL="true" SEQUENCE="false" DECIMALS="2"/>
<FIELD NAME="category" TYPE="int" LENGTH="10" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="The id of the category at which the conditional discount applied, 0 mean main balance discount"/>
<FIELD NAME="timefrom" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="timeto" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
Expand Down
15 changes: 15 additions & 0 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,5 +348,20 @@ function xmldb_enrol_wallet_upgrade($oldversion) {
// Wallet savepoint reached.
upgrade_plugin_savepoint(true, 2024022500, 'enrol', 'wallet');
}

if ($oldversion < 2024022619) {

// Changing type of field percent on table enrol_wallet_cond_discount to number.
$table = new xmldb_table('enrol_wallet_cond_discount');
$field = new xmldb_field('percent', XMLDB_TYPE_NUMBER, '4, 2', null, XMLDB_NOTNULL, null, null, 'cond');

// Launch change of type for field percent.
$dbman->change_field_precision($table, $field);
$dbman->change_field_type($table, $field);

// Wallet savepoint reached.
upgrade_plugin_savepoint(true, 2024022619, 'enrol', 'wallet');
}

return true;
}
8 changes: 7 additions & 1 deletion templates/display.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@
<span class="hidden" data-uniqid="{{uniqid}}" data-identifier="uniqid"></span>
<div style="text-align: center; padding-bottom: 0px;">
{{# currentuser}}
<h3 class="wallet-heading" style="text-align: center;"> {{# str }} mywallet, enrol_wallet {{/ str }} </h3>
{{#walleturl}}
<a href="{{walleturl}}">
{{/walleturl}}
<h3 class="wallet-heading" style="text-align: center;"> {{# str }} mywallet, enrol_wallet {{/ str }} </h3>
{{#walleturl}}
</a>
{{/walleturl}}
{{/ currentuser}}
<div class="balance-card" style="text-align: center; direction: ltr;">
{{# currentuser}}{{# str }} youhavebalance, enrol_wallet {{/ str }}{{/ currentuser}}<br>
Expand Down
10 changes: 10 additions & 0 deletions templates/single-bundle.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
Example context (json):
{
formid: "123",
method: "post",
url: "https://example.com",
id: "456",
discount: "20",
after: "80",
before: "100",
currency: "EGP",
category: "sample",
description: "example discount"
}
}}

Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024022500;
$plugin->version = 2024022619;
$plugin->requires = 2020061500;
$plugin->component = 'enrol_wallet';
$plugin->release = '5.2.0';
Expand Down

0 comments on commit 49f83a3

Please sign in to comment.