diff options
author | Silvio <silvio@devlet.com.br> | 2010-06-09 12:01:59 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-06-09 12:01:59 -0300 |
commit | 9349a381cde59a16d49dcdd8a3e92bbe254028f6 (patch) | |
tree | d9b24ff51ea5a5c8b10876ab285dbecba805a56d /tests/csv.php | |
parent | 46f3f4e07ffa15bb5b563462aca530ba360d341b (diff) | |
download | cinisis-9349a381cde59a16d49dcdd8a3e92bbe254028f6.tar.gz cinisis-9349a381cde59a16d49dcdd8a3e92bbe254028f6.tar.bz2 |
Print main field if needed on csv export
Diffstat (limited to 'tests/csv.php')
-rw-r--r-- | tests/csv.php | 13 |
1 files 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']]); |