aboutsummaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
Diffstat (limited to 'classes')
-rw-r--r--classes/BiblioIsisDb.php5
-rw-r--r--classes/IsisConnector.php15
-rw-r--r--classes/iterators/IsisItemIterator.php4
-rw-r--r--classes/iterators/IsisMainItemIterator.php2
-rw-r--r--classes/iterators/IsisMethodIterator.php2
-rw-r--r--classes/iterators/IsisRowIterator.php2
-rw-r--r--classes/iterators/IsisSubfieldIterator.php4
7 files changed, 23 insertions, 11 deletions
diff --git a/classes/BiblioIsisDb.php b/classes/BiblioIsisDb.php
index 3baa529..825b80f 100644
--- a/classes/BiblioIsisDb.php
+++ b/classes/BiblioIsisDb.php
@@ -338,7 +338,10 @@ class BiblioIsisDb implements IsisDb {
// Join subfields and main field if needed.
if (CinisisDb::join_subfields($this->format)) {
- $data[$entry] = $data[$entry]['subfields'];
+ if (isset($data[$entry]['subfields'])) {
+ $data[$entry] = $data[$entry]['subfields'];
+ }
+
if (isset($field)) {
$data[$entry][CinisisDb::main_field_name($this->format, $key)] = $field;
}
diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php
index 2b4fe28..e845683 100644
--- a/classes/IsisConnector.php
+++ b/classes/IsisConnector.php
@@ -103,7 +103,12 @@ class IsisConnector {
* Number of rows.
*/
public function getRows($field) {
- return count($this->result[$field['name']]);
+ if (isset($this->result[$field['name']])) {
+ return count($this->result[$field['name']]);
+ }
+ else {
+ return 0;
+ }
}
/**
@@ -735,7 +740,11 @@ class IsisConnector {
* Subfield name.
*/
public function getSubfieldName($field_key, $subfield_key) {
- return $this->format['fields'][$field_key]['subfields'][$subfield_key];
+ if (isset($this->format['fields'][$field_key]['subfields'][$subfield_key])) {
+ return $this->format['fields'][$field_key]['subfields'][$subfield_key];
+ }
+
+ return FALSE;
}
/**
@@ -771,7 +780,7 @@ class IsisConnector {
*/
public function hasFieldSubfieldCondition($field, $subfield, $key, $subkey) {
$field_key = $this->getFieldKey($field);
- $subdield_key = $this->getSubfieldKey($field, $subfield);
+ $subfield_key = $this->getSubfieldKey($field, $subfield);
if ($field_key == $key && $subfield_key == $subkey) {
return true;
diff --git a/classes/iterators/IsisItemIterator.php b/classes/iterators/IsisItemIterator.php
index 9435146..f5ccd91 100644
--- a/classes/iterators/IsisItemIterator.php
+++ b/classes/iterators/IsisItemIterator.php
@@ -68,7 +68,7 @@ class IsisItemIterator implements Iterator
* Move forward to next element.
*/
function next() {
- if ($this->item >= $this->items) {
+ if ($this->item >= $this->items - 1) {
$this->item = 0;
++$this->row;
}
@@ -81,6 +81,6 @@ class IsisItemIterator implements Iterator
* Check if there is a current element after calls to rewind() or next().
*/
function valid() {
- return $this->row <= $this->rows;
+ return $this->row <= $this->rows - 1;
}
}
diff --git a/classes/iterators/IsisMainItemIterator.php b/classes/iterators/IsisMainItemIterator.php
index 8bcbfe4..2c1784a 100644
--- a/classes/iterators/IsisMainItemIterator.php
+++ b/classes/iterators/IsisMainItemIterator.php
@@ -65,7 +65,7 @@ class IsisMainItemIterator implements Iterator
* Check if there are more rows.
*/
function has_more_rows() {
- return $this->row <= $this->rows;
+ return $this->row < $this->rows - 1;
}
/**
diff --git a/classes/iterators/IsisMethodIterator.php b/classes/iterators/IsisMethodIterator.php
index 4d2bbd4..e5188d3 100644
--- a/classes/iterators/IsisMethodIterator.php
+++ b/classes/iterators/IsisMethodIterator.php
@@ -64,6 +64,6 @@ class IsisMethodIterator implements Iterator
* Check if there is a current element after calls to rewind() or next().
*/
function valid() {
- return $this->position <= $this->total;
+ return $this->position < $this->total - 1;
}
}
diff --git a/classes/iterators/IsisRowIterator.php b/classes/iterators/IsisRowIterator.php
index 739db22..0c1463f 100644
--- a/classes/iterators/IsisRowIterator.php
+++ b/classes/iterators/IsisRowIterator.php
@@ -53,6 +53,6 @@ class IsisRowIterator implements Iterator
* Check if there is a current element after calls to rewind() or next().
*/
function valid() {
- return $this->row <= $this->rows;
+ return $this->row <= $this->rows - 1;
}
}
diff --git a/classes/iterators/IsisSubfieldIterator.php b/classes/iterators/IsisSubfieldIterator.php
index 2e213cf..2bc57c0 100644
--- a/classes/iterators/IsisSubfieldIterator.php
+++ b/classes/iterators/IsisSubfieldIterator.php
@@ -60,7 +60,7 @@ class IsisSubfieldIterator implements Iterator
* Move forward to next element.
*/
function next() {
- if ($this->subfield >= $this->subfields) {
+ if ($this->subfield >= $this->subfields - 1) {
$this->subfield = 0;
++$this->row;
}
@@ -73,6 +73,6 @@ class IsisSubfieldIterator implements Iterator
* Check if there is a current element after calls to rewind() or next().
*/
function valid() {
- return $this->row <= $this->rows;
+ return $this->row <= $this->rows - 1;
}
}