Merge branch '2188-holiday_view' of verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-03-12 10:26:54 +00:00 committed by Gitea
commit c0a806f751
5 changed files with 12 additions and 12 deletions

View File

@ -23,12 +23,12 @@ module.exports = Self => {
beginningYear.setHours(0, 0, 0, 0);
let holidays = await Self.rawSql(
`SELECT lh.dated, chn.name, cht.name, w.id
FROM vn.holiday lh
JOIN vn.workCenter w ON w.id = lh.workcenterFk
LEFT JOIN vn.calendarHolidaysName chn ON chn.id = lh.holidayDetailFk
LEFT JOIN vn.calendarHolidaysType cht ON cht.id = lh.holidayTypeFk
WHERE w.warehouseFk = ? AND lh.dated >= ?`, [warehouseFk, beginningYear]);
`SELECT clh.dated, chn.name, cht.name, w.id
FROM vn.calendarHolidays clh
JOIN vn.workCenter w ON w.id = clh.workcenterFk
LEFT JOIN vn.calendarHolidaysName chn ON chn.id = clh.calendarHolidaysNameFk
LEFT JOIN vn.calendarHolidaysType cht ON cht.id = clh.calendarHolidaysTypeFk
WHERE w.warehouseFk = ? AND clh.dated >= ?`, [warehouseFk, beginningYear]);
return holidays.map(holiday => {
holiday.dated = new Date(holiday.dated);

View File

@ -5,7 +5,7 @@
"Department": {
"dataSource": "vn"
},
"Holiday": {
"CalendarHoliday": {
"dataSource": "vn"
},
"CalendarHolidaysName": {

View File

@ -1,17 +1,17 @@
{
"name": "Holiday",
"name": "CalendarHoliday",
"base": "VnModel",
"options": {
"mysql": {
"table": "holiday"
"table": "calendarHolidays"
}
},
"properties": {
"holidayDetailFk": {
"calendarHolidaysNameFk": {
"id": true,
"type": "Number"
},
"holidayTypeFk": {
"calendarHolidaysTypeFk": {
"id": true,
"type": "Number"
},

View File

@ -23,7 +23,7 @@
},
"holidays": {
"type": "hasMany",
"model": "Holiday",
"model": "CalendarHoliday",
"foreignKey": "workCenterFk"
}
},