aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-05-12 12:08:43 -0300
committerSilvio <silvio@devlet.com.br>2010-05-12 12:08:43 -0300
commit8b085bb0183d24c723ffbda9723b26ab0a1b4a16 (patch)
treea5f3afc4ff3745dbe6b3e273ff96302fac3219d0 /tests
parent5e842b0327e60fae0901b793f76c9be4ec6399cb (diff)
downloadcinisis-8b085bb0183d24c723ffbda9723b26ab0a1b4a16.tar.gz
cinisis-8b085bb0183d24c723ffbda9723b26ab0a1b4a16.tar.bz2
Filtering empty results on BiblioIsis and on CSV export
Diffstat (limited to 'tests')
-rw-r--r--tests/csv.php32
1 files changed, 17 insertions, 15 deletions
diff --git a/tests/csv.php b/tests/csv.php
index bea8091..52c5fd5 100644
--- a/tests/csv.php
+++ b/tests/csv.php
@@ -63,24 +63,26 @@ if ($isis->db) {
for ($n=1; $n <= $rows; $n++) {
$result = $isis->db->read($n);
- // Filter results.
- array_walk_recursive($result, 'filter');
+ if ($result) {
+ // Filter results.
+ array_walk_recursive($result, 'filter');
- foreach ($format['fields'] as $field) {
- if (is_array($result[$field['name']])) {
- echo csv();
- }
- else {
- echo csv($result[$field['name']]);
- }
- if (is_array($field['subfields'])) {
- foreach ($field['subfields'] as $key => $value) {
- echo csv($result[$field['name']][$value]);
+ foreach ($format['fields'] as $field) {
+ if (is_array($result[$field['name']])) {
+ echo csv();
+ }
+ else {
+ echo csv($result[$field['name']]);
+ }
+ if (is_array($field['subfields'])) {
+ foreach ($field['subfields'] as $key => $value) {
+ echo csv($result[$field['name']][$value]);
+ }
}
}
- }
- // New roll.
- echo "\n";
+ // New roll.
+ echo "\n";
+ }
}
}