aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-06-09 12:01:59 -0300
committerSilvio <silvio@devlet.com.br>2010-06-09 12:01:59 -0300
commit9349a381cde59a16d49dcdd8a3e92bbe254028f6 (patch)
treed9b24ff51ea5a5c8b10876ab285dbecba805a56d
parent46f3f4e07ffa15bb5b563462aca530ba360d341b (diff)
downloadcinisis-9349a381cde59a16d49dcdd8a3e92bbe254028f6.tar.gz
cinisis-9349a381cde59a16d49dcdd8a3e92bbe254028f6.tar.bz2
Print main field if needed on csv export
-rw-r--r--tests/csv.php13
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']]);