Skip to content
Snippets Groups Projects
Commit 912fffe0 authored by Rolf Niepraschk's avatar Rolf Niepraschk
Browse files

neu: "Customer.Sign"

parent 272d525d
Branches
No related tags found
No related merge requests found
...@@ -13,16 +13,16 @@ function(head, req) { ...@@ -13,16 +13,16 @@ function(head, req) {
return x ? x[1] : x; return x ? x[1] : x;
} }
function getReplacement(doc, type, p1) { function getReplacement(key, type, p1) {
// Liefert Datenstruktur je nach doc, type und ggf. subtype // Liefert Datenstruktur je nach key, type und ggf. subtype
var obj = docs[doc], ret = false, src; var obj = docs[key], ret = false, src;
///send(doc + ' *** ' + type + ' *** ' + p1 + '\n'); ///send(key + ' *** ' + type + ' *** ' + p1 + '\n');
///send(JSON.stringify(obj) + '\n'); ///send(JSON.stringify(obj) + '\n');
if (obj) { if (obj) {
switch (type) { switch (type) {
case 'ENUM': case 'ENUM':
ret = []; ret = [];
switch (doc) { switch (key) {
case '000_COUNTRIES': case '000_COUNTRIES':
ret=[''].concat(Object.keys(obj.Countries)); ret=[''].concat(Object.keys(obj.Countries));
break; break;
...@@ -62,6 +62,9 @@ function(head, req) { ...@@ -62,6 +62,9 @@ function(head, req) {
ret.push(src[i]); ret.push(src[i]);
} }
break; break;
case 'Customer.Sign':
ret = docs[key];
break;
} }
if (ret) ret.sort(); if (ret) ret.sort();
break; break;
...@@ -93,11 +96,18 @@ function(head, req) { ...@@ -93,11 +96,18 @@ function(head, req) {
start({"headers":{"Content-Type":"application/json"}}); start({"headers":{"Content-Type":"application/json"}});
docs['Customer.Sign'] = [];
while(row = getRow()) {// Speichern aller von View gelieferten Dokumente while(row = getRow()) {// Speichern aller von View gelieferten Dokumente
docs[row.value._id] = row.value; if (row.value._id.indexOf('000_') == 0) {
// id als key
docs[row.value._id] = row.value;
} else if (row.value.Customer.Sign) {
docs['Customer.Sign'].push(row.value.Customer.Sign);
}
} }
mainDoc = docs[mainDocName]; mainDoc = docs[mainDocName];
if (!mainDoc) { if (!mainDoc) {
sendError('Wrong or none main schema.'); sendError('Wrong or none main schema.');
return; return;
......
function(doc) { function(doc) {
if (doc._id.indexOf('000_') == 0) { if (doc._id.indexOf('000_') == 0 || doc.Customer.Sign) {
emit(null, doc); emit(null, doc);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment