From 83d75e8e2bb689172f0d0ba82afb4d9b2b59d9bd Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Tue, 23 Jul 2013 18:41:26 +0200 Subject: [PATCH] Fix #1369 : Retrieve fields by structure order --- lib/classes/caption/record.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/classes/caption/record.php b/lib/classes/caption/record.php index caf8964be9..12fb94eac7 100644 --- a/lib/classes/caption/record.php +++ b/lib/classes/caption/record.php @@ -165,7 +165,8 @@ class caption_record implements caption_interface, cache_cacheableInterface } catch (Exception $e) { $sql = "SELECT m.id as meta_id, s.id as structure_id FROM metadatas m, metadatas_structure s - WHERE m.record_id = :record_id AND s.id = m.meta_struct_id"; + WHERE m.record_id = :record_id AND s.id = m.meta_struct_id + ORDER BY s.sorter ASC"; $stmt = $this->databox->get_connection()->prepare($sql); $stmt->execute(array(':record_id' => $this->record->get_record_id())); $fields = $stmt->fetchAll(PDO::FETCH_ASSOC);