aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-06-08 12:36:06 -0300
committerSilvio <silvio@devlet.com.br>2010-06-08 12:36:06 -0300
commit8af0c38eded66d9ec8fbb85731a2d98084a9e065 (patch)
treed6794d2f93388a341e3d85246aa27162beacc87a
parent6b2c196c75b8b11cc9f9ffc645c25a555532f2f8 (diff)
downloadcinisis-8af0c38eded66d9ec8fbb85731a2d98084a9e065.tar.gz
cinisis-8af0c38eded66d9ec8fbb85731a2d98084a9e065.tar.bz2
Adding method has_subfields into BiblioIsis
-rw-r--r--classes/BiblioIsisDb.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/classes/BiblioIsisDb.php b/classes/BiblioIsisDb.php
index 8f341bd..06826a6 100644
--- a/classes/BiblioIsisDb.php
+++ b/classes/BiblioIsisDb.php
@@ -172,9 +172,16 @@ class BiblioIsisDb implements IsisDb {
return $data;
}
- function subfield(&$data, $name, $key) {
- if (isset($this->format['fields'][$key]['subfields']) && is_array($data[$name])) {
+ function has_subfields($key) {
+ if (isset($this->format['fields'][$key]['subfields'])) {
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+ function subfield(&$data, $name, $key) {
+ if ($this->has_subfields($key) && is_array($data[$name])) {
foreach ($data[$name] as $subkey => $subvalue) {
if (isset($this->format['fields'][$key]['subfields'][$subkey])) {
$subname = $this->format['fields'][$key]['subfields'][$subkey];
@@ -188,7 +195,6 @@ class BiblioIsisDb implements IsisDb {
unset($data[$name][$subkey]);
}
}
-
}
}
@@ -204,6 +210,10 @@ class BiblioIsisDb implements IsisDb {
*
* @return
* True if repetitive, false otherwise.
+ *
+ * @todo
+ * Warn on configuration/data mismatch ("config says that
+ * $field is non repetitive but data shows a repetition").
*/
function is_repetitive($field, $value) {
if (isset($this->format['fields'][$field]['repeat']) &&