Compare commits

...

66 Commits

Author SHA1 Message Date
Ivan Mas 074fe5b0ac Merge pull request 'feat: refs #8477 add costPerKg to awb view' (!3409) from 8477-addColumnToAwbView into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3409
Reviewed-by: Robert Ferrús <robert@verdnatura.es>
2025-01-31 11:45:36 +00:00
Ivan Mas 2e4c5fe401 feat: refs #8477 add costPerKg to awb view
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 12:10:19 +01:00
Ivan Mas 83228d481d Merge pull request 'feat: refs #8477 add fee column to awb table' (!3400) from 8477-AddFeeToAWB into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3400
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2025-01-31 10:42:43 +00:00
Ivan Mas 3fa74a18de Merge branch 'dev' into 8477-AddFeeToAWB
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 10:39:55 +00:00
Ivan Mas 45ccf8da28 Merge pull request 'feat: refs #8312 add flippingCost column to Cubos view' (!3407) from 8312-addColumnCubosView into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3407
Reviewed-by: Robert Ferrús <robert@verdnatura.es>
2025-01-31 10:10:12 +00:00
Ivan Mas fa9b9cc5a3 feat: refs #8312 modify fixtures.before
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 11:06:24 +01:00
Ivan Mas 66a08f7641 Merge branch 'dev' into 8312-addColumnCubosView
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 09:51:33 +00:00
Jon Elias 923fef444c Merge pull request 'Fix[CustomerList]: fixed country field' (!3406) from CustomerListCountryField into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3406
Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
2025-01-31 09:33:17 +00:00
Ivan Mas a2258a005a Merge branch 'dev' into 8312-addColumnCubosView
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 09:23:32 +00:00
Carlos Satorres 3fede6d586 Merge pull request 'refs #6553 changes models' (!2522) from 6553-workerBusiness into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #2522
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2025-01-31 09:19:14 +00:00
Ivan Mas da5e395450 feat: refs #8312 add flippingCost column to Cubos view
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 10:17:01 +01:00
Carlos Satorres e1125dc46d Merge branch 'dev' into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 09:16:13 +00:00
Jon Elias 53ee0c1617 fix: fixed country field
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 09:17:15 +01:00
Ivan Mas 4d210b34c7 Merge pull request 'feat: refs #8312 new column packaging.rejectCost' (!3391) from 8312-newPackagingColumn into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3391
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2025-01-30 17:03:58 +00:00
Ivan Mas f68f62543d Merge branch 'dev' into 8477-AddFeeToAWB
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-30 17:00:14 +00:00
Ivan Mas 148072b39d feat: refs #8477 change column name and add comment
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-30 17:58:39 +01:00
Ivan Mas 9e95afa190 Merge branch 'dev' into 8312-newPackagingColumn
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-30 16:37:52 +00:00
Ivan Mas e0e72272a7 feat: refs #8312 change column name
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-30 17:35:30 +01:00
Ivan Mas ecc92792da Merge pull request 'feat: refs #8487 deprecate travel.appointment' (!3399) from 8487-deprecateAppointmentFromTravel into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3399
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2025-01-30 13:40:37 +00:00
Ivan Mas 85c3dc54fa Merge branch 'dev' into 8487-deprecateAppointmentFromTravel
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-30 13:24:08 +00:00
Jon Elias ef8e206520 Merge pull request '#7488: Deleted nif validation' (!3402) from 7488-DeleteNifValidation into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3402
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2025-01-30 12:52:50 +00:00
Jon Elias 0a89a6a6fd fix: refs #7488 deleted nif validation
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-30 12:40:48 +01:00
Ivan Mas 2a7795d432 feat: refs #8477 add fee column to awb table
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-29 19:24:49 +01:00
Ivan Mas 70d286df80 feat: refs #8487 deprecate travel.appointment
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-29 14:59:19 +01:00
Ivan Mas dfcc155ef9 Merge branch 'dev' into 8312-newPackagingColumn
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-28 18:14:38 +00:00
Ivan Mas 821e2cbe4d feat: refs #8312 new column packaging.rejectCost
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-28 19:11:56 +01:00
Carlos Satorres b14beb83f4 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-28 11:55:27 +01:00
Carlos Satorres 10a6626a65 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness 2025-01-23 10:26:15 +01:00
Carlos Satorres 024ab8602d fix: refs #6553 fix back advanced summary
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-15 10:31:49 +01:00
Carlos Satorres 6ef0d2625d Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-15 08:40:16 +01:00
Carlos Satorres 60f0b169d4 fix: refs #6553 fix advanced
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-13 13:56:24 +01:00
Carlos Satorres a4f9d62504 Merge branch '6553-workerBusiness' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-13 12:23:24 +01:00
Carlos Satorres 358f93c454 fix: refs #6553 fix worker back 2025-01-13 12:23:21 +01:00
Carlos Satorres 978914aa71 Merge branch 'dev' into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-13 07:50:12 +00:00
Carlos Satorres c8d57a1efa Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-09 09:59:25 +01:00
Carlos Satorres 209bd21548 Merge branch 'dev' of https: refs #6553//gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-08 10:17:50 +01:00
Carlos Satorres bd1cee6d8b Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-07 12:47:48 +01:00
Carlos Satorres a139c9849c fix: refs #6553 fix model
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-07 10:33:30 +01:00
Carlos Satorres ddecfee24b Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-07 06:13:51 +01:00
Carlos Satorres 6f16974320 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-23 13:30:27 +01:00
Carlos Satorres e2a4c5339a fix: refs #6553 fix back
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-16 13:01:44 +01:00
Carlos Satorres c1b9032534 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness 2024-12-16 12:12:41 +01:00
Carlos Satorres 4bc475d132 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-12-16 11:28:49 +01:00
Carlos Satorres d1aa164aea Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-12-16 07:19:27 +01:00
Carlos Satorres 601909e853 Merge branch 'dev' into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-09-17 13:11:51 +00:00
Carlos Satorres 4b9a39e6ba Merge branch 'dev' into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-09-17 09:08:06 +00:00
Carlos Satorres 2aa0e2af2a Merge branch 'dev' into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-09-17 09:04:21 +00:00
Carlos Satorres c3c60b1fa7 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-09-13 13:06:51 +02:00
Carlos Satorres ff328c9f0d Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-09-10 11:34:50 +02:00
Carlos Satorres a27e3ed60f Merge branch 'dev' of https: refs #6553//gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-09-09 13:21:00 +02:00
Carlos Satorres 5e5a8078ca fix: refs #6553 json worker
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-09-03 13:59:02 +02:00
Carlos Satorres cf651dc2e1 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-09-03 10:51:31 +02:00
Alex Moreno 36b4c7fb74 typo
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-06-26 12:33:38 +02:00
Alex Moreno 3362d7562f Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness 2024-06-26 12:33:19 +02:00
Carlos Satorres cc8af9d14a refs #6553 fix back
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-06-25 10:21:24 +02:00
Carlos Satorres be0de3511b Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-06-25 08:56:49 +02:00
Carlos Satorres 0486c40454 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-06-20 13:35:22 +02:00
Alex Moreno 4f7b625a4f fix(business): sql role
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-06-14 14:48:45 +02:00
Alex Moreno a9ad3df592 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness 2024-06-14 13:36:22 +02:00
Alex Moreno e8d0ebe91d Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6553-workerBusiness
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-06-14 12:09:30 +02:00
Carlos Satorres 41fabecc9b refs #6553 fix acls
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-06-10 09:29:37 +02:00
Carlos Satorres 06fe0f5cef refs #6553 fix acls
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-06-06 07:34:17 +02:00
Carlos Satorres 5d73af5392 refs #6553 fix back
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-06-05 10:43:53 +02:00
Carlos Satorres 11d1cd8eb3 Merge branch 'dev' into 6553-workerBusiness
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-05-30 08:57:58 +00:00
Carlos Satorres a5ffdddb53 refs #6553 fix back
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-05-29 15:56:27 +02:00
Carlos Satorres 3e1b296b29 refs #6553 changes models
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-05-28 15:46:44 +02:00
19 changed files with 402 additions and 23 deletions

