From 2483ba10eaf6ce5a2ad46fe40174486045daeb9d Mon Sep 17 00:00:00 2001 From: Mo Farouk <122031508+fmido88@users.noreply.github.com> Date: Sat, 9 Mar 2024 13:46:41 +0200 Subject: [PATCH 1/5] solve issue #24 --- settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.php b/settings.php index 3588c32c..1e08633f 100644 --- a/settings.php +++ b/settings.php @@ -286,7 +286,7 @@ $settings->add(new admin_setting_configselect('enrol_wallet/discount_field', get_string('profile_field_map', 'enrol_wallet'), get_string('profile_field_map_help', 'enrol_wallet'), - null, + 0, $menu)); // Adding options to enable and disable coupons. From 41db63d945a8f43cacbd06bde53c079487e764db Mon Sep 17 00:00:00 2001 From: Mo Farouk <122031508+fmido88@users.noreply.github.com> Date: Sat, 9 Mar 2024 13:48:33 +0200 Subject: [PATCH 2/5] Fix clean_param array parameters --- classes/form/transactions_filter.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/classes/form/transactions_filter.php b/classes/form/transactions_filter.php index fbb59b98..d3a5dfbb 100644 --- a/classes/form/transactions_filter.php +++ b/classes/form/transactions_filter.php @@ -102,7 +102,13 @@ public function definition() { ]; foreach ($_GET as $key => $value) { if ($mform->elementExists($key) && isset($types[$key])) { - $mform->setDefault($key, clean_param($value, $types[$key])); + if (is_array($value)) { + $array = clean_param_array($value, $types[$key]); + $time = make_timestamp($array['year'], $array['month'], $array['day'] ?? 1, $array['hour'] ?? 0, $array['minute'] ?? 0); + $mform->setDefault($key, $time); + } else { + $mform->setDefault($key, clean_param($value, $types[$key])); + } } } } From 42bd97fc5f8948a1d152db08082c0c110c8e4b2e Mon Sep 17 00:00:00 2001 From: Mo Farouk <122031508+fmido88@users.noreply.github.com> Date: Sat, 9 Mar 2024 14:37:41 +0200 Subject: [PATCH 3/5] test classes declared as final --- tests/coupons_test.php | 2 +- tests/enrol_wallet_test.php | 2 +- tests/externallib_test.php | 2 +- tests/locallib_test.php | 2 +- tests/notifications_test.php | 2 +- tests/observer_test.php | 2 +- tests/payment/service_provider_test.php | 2 +- tests/transactions_test.php | 4 +--- tests/turn_non_refundable_test.php | 2 +- tests/util/balance_op_test.php | 2 +- tests/util/instance_test.php | 2 +- 11 files changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/coupons_test.php b/tests/coupons_test.php index cba96b17..14942ea8 100644 --- a/tests/coupons_test.php +++ b/tests/coupons_test.php @@ -31,7 +31,7 @@ * @copyright 2024 2024, Mohammad Farouk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class coupons_test extends \advanced_testcase { +final class coupons_test extends \advanced_testcase { /** * Categories. diff --git a/tests/enrol_wallet_test.php b/tests/enrol_wallet_test.php index efc2b15e..9e03e867 100644 --- a/tests/enrol_wallet_test.php +++ b/tests/enrol_wallet_test.php @@ -39,7 +39,7 @@ * @copyright 2023 Mo Farouk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class enrol_wallet_test extends \advanced_testcase { +final class enrol_wallet_test extends \advanced_testcase { /** * Basic test for enrol wallet plugin * @covers \enrol_wallet_plugin diff --git a/tests/externallib_test.php b/tests/externallib_test.php index b46add4e..d8ec771a 100644 --- a/tests/externallib_test.php +++ b/tests/externallib_test.php @@ -32,7 +32,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @runTestsInSeparateProcesses */ -class externallib_test extends externallib_advanced_testcase { +final class externallib_test extends externallib_advanced_testcase { /** * Test get_instance_info diff --git a/tests/locallib_test.php b/tests/locallib_test.php index 924846ac..49391352 100644 --- a/tests/locallib_test.php +++ b/tests/locallib_test.php @@ -37,7 +37,7 @@ * @copyright 2023 Mo Farouk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class locallib_test extends \advanced_testcase { +final class locallib_test extends \advanced_testcase { /** * test_enrol_wallet_is_borrow_eligible diff --git a/tests/notifications_test.php b/tests/notifications_test.php index 235fc8ed..ed1e9e1c 100644 --- a/tests/notifications_test.php +++ b/tests/notifications_test.php @@ -32,7 +32,7 @@ * @copyright 2023 Mo Farouk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class notifications_test extends \advanced_testcase { +final class notifications_test extends \advanced_testcase { /** * Test transaction_notifications * @covers ::transaction_notify() diff --git a/tests/observer_test.php b/tests/observer_test.php index ce625a1b..23e4c483 100644 --- a/tests/observer_test.php +++ b/tests/observer_test.php @@ -38,7 +38,7 @@ * @copyright 2023 Mo Farouk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class observer_test extends \advanced_testcase { +final class observer_test extends \advanced_testcase { /** * Test event observer completion awards. * @covers ::wallet_completion_awards diff --git a/tests/payment/service_provider_test.php b/tests/payment/service_provider_test.php index 744a5657..33380902 100644 --- a/tests/payment/service_provider_test.php +++ b/tests/payment/service_provider_test.php @@ -30,7 +30,7 @@ * Unit tests for the enrol_wallet's payment subsystem callback implementation. * */ -class service_provider_test extends \advanced_testcase { +final class service_provider_test extends \advanced_testcase { /** * Test for service_provider::get_payable(). diff --git a/tests/transactions_test.php b/tests/transactions_test.php index c8708e53..4899b8c3 100644 --- a/tests/transactions_test.php +++ b/tests/transactions_test.php @@ -23,8 +23,6 @@ */ namespace enrol_wallet; -use enrol_wallet\transactions; - defined('MOODLE_INTERNAL') || die(); global $CFG; require_once($CFG->dirroot.'/enrol/wallet/lib.php'); @@ -36,7 +34,7 @@ * @copyright 2023 Mo Farouk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class transactions_test extends \advanced_testcase { +final class transactions_test extends \advanced_testcase { /** * The transactions class. diff --git a/tests/turn_non_refundable_test.php b/tests/turn_non_refundable_test.php index cdd78d5c..9721ad3d 100644 --- a/tests/turn_non_refundable_test.php +++ b/tests/turn_non_refundable_test.php @@ -34,7 +34,7 @@ * @copyright 2023 Mo Farouk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class turn_non_refundable_test extends \advanced_testcase { +final class turn_non_refundable_test extends \advanced_testcase { /** * Test adhoc task turn_non_refundable. * @covers \turn_non_refundable diff --git a/tests/util/balance_op_test.php b/tests/util/balance_op_test.php index 4cc41ec1..c2a9c288 100644 --- a/tests/util/balance_op_test.php +++ b/tests/util/balance_op_test.php @@ -36,7 +36,7 @@ * @copyright 2024 Mohammad Farouk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class balance_op_test extends \advanced_testcase { +final class balance_op_test extends \advanced_testcase { /** * Test conditional discounts. * @covers ::conditional_discount_charging() diff --git a/tests/util/instance_test.php b/tests/util/instance_test.php index 60ab06c2..52929983 100644 --- a/tests/util/instance_test.php +++ b/tests/util/instance_test.php @@ -31,7 +31,7 @@ * @copyright 2024 2024, Mohammad Farouk * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class instance_test extends \advanced_testcase { +final class instance_test extends \advanced_testcase { /** * Testing get cost after discount. * From e3eaaff21ce0daaba23fb476591828942aaceb58 Mon Sep 17 00:00:00 2001 From: Mo Farouk <122031508+fmido88@users.noreply.github.com> Date: Sat, 9 Mar 2024 14:58:48 +0200 Subject: [PATCH 4/5] cs fix --- classes/form/transactions_filter.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/form/transactions_filter.php b/classes/form/transactions_filter.php index d3a5dfbb..3ff5d7e1 100644 --- a/classes/form/transactions_filter.php +++ b/classes/form/transactions_filter.php @@ -104,7 +104,11 @@ public function definition() { if ($mform->elementExists($key) && isset($types[$key])) { if (is_array($value)) { $array = clean_param_array($value, $types[$key]); - $time = make_timestamp($array['year'], $array['month'], $array['day'] ?? 1, $array['hour'] ?? 0, $array['minute'] ?? 0); + $time = make_timestamp($array['year'], + $array['month'], + $array['day'] ?? 1, + $array['hour'] ?? 0, + $array['minute'] ?? 0); $mform->setDefault($key, $time); } else { $mform->setDefault($key, clean_param($value, $types[$key])); From 2b0368b4af4d768cf63317a5f2cf3b8e9e25153b Mon Sep 17 00:00:00 2001 From: Mo Farouk <122031508+fmido88@users.noreply.github.com> Date: Sat, 9 Mar 2024 16:04:02 +0200 Subject: [PATCH 5/5] update version --- CHANGELOG.md | 8 +++++++- lib.php | 2 +- version.php | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7905ebe..22863c33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ # Wallet Enrollment for Moodle # ========== +## V 5.3.2 ## +- Adding main page for wallet (when the user click my wallet). +- Add bundles for quick top up with conditional discounts +- Fix conditional discount precision. +- Bug fixes. + ## V 5.2.0 ## - Add a page to display offers. -- Display conditional discouts available to users in the top up form. +- Display conditional discounts available to users in the top up form. - Bug fixes. ## V 5.1.0 ## diff --git a/lib.php b/lib.php index 9636bf2e..26d2925f 100644 --- a/lib.php +++ b/lib.php @@ -26,7 +26,7 @@ // Disable all callbacks during upgrade. $version = get_config('enrol_wallet', 'version'); -if ($version >= 2024021018) { +if ($version >= 2024030900) { global $CFG; require_once("$CFG->dirroot/enrol/wallet/extendlib.php"); } diff --git a/version.php b/version.php index e95e0527..cf3d7080 100644 --- a/version.php +++ b/version.php @@ -24,10 +24,10 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024022619; +$plugin->version = 2024030900; $plugin->requires = 2020061500; $plugin->component = 'enrol_wallet'; -$plugin->release = '5.2.0'; +$plugin->release = '5.3.2'; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ 'enrol_manual' => ANY_VERSION,