From 7ef2f206ee3b092299a82030187591622ea9f0b9 Mon Sep 17 00:00:00 2001 From: justinhunt Date: Fri, 6 Aug 2021 07:27:19 +0000 Subject: [PATCH] fixed issue with dataset variables and returns --- CHANGES.txt | 4 ++++ filter.php | 4 ++-- version.php | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 1fca46b..7cb7b6c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,9 @@ Change List ========= +Version 1.4.13(Build 2021080600) + - fixed issue where numeric variables to dataset where forced as int + - fixed issue where in the case of only 1 returned entry in dataset it was not available in JS + Version 1.4.12 (Build 2021021700) - added filter/generico:managetemplates capability to make it easier to build roles with access to Generico as per https://github.com/justinhunt/moodle-filter_generico/issues/26 diff --git a/filter.php b/filter.php index 3d3372f..feb1206 100644 --- a/filter.php +++ b/filter.php @@ -414,7 +414,7 @@ function filter_generico_callback(array $link) { $query_vars = array(); for ($i = 0; $i < sizeof($vars); $i++) { if (is_numeric($vars[$i])) { - $query_vars[] = intval($vars[$i]); + $query_vars[] = 0 + $vars[$i]; } else { $query_vars[] = $vars[$i]; } @@ -426,7 +426,7 @@ function filter_generico_callback(array $link) { $filterprops['DATASET'] = $alldata; //replace the specified names with spec values, if its a one element array if (sizeof($filterprops['DATASET']) == 1) { - $thedata = get_object_vars(array_pop($alldata)); + $thedata = get_object_vars(reset($alldata)); foreach ($thedata as $name => $value) { $genericotemplate = str_replace('@@DATASET:' . $name . '@@', $value, $genericotemplate); $alternate_content = str_replace('@@DATASET:' . $name . '@@', $value, $alternate_content); diff --git a/version.php b/version.php index 665f3d0..08c280d 100644 --- a/version.php +++ b/version.php @@ -25,8 +25,8 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021021700; // The current plugin version (Date: YYYYMMDDXX) +$plugin->version = 2021080600; // The current plugin version (Date: YYYYMMDDXX) $plugin->requires = 2011070100; // Requires this Moodle version $plugin->component = 'filter_generico'; // Full name of the plugin (used for diagnostics) $plugin->maturity = MATURITY_STABLE; -$plugin->release = 'Version 1.4.12(Build 2021021700)'; +$plugin->release = 'Version 1.4.13(Build 2021080600)';