View File

@ -3207,7 +3207,7 @@ UPDATE vn.department
SET workerFk = null; SET workerFk = null;
INSERT INTO vn.packaging INSERT INTO vn.packaging
VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0,1); VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0,0,1,0);
INSERT IGNORE INTO vn.intrastat INSERT IGNORE INTO vn.intrastat

View File

@ -18,5 +18,6 @@ AS SELECT `p`.`id` AS `Id_Cubo`,
`p`.`base` AS `Base`, `p`.`base` AS `Base`,
`p`.`isBox` AS `box`, `p`.`isBox` AS `box`,
`p`.`returnCost` AS `costeRetorno`, `p`.`returnCost` AS `costeRetorno`,
`p`.`isActive` AS `isActive` `p`.`isActive` AS `isActive`,
`p`.`flippingCost` AS `flippingCost`
FROM `vn`.`packaging` `p` FROM `vn`.`packaging` `p`

View File

@ -29,5 +29,6 @@ AS SELECT `a`.`id` AS `id`,
`a`.`invoiceInPaletizedFk` AS `invoiceInPaletizedFk`, `a`.`invoiceInPaletizedFk` AS `invoiceInPaletizedFk`,
`a`.`observation` AS `observation`, `a`.`observation` AS `observation`,
`a`.`hasFreightPrepaid` AS `hasFreightPrepaid`, `a`.`hasFreightPrepaid` AS `hasFreightPrepaid`,
`a`.`propertyNumber` AS `propertyNumber` `a`.`propertyNumber` AS `propertyNumber`,
`a`.`costPerKg` AS `costPerKg`
FROM `vn`.`awb` `a` FROM `vn`.`awb` `a`

