Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-09-24 14:39:22 +02:00
commit 0c27b90c5d
6 changed files with 28 additions and 8 deletions

View File

@ -0,0 +1,15 @@
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`component` AS
SELECT
`t`.`Id_Componente` AS `id`,
`t`.`Componente` AS `name`,
`t`.`tarifa_componentes_series_id` AS `typeFk`,
`t`.`tarifa_class` AS `classRate`,
`t`.`tax` AS `tax`,
`t`.`is_renewable` AS `isRenewable`,
`t`.`code` AS `code`
FROM
`bi`.`tarifa_componentes` `t`;

View File

@ -96,7 +96,12 @@ module.exports = Self => {
let where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'search':
return {'o.id': value};
return /^\d+$/.test(value)
? {'o.id': value}
: {or: [
{'c.name': {like: `%${value}%`}}
]};
// return {'o.id': value};
case 'from':
return {'o.date_send': {gte: value}};
case 'to':

View File

@ -3,7 +3,7 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "componentRate"
"table": "component"
}
},
"properties": {
@ -24,7 +24,7 @@
"isRenewable": {
"type": "Number"
},
"componentTypeRate": {
"typeFk": {
"type": "Number"
},
"code": {
@ -35,7 +35,7 @@
"componentType": {
"type": "belongsTo",
"model": "ComponentTypeRate",
"foreignKey": "componentTypeRate"
"foreignKey": "typeFk"
}
},
"acls": [

View File

@ -3,7 +3,7 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "componentTypeRate"
"table": "componentType"
}
},
"properties": {

View File

@ -17,7 +17,7 @@ class Controller {
include: {
relation: 'componentRate',
scope: {
fields: ['componentTypeRate', 'name'],
fields: ['typeFk', 'name'],
include: {
relation: 'componentType',
scope: {

View File

@ -133,8 +133,8 @@ module.exports = {
i.tag6, i.value6, i.tag7, i.value7
FROM vn.sale s
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
LEFT JOIN componentRate cr ON cr.id = sc.componentFk
LEFT JOIN componentTypeRate ctr ON ctr.id = cr.componentTypeRate
LEFT JOIN component cr ON cr.id = sc.componentFk
LEFT JOIN componentType ctr ON ctr.id = cr.typeFk
LEFT JOIN item i ON i.id = s.itemFk
LEFT JOIN ticket t ON t.id = s.ticketFk
LEFT JOIN origin o ON o.id = i.originFk