From 6a46295378285dce27818a36d3794b9f2beba627 Mon Sep 17 00:00:00 2001 From: Justus Dieckmann <justusdieckmann@wwu.de> Date: Mon, 13 Apr 2020 19:45:55 +0200 Subject: [PATCH] Interpret 1 as semesterindependent instead of 0, because 0 counts as no value --- classes/data_controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/data_controller.php b/classes/data_controller.php index 1e293a7..f2842c6 100644 --- a/classes/data_controller.php +++ b/classes/data_controller.php @@ -68,7 +68,7 @@ class data_controller extends \core_customfield\data_controller { public function instance_form_definition(\MoodleQuickForm $mform) { $field = $this->get_field(); $formattedoptions = array( - 0 => get_string('semesterindependent', 'customfield_semester') + 1 => get_string('semesterindependent', 'customfield_semester') ); $showmonthsintofuture = $this->get_field()->get_configdata_property('showmonthsintofuture'); $endtime = new DateTime("+$showmonthsintofuture months"); @@ -132,7 +132,7 @@ class data_controller extends \core_customfield\data_controller { * @return string|null The human readable semester name */ public static function get_name_for_semester(int $value) { - if ($value === 0) { + if ($value === 1) { return get_string('semesterindependent', 'customfield_semester'); } else if ($value == null) { return null; -- GitLab