View File

@ -0,0 +1,27 @@
ALTER TABLE vn.business
ADD CONSTRAINT `business_companyCodeFk` FOREIGN KEY (`companyCodeFk`) REFERENCES `company` (`code`) ON DELETE CASCADE ON UPDATE CASCADE;
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('BusinessReasonEnd','find','*','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('CalendarType','find','*','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('OccupationCode','find','*','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('BusinessReasonEnd','find','*','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('WorkerBusinessProfessionalCategory','find','*','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('WorkerBusinessAgreement','find','*','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('WorkerBusinessType','find','*','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('PayrollCategory','find','*','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Worker','__get__business','*','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Worker','__create__business','*','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Business','crud','*','ALLOW','ROLE','hr');

View File

@ -0,0 +1,2 @@
ALTER TABLE vn.packaging
ADD COLUMN flippingCost decimal(10, 2) NOT NULL DEFAULT 0.00

View File

@ -0,0 +1 @@
ALTER TABLE vn.travel CHANGE appointment appointment__ datetime DEFAULT NULL COMMENT '@deprecated 2025-01-28';

View File

@ -0,0 +1,2 @@
ALTER TABLE `vn`.`awb`
ADD COLUMN `costPerKg` DECIMAL(10, 2) UNSIGNED DEFAULT NULL COMMENT 'Tarifa que indica a cuanto cuesta el kilo en ese vuelo';

View File

@ -158,10 +158,12 @@ module.exports = Self => {
a.provinceFk AS provinceAddressFk, a.provinceFk AS provinceAddressFk,
p.name AS province, p.name AS province,
u.id AS salesPersonFk, u.id AS salesPersonFk,
u.name AS salesPerson u.name AS salesPerson,
co.name AS country
FROM client c FROM client c
LEFT JOIN account.user u ON u.id = c.salesPersonFk LEFT JOIN account.user u ON u.id = c.salesPersonFk
LEFT JOIN province p ON p.id = c.provinceFk LEFT JOIN province p ON p.id = c.provinceFk
LEFT JOIN country co ON co.id = c.countryFk
JOIN address a ON a.clientFk = c.id JOIN address a ON a.clientFk = c.id
` `
); );

View File

@ -139,5 +139,23 @@
}, },
"Xdiario": { "Xdiario": {
"dataSource": "vn" "dataSource": "vn"
},
"BusinessReasonEnd": {
"dataSource": "vn"
},
"OccupationCode": {
"dataSource": "vn"
},
"WorkerBusinessProfessionalCategory": {
"dataSource": "vn"
},
"CalendarType": {
"dataSource": "vn"
},
"WorkerBusinessType": {
"dataSource": "vn"
},
"PayrollCategory": {
"dataSource": "vn"
} }
} }

View File

@ -0,0 +1,17 @@
{
"name": "BusinessReasonEnd",
"base": "VnModel",
"options": {
"mysql": {
"table": "businessReasonEnd"
}
},
"properties": {
"id": {
"type": "number"
},
"reason": {
"type": "string"
}
}
}

View File

