| .. | .. |
|---|
| 87 | 87 | * number it find it by position |
|---|
| 88 | 88 | */ |
|---|
| 89 | 89 | this.getMetadata = function(index) { |
|---|
| 90 | | - if (!_metadata) |
|---|
| 91 | | - throw new Error( |
|---|
| 92 | | - 'There is no catalog metadata info'); |
|---|
| 93 | | - if (index === undefined) |
|---|
| 90 | + if (!_metadata) { |
|---|
| 91 | + throw new Error('There is no catalog metadata info'); |
|---|
| 92 | + } |
|---|
| 93 | + if (index === undefined) { |
|---|
| 94 | 94 | return _current; |
|---|
| 95 | + } |
|---|
| 95 | 96 | if (typeof index === 'string') { |
|---|
| 96 | 97 | for (var i = _metadata.length - 1; i >= 0 |
|---|
| 97 | 98 | && _metadata[i].resource !== index; i--) |
|---|
| .. | .. |
|---|
| 217 | 218 | } |
|---|
| 218 | 219 | this.loadRefs = function(callback, refsFields) { |
|---|
| 219 | 220 | if (!refsFields || refsFields.length === 0) { |
|---|
| 220 | | - if (!_current) |
|---|
| 221 | + if (!_current) { |
|---|
| 221 | 222 | throw new Error('There is no current catalog selected'); |
|---|
| 223 | + } |
|---|
| 222 | 224 | refsFields = []; |
|---|
| 223 | 225 | _current.fields.forEach(function(f) { |
|---|
| 224 | | - if (f.resource) |
|---|
| 225 | | - refsFields.push(f) |
|---|
| 226 | | - |
|---|
| 226 | + if (f.resource) { |
|---|
| 227 | + refsFields.push(f); |
|---|
| 228 | + } |
|---|
| 227 | 229 | }); |
|---|
| 228 | 230 | } |
|---|
| 229 | 231 | |
|---|
| .. | .. |
|---|
| 248 | 250 | refs[rf.name].forEach(function(row) { |
|---|
| 249 | 251 | comboData.push({ |
|---|
| 250 | 252 | id : row[pk], |
|---|
| 253 | + code : row.code, |
|---|
| 251 | 254 | label : row.label |
|---|
| 252 | 255 | || row.name |
|---|
| 253 | 256 | || row.code |
|---|