const searchTerms: AcqProviderSearchTerm[] = [];
if (this.providerName) {
- searchTerms.push({ fields: ['name'], op: 'ilike', value: this.providerName });
+ searchTerms.push({ classes: ['acqpro'], fields: ['name'], op: 'ilike', value: this.providerName });
}
if (this.providerCode) {
- searchTerms.push({ fields: ['code'], op: 'ilike', value: this.providerCode });
+ searchTerms.push({ classes: ['acqpro'], fields: ['code'], op: 'ilike', value: this.providerCode });
}
if (this.providerOwners) {
- searchTerms.push({ fields: ['owner'], op: 'in', value: this.providerOwners.orgIds });
+ searchTerms.push({ classes: ['acqpro'], fields: ['owner'], op: 'in', value: this.providerOwners.orgIds });
}
if (this.contactName) {
searchTerms.push({ classes: ['acqpc'], fields: ['name'], op: 'ilike', value: this.contactName });
searchTerms.push({ classes: ['acqpc','acqpro','acqpro'], fields: ['phone','phone','fax_phone'], op: 'ilike', value: this.providerPhone });
}
if (this.providerCurrencyType) {
- searchTerms.push({ fields: ['currency_type'], op: 'ilike', value: this.providerCurrencyType });
+ searchTerms.push({ classes: ['acqpro'], fields: ['currency_type'], op: 'ilike', value: this.providerCurrencyType });
}
if (this.providerSAN) {
- searchTerms.push({ fields: ['san'], op: 'ilike', value: this.providerSAN });
+ searchTerms.push({ classes: ['acqpro'], fields: ['san'], op: 'ilike', value: this.providerSAN });
}
if (this.providerEDIDefault) {
- searchTerms.push({ fields: ['edi_default'], op: '=', value: this.providerEDIDefault });
+ searchTerms.push({ classes: ['acqpro'], fields: ['edi_default'], op: '=', value: this.providerEDIDefault });
}
if (this.providerURL) {
- searchTerms.push({ fields: ['url'], op: 'ilike', value: this.providerURL });
+ searchTerms.push({ classes: ['acqpro'], fields: ['url'], op: 'ilike', value: this.providerURL });
}
if (this.providerIsActive) {
- searchTerms.push({ fields: ['active'], op: '=', value: (this.providerIsActive ? 't' : 'f') });
+ searchTerms.push({ classes: ['acqpro'], fields: ['active'], op: '=', value: (this.providerIsActive ? 't' : 'f') });
}
// tossing setTimeout here to ensure that the
import {EventService} from '@eg/core/event.service';
export interface AcqProviderSearchTerm {
- classes?: string[];
+ classes: string[];
fields: string[];
op: string;
value: any;
class_list = class_list.filter((x, i, a) => x && x !== 'acqpro' && a.indexOf(x) == i);
// build a join clause for use in the "opts" part of a pcrud query
- class_list.forEach(cls => { joinPart[cls].type = 'left' })
+ class_list.forEach(cls => { joinPart[cls] = {type : 'left' } })
if (Object.keys(joinPart).length == 0) return null;
return joinPart;
}
// not const because we may want an array
- let query_part = new Object();
+ let query_obj = new Object();
+ let query_arr = new Array();
let op = term.op;
if (!op) { op = '=' }; // just in case
isOR = true;
let tmp = new Object();
if (first_cls) {
- tmp['+'+first_cls] = query_part;
+ tmp['+'+first_cls] = query_obj;
} else {
- tmp = query_part;
+ tmp = query_obj;
}
- query_part = new Array();
- query_part.push(tmp);
+ query_arr.push(tmp);
}
if (curr_cls) {
if (isOR) {
let tmp = new Object();
+ tmp['+'+curr_cls] = new Object();
+ tmp['+'+curr_cls][field] = new Object();
tmp['+'+curr_cls][field][op] = val;
- query_part.push(tmp);
+ query_arr.push(tmp);
} else {
- query_part['+'+curr_cls][field][op] = val;
+ query_obj['+'+curr_cls] = new Object();
+ query_obj['+'+curr_cls][field] = new Object();
+ query_obj['+'+curr_cls][field][op] = val;
}
} else {
if (isOR) {
let tmp = new Object();
+ tmp[field] = new Object();
tmp[field][op] = val;
- query_part.push(tmp);
+ query_arr.push(tmp);
} else {
- query_part[field][op] = val;
+ query_obj[field] = new Object();
+ query_obj[field][op] = val;
}
}
});
- if (isOR) { query_part = {'-or':query_part} }
- query.push(query_part);
+ if (isOR) { query_obj = {'-or':query_arr} }
+ query.push(query_obj);
});
// handle grid filters