From 96b7fff8afc0cc2f7d589f589a3c77761e961861 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Wed, 7 Aug 2013 10:37:21 +1200 Subject: [PATCH] prevent duplication of template values --- db/install.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/db/install.php b/db/install.php index 968152c..8c119b0 100644 --- a/db/install.php +++ b/db/install.php @@ -38,7 +38,9 @@ function xmldb_attendance_install() { $rec->grade = $v; $rec->visible = 1; $rec->deleted = 0; - $result = $result && $DB->insert_record('attendance_statuses', $rec); + if (!$DB->record_exists('attendance_statuses', array('attendanceid' => 0, 'acronym' => $rec->acronym))) { + $result = $result && $DB->insert_record('attendance_statuses', $rec); + } } return $result;