@ -13,6 +13,63 @@
}, },
"workcenterFk" : { "workcenterFk" : {
"type": "number" "type": "number"
},
"companyCodeFk" : {
"type": "string"
},
"started" : {
"type": "date"
},
"ended" : {
"type": "date"
},
"workerBusiness" : {
"type": "string"
},
"reasonEndFk" : {
"type": "number"
},
"payedHolidays" : {
"type": "number"
},
"occupationCodeFk" : {
"type": "string"
},
"workerFk" : {
"type": "number"
},
"notes" : {
"type": "string"
},
"departmentFk": {
"type": "string"
},
"workerBusinessProfessionalCategoryFk": {
"type": "number"
},
"calendarTypeFk": {
"type": "string"
},
"isHourlyLabor": {
"type": "boolean"
},
"rate": {
"type": "number"
},
"workerBusinessCategoryFk": {
"type": "number"
},
"workerBusinessTypeFk": {
"type": "number"
},
"amount": {
"type": "number"
},
"workerBusinessAgreementFk": {
"type": "number"
},
"basicSalary": {
"type": "number"
} }
}, },
"relations": { "relations": {
@ -25,6 +82,59 @@
"type": "belongsTo", "type": "belongsTo",
"model": "Department", "model": "Department",
"foreignKey": "departmentFk" "foreignKey": "departmentFk"
} },
"workCenter": {
"type": "belongsTo",
"model": "WorkCenter",
"foreignKey": "workcenterFk"
},
"companyCode": {
"type": "belongsTo",
"model": "Company",
"foreignKey": "companyCodeFk",
"primaryKey": "code"
},
"reasonEnd": {
"type": "belongsTo",
"model": "BusinessReasonEnd",
"foreignKey": "reasonEndFk"
},
"occupationCode": {
"type": "belongsTo",
"model": "OccupationCode",
"foreignKey":"occupationCodeFk",
"primaryKey": "code"
},
"payrollCategory": {
"type": "belongsTo",
"model": "PayrollCategory",
"foreignKey":"workerBusinessCategoryFk"
},
"workerBusinessProfessionalCategory": {
"type": "belongsTo",
"model": "WorkerBusinessProfessionalCategory",
"foreignKey": "workerBusinessProfessionalCategoryFk"
},
"calendarType": {
"type": "belongsTo",
"model": "CalendarType",
"foreignKey": "calendarTypeFk"
},
"workerBusinessCategory": {
"type": "belongsTo",
"model": "WorkerBusinessCategory",
"foreignKey": "workerBusinessCategoryFk"
},
"workerBusinessType": {
"type": "belongsTo",
"model": "WorkerBusinessType",
"foreignKey": "workerBusinessTypeFk"
},
"workerBusinessAgreement": {
"type": "belongsTo",
"model": "WorkerBusinessAgreement",
"foreignKey": "workerBusinessAgreementFk"
}
} }
} }

View File

@ -0,0 +1,21 @@
{
"name": "CalendarType",
"base": "VnModel",
"options": {
"mysql": {
"table": "calendarType"
}
},
"properties": {
"id": {
"type": "number"
},
"description": {
"type": "string"
},
"hoursWeek": {
"type": "number"
},
"isPartial": "number"
}
}

View File

@ -0,0 +1,18 @@
{
"name": "OccupationCode",
"base": "VnModel",
"options": {
"mysql": {
"table": "occupationCode"
}
},
"properties": {
"code": {
"type": "string",
"id": true
},
"name": {
"type": "string"
}
}
}

View File

@ -0,0 +1,20 @@
{
"name": "PayrollCategory",
"base": "VnModel",
"options": {
"mysql": {
"table": "payrollCategories"
}
},
"properties": {
"id": {
"type": "number"
},
"description": {
"type": "string"
},
"rate": {
"type": "number"
}
}
}

View File

@ -0,0 +1,20 @@
{
"name": "WorkerBusinessProfessionalCategory",
"base": "VnModel",
"options": {
"mysql": {
"table": "professionalCategory"
}
},
"properties": {
"id": {
"type": "number"
},
"description": {
"type": "string"
},
"code": {
"type": "string"
}
}
}

View File

@ -0,0 +1,29 @@
{
"name": "WorkerBusinessAgreement",
"base": "VnModel",
"options": {
"mysql": {
"table": "workerBusinessAgreement"
}
},
"properties": {
"id": {
"type": "number"
},
"name": {
"type": "string"
},
"monthHolidays": {
"type": "number"
},
"yearsHours": {
"type": "number"
},
"started": {
"type": "date"
},
"ended": {
"type": "date"
}
}
}

View File

