From 9349a381cde59a16d49dcdd8a3e92bbe254028f6 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 9 Jun 2010 12:01:59 -0300 Subject: Print main field if needed on csv export --- tests/csv.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/csv.php b/tests/csv.php index c08b18f..57bb890 100644 --- a/tests/csv.php +++ b/tests/csv.php @@ -2,8 +2,7 @@ /** * Cinisis - Isis db reading tool. * - * @fixme: script is broken after BiblioIsis repetition support - * was enhanced. + * @TODO: check what happens if theres a field and subfields with repetition. */ /** @@ -85,7 +84,7 @@ if ($isis->db) { echo "\n"; // Format output. - for ($n=1; $n <= $rows; $n++) { + for ($n = 1; $n <= $rows; $n++) { $result = $isis->db->read($n); if ($result) { @@ -94,7 +93,13 @@ if ($isis->db) { foreach ($format['fields'] as $field) { if (is_array($result[$field['name']])) { - echo csv(); + // Print main field if needed. + if (is_array($result[$field['name']][0])) { + echo csv(); + } + else { + echo csv($result[$field['name']][0]); + } } else { echo csv($result[$field['name']]); -- cgit v1.2.3