@ -0,0 +1,27 @@
{
"name": "WorkerBusinessType",
"base": "VnModel",
"options": {
"mysql": {
"table": "workerBusinessType"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"name": {
"type": "string"
},
"isFullTime": {
"type": "number"
},
"isPermanent": {
"type": "number"
},
"hasHolidayEntitlement": {
"type": "number"
}
}
}

View File

@ -1,5 +1,4 @@
module.exports = Self => { module.exports = Self => {
const validateTin = require('vn-loopback/util/validateTin');
require('../methods/worker/filter')(Self); require('../methods/worker/filter')(Self);
require('../methods/worker/mySubordinates')(Self); require('../methods/worker/mySubordinates')(Self);
require('../methods/worker/isSubordinate')(Self); require('../methods/worker/isSubordinate')(Self);
@ -23,26 +22,10 @@ module.exports = Self => {
require('../methods/worker/getAvailablePda')(Self); require('../methods/worker/getAvailablePda')(Self);
require('../methods/worker/myTeam')(Self); require('../methods/worker/myTeam')(Self);
Self.validateAsync('fi', tinIsValid, {
message: 'Invalid TIN'
});
Self.canModifyAbsenceInPast = async(ctx, time) => { Self.canModifyAbsenceInPast = async(ctx, time) => {
const hasPrivs = await Self.app.models.ACL.checkAccessAcl(ctx, 'Worker', 'canModifyAbsenceInPast', 'WRITE'); const hasPrivs = await Self.app.models.ACL.checkAccessAcl(ctx, 'Worker', 'canModifyAbsenceInPast', 'WRITE');
const today = Date.vnNew(); const today = Date.vnNew();
today.setHours(0, 0, 0, 0); today.setHours(0, 0, 0, 0);
return hasPrivs || today.getTime() < time; return hasPrivs || today.getTime() < time;
}; };
async function tinIsValid(err, done) {
const country = await Self.app.models.Country.findOne({
fields: ['code'],
where: {id: this.originCountryFk}
});
const code = country ? country.code.toLowerCase() : null;
if (!this.fi || !validateTin(this.fi, code))
err();
done();
}
}; };

View File

@ -75,6 +75,9 @@
}, },
"isSsDiscounted": { "isSsDiscounted": {
"type": "boolean" "type": "boolean"
},
"businessFk": {
"type": "number"
} }
}, },
"relations": { "relations": {
@ -103,6 +106,11 @@
"model": "WorkerDepartment", "model": "WorkerDepartment",
"foreignKey": "id" "foreignKey": "id"
}, },
"currentBusiness": {
"type": "belongsTo",
"model": "Business",
"foreignKey": "businessFk"
},
"collegues": { "collegues": {
"type": "hasMany", "type": "hasMany",
"model": "WorkerTeamCollegues", "model": "WorkerTeamCollegues",
@ -113,6 +121,11 @@
"model": "Locker", "model": "Locker",
"foreignKey": "workerFk" "foreignKey": "workerFk"
}, },
"business": {
"type": "hasMany",
"model": "Business",
"foreignKey": "workerFk"
},
"medicalReview": { "medicalReview": {
"type": "hasMany", "type": "hasMany",
"model": "MedicalReview", "model": "MedicalReview",
@ -259,12 +272,36 @@
"relation": "department", "relation": "department",
"scope": { "scope": {
"fields": [ "fields": [
"name" "id"
] ]
} }
} }
} }
}, },
{
"relation": "business",
"scope": {
"fields": [
"id",
"started",
"ended",
"reasonEndFk",
"departmentFk",
"workerBusinessProfessionalCategoryFk"
],
"include": [
{
"relation": "reasonEnd",
"scope": {
"fields": [
"id",
"reason"
]
}
}
]
}
},
{ {
"relation": "boss", "relation": "boss",
"scope": { "scope": {
@ -312,7 +349,8 @@
"educationLevelFk", "educationLevelFk",
"originCountryFk", "originCountryFk",
"maritalStatus", "maritalStatus",
"SSN" "SSN",
"businessFk"
], ],
"include": [ "include": [
{ {
@ -323,6 +361,48 @@
"phone" "phone"
] ]
} }
},
{
"relation": "currentBusiness",
"scope": {
"fields": [
"id",
"started",
"ended",
"reasonEndFk",
"departmentFk",
"workerBusinessProfessionalCategoryFk"
],
"include": [
{
"relation": "reasonEnd",
"scope": {
"fields": [
"id",
"reason"
]
}
},
{
"relation": "department",
"scope": {
"fields": [
"id",
"name"
]
}
},
{
"relation": "workerBusinessProfessionalCategory",
"scope": {
"fields": [
"id",
"description"
]
}
}
]
}
} }
] ]
} }