Merge branch 'dev' into 7965-unifyProblems
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
948ad3a752
28
CHANGELOG.md
28
CHANGELOG.md
|
@ -1,3 +1,31 @@
|
|||
# Version 25.00 - 2025-01-14
|
||||
|
||||
### Added 🆕
|
||||
|
||||
- feat: refs #7235 add serialType parameter to getInvoiceDate and implement corresponding tests by:jgallego
|
||||
- feat: refs #7301 update lastEntriesFilter to include landedDate and enhance test cases (origin/7301-removeRedundantInventories) by:pablone
|
||||
- feat: refs #7880 error code and translations by:ivanm
|
||||
- feat: refs #7924 add isCustomInspectionRequired field to item and update related logic by:jgallego
|
||||
- feat: refs #8167 update canBeInvoiced method to include active status check and improve test cases by:jgallego
|
||||
- feat: refs #8167 update locale and improve invoicing logic with error handling by:jgallego
|
||||
- feat: refs #8246 added relation for the front's new field by:Jon
|
||||
- feat: refs #8266 added itemFk and needed fixtures by:jtubau
|
||||
- feat: refs #8324 country unique by:Carlos Andrés
|
||||
|
||||
### Changed 📦
|
||||
|
||||
|
||||
### Fixed 🛠️
|
||||
|
||||
- feat: refs #8266 added itemFk and needed fixtures by:jtubau
|
||||
- fix: add isCustomInspectionRequired column to item table for customs inspection indication by:jgallego
|
||||
- fix: canBeInvoiced only in makeInvoice by:alexm
|
||||
- fix: hotFix getMondayWeekYear by:alexm
|
||||
- fix: refs #6598 update ACL property assignment by:jorgep
|
||||
- fix: refs #6861 refs#6861 addPrevOK by:sergiodt
|
||||
- fix: refs #7301 remove debug console log and update test cases in lastEntriesFilter by:pablone
|
||||
- fix: refs #7301 update SQL fixtures and improve lastEntriesFilter logic by:pablone
|
||||
|
||||
# Version 24.52 - 2024-01-07
|
||||
|
||||
### Added 🆕
|
||||
|
|
|
@ -27,38 +27,46 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.sendCheckingPresence = async(ctx, recipientId, message) => {
|
||||
if (!recipientId) return false;
|
||||
const models = Self.app.models;
|
||||
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
const sender = await models.VnUser.findById(userId, {fields: ['id']});
|
||||
const recipient = await models.VnUser.findById(recipientId, null);
|
||||
|
||||
// Prevent sending messages to yourself
|
||||
if (recipientId == userId) return false;
|
||||
if (!recipient)
|
||||
throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`);
|
||||
|
||||
if (!isProduction())
|
||||
message = `[Test:Environment to user ${userId}] ` + message;
|
||||
|
||||
const chat = await models.Chat.create({
|
||||
senderFk: sender.id,
|
||||
recipient: `@${recipient.name}`,
|
||||
dated: Date.vnNew(),
|
||||
checkUserStatus: 1,
|
||||
message: message,
|
||||
status: 'sending',
|
||||
attempts: 0
|
||||
});
|
||||
|
||||
try {
|
||||
await Self.sendCheckingUserStatus(chat);
|
||||
await Self.updateChat(chat, 'sent');
|
||||
} catch (error) {
|
||||
await Self.updateChat(chat, 'error', error);
|
||||
}
|
||||
const models = Self.app.models;
|
||||
const sender = await models.VnUser.findById(userId, {fields: ['id']});
|
||||
const error = `Could not send message from user ${userId}`;
|
||||
|
||||
return true;
|
||||
if (!recipientId) throw new Error(error);
|
||||
const recipient = await models.VnUser.findById(recipientId, null);
|
||||
if (!recipient)
|
||||
throw new Error(error);
|
||||
|
||||
// Prevent sending messages to yourself
|
||||
if (recipientId == userId) return false;
|
||||
|
||||
if (!isProduction())
|
||||
message = `[Test:Environment to user ${userId}] ` + message;
|
||||
|
||||
const chat = await models.Chat.create({
|
||||
senderFk: sender.id,
|
||||
recipient: `@${recipient.name}`,
|
||||
dated: Date.vnNew(),
|
||||
checkUserStatus: 1,
|
||||
message: message,
|
||||
status: 'sending',
|
||||
attempts: 0
|
||||
});
|
||||
|
||||
try {
|
||||
await Self.sendCheckingUserStatus(chat);
|
||||
await Self.updateChat(chat, 'sent');
|
||||
} catch (error) {
|
||||
await Self.updateChat(chat, 'error', error);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
await Self.rawSql(`
|
||||
INSERT INTO util.debug (variable, value)
|
||||
VALUES ('sendCheckingPresence_error', ?)
|
||||
`, [`User: ${userId}, recipient: ${recipientId}, message: ${message}, error: ${e}`]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -22,7 +22,7 @@ module.exports = Self => {
|
|||
description: 'The user email'
|
||||
}, {
|
||||
arg: 'lang',
|
||||
type: 'string',
|
||||
type: 'any',
|
||||
description: 'The user lang'
|
||||
}, {
|
||||
arg: 'twoFactor',
|
||||
|
|
|
@ -4,7 +4,7 @@ USE `util`;
|
|||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
INSERT INTO `version` VALUES ('vn-database','11385','72bf27f08d3ddf646ec0bb6594fc79cecd4b72f2','2025-01-07 07:46:33','11395');
|
||||
INSERT INTO `version` VALUES ('vn-database','11391','43edb1f82e88dcc44eedc8501b93c1fac66d71e9','2025-01-14 07:32:09','11407');
|
||||
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL);
|
||||
|
@ -1078,6 +1078,7 @@ INSERT INTO `versionLog` VALUES ('vn-database','11315','00-firstScript.sql','jen
|
|||
INSERT INTO `versionLog` VALUES ('vn-database','11316','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:05:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11317','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:05:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11319','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:05:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11320','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2025-01-14 07:32:07',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11321','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-26 07:05:30',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11322','00-entryAcl.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-12-10 07:20:04',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11324','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2024-11-13 10:49:47',NULL,NULL);
|
||||
|
@ -1139,6 +1140,9 @@ INSERT INTO `versionLog` VALUES ('vn-database','11379','00-firstScript.sql','jen
|
|||
INSERT INTO `versionLog` VALUES ('vn-database','11379','01-secScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11384','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:32',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11385','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-07 07:46:33',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11390','00-firstScript.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2025-01-14 07:32:08',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11391','00-itemAlter.sql','jenkins@db-proxy2.servers.dc.verdnatura.es','2025-01-14 07:32:08',NULL,NULL);
|
||||
INSERT INTO `versionLog` VALUES ('vn-database','11400','00-firstScript.sql','jenkins@db-proxy1.servers.dc.verdnatura.es','2025-01-09 09:55:24',NULL,NULL);
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
|
@ -1515,6 +1519,7 @@ INSERT INTO `roleInherit` VALUES (378,101,15,19294);
|
|||
INSERT INTO `roleInherit` VALUES (379,103,121,19294);
|
||||
INSERT INTO `roleInherit` VALUES (381,119,123,19295);
|
||||
INSERT INTO `roleInherit` VALUES (382,48,72,783);
|
||||
INSERT INTO `roleInherit` VALUES (383,114,111,19295);
|
||||
|
||||
INSERT INTO `userPassword` VALUES (1,7,1,0,2,1);
|
||||
|
||||
|
@ -2311,9 +2316,9 @@ INSERT INTO `ACL` VALUES (938,'Worker','__get__mail','READ','ALLOW','ROLE','hr',
|
|||
INSERT INTO `ACL` VALUES (939,'Machine','*','*','ALLOW','ROLE','productionBoss',10578);
|
||||
INSERT INTO `ACL` VALUES (940,'ItemTypeLog','find','READ','ALLOW','ROLE','employee',10578);
|
||||
INSERT INTO `ACL` VALUES (941,'Entry','buyLabel','READ','ALLOW','ROLE','employee',10578);
|
||||
INSERT INTO `ACL` VALUES (942,'Cmr','filter','READ','ALLOW','ROLE','production',10578);
|
||||
INSERT INTO `ACL` VALUES (943,'Cmr','downloadZip','READ','ALLOW','ROLE','production',10578);
|
||||
INSERT INTO `ACL` VALUES (944,'Cmr','print','READ','ALLOW','ROLE','production',10578);
|
||||
INSERT INTO `ACL` VALUES (942,'Cmr','filter','READ','ALLOW','ROLE','employee',19295);
|
||||
INSERT INTO `ACL` VALUES (943,'Cmr','downloadZip','READ','ALLOW','ROLE','employee',19295);
|
||||
INSERT INTO `ACL` VALUES (944,'Cmr','print','READ','ALLOW','ROLE','employee',19295);
|
||||
INSERT INTO `ACL` VALUES (945,'Collection','create','WRITE','ALLOW','ROLE','productionBoss',10578);
|
||||
INSERT INTO `ACL` VALUES (946,'Collection','upsert','WRITE','ALLOW','ROLE','productionBoss',10578);
|
||||
INSERT INTO `ACL` VALUES (947,'Collection','replaceById','WRITE','ALLOW','ROLE','productionBoss',10578);
|
||||
|
@ -2327,7 +2332,6 @@ INSERT INTO `ACL` VALUES (954,'RouteComplement','find','READ','ALLOW','ROLE','de
|
|||
INSERT INTO `ACL` VALUES (955,'RouteComplement','create','WRITE','ALLOW','ROLE','delivery',10578);
|
||||
INSERT INTO `ACL` VALUES (956,'RouteComplement','deleteById','WRITE','ALLOW','ROLE','delivery',10578);
|
||||
INSERT INTO `ACL` VALUES (957,'SaleGroup','find','READ','ALLOW','ROLE','production',10578);
|
||||
INSERT INTO `ACL` VALUES (958,'Worker','canCreateAbsenceInPast','WRITE','ALLOW','ROLE','hr',10578);
|
||||
INSERT INTO `ACL` VALUES (959,'WorkerRelative','updateAttributes','*','ALLOW','ROLE','hr',10578);
|
||||
INSERT INTO `ACL` VALUES (960,'WorkerRelative','crud','WRITE','ALLOW','ROLE','hr',10578);
|
||||
INSERT INTO `ACL` VALUES (961,'WorkerRelative','findById','*','ALLOW','ROLE','hr',10578);
|
||||
|
@ -2383,6 +2387,8 @@ INSERT INTO `ACL` VALUES (1010,'InventoryConfig','find','READ','ALLOW','ROLE','b
|
|||
INSERT INTO `ACL` VALUES (1011,'SiiTypeInvoiceIn','find','READ','ALLOW','ROLE','salesPerson',10578);
|
||||
INSERT INTO `ACL` VALUES (1012,'OsrmConfig','optimize','READ','ALLOW','ROLE','employee',10578);
|
||||
INSERT INTO `ACL` VALUES (1013,'Route','optimizePriority','*','ALLOW','ROLE','employee',10578);
|
||||
INSERT INTO `ACL` VALUES (1014,'Worker','canModifyAbsenceInPast','WRITE','ALLOW','ROLE','hr',10578);
|
||||
INSERT INTO `ACL` VALUES (1015,'Worker','__get__sip','READ','ALLOW','ROLE','employee',19294);
|
||||
|
||||
INSERT INTO `fieldAcl` VALUES (1,'Client','name','update','employee');
|
||||
INSERT INTO `fieldAcl` VALUES (2,'Client','contact','update','employee');
|
||||
|
@ -2725,7 +2731,7 @@ INSERT INTO `department` VALUES (124,NULL,'CONTROL INTERNO',122,123,NULL,72,0,0,
|
|||
INSERT INTO `department` VALUES (125,'spainTeam3','EQUIPO ESPAÑA 3',59,60,1118,0,0,0,2,0,43,'/1/43/',NULL,1,NULL,0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (126,NULL,'PRESERVADO',29,30,NULL,0,0,0,2,0,37,'/1/37/',NULL,0,NULL,0,1,1,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (128,NULL,'PALETIZADO',31,32,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,0,NULL,NULL,NULL,'PALLETIZING');
|
||||
INSERT INTO `department` VALUES (130,NULL,'REVISION',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'ON_CHECKING');
|
||||
INSERT INTO `department` VALUES (130,'reviewers','REVISION',33,34,NULL,0,1,0,2,0,37,'/1/37/',NULL,0,NULL,0,0,0,1,NULL,NULL,NULL,'ON_CHECKING');
|
||||
INSERT INTO `department` VALUES (131,'greenhouse','INVERNADERO',105,106,NULL,0,0,0,2,0,58,'/1/58/',NULL,0,NULL,0,1,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (132,NULL,'EQUIPO DC',61,62,1731,0,0,0,2,0,43,'/1/43/','dc_equipo',1,'gestioncomercial@verdnatura.es',0,0,0,0,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO `department` VALUES (133,'franceTeamManagement','EQUIPO GESTIÓN FRANCIA',63,64,9751,72,0,0,2,0,43,'/1/43/','fr_equipo',1,'gestionfrancia@verdnatura.es',0,0,0,0,NULL,NULL,'3300',NULL);
|
||||
|
@ -2740,12 +2746,12 @@ INSERT INTO `department` VALUES (146,NULL,'VERDNACOLOMBIA',3,4,NULL,72,0,0,2,0,2
|
|||
INSERT INTO `department` VALUES (147,'spainTeamAsia','EQUIPO ESPAÑA ASIA',71,72,40214,0,0,0,2,0,43,'/1/43/','esA_equipo',1,'esA@verdnatura.es',0,0,0,0,NULL,NULL,'5500',NULL);
|
||||
INSERT INTO `department` VALUES (148,'franceTeamCatchment','EQUIPO CAPTACIÓN FRANCIA',73,74,25178,0,0,0,2,0,43,'/1/43/',NULL,1,NULL,0,0,0,0,NULL,NULL,'6000',NULL);
|
||||
INSERT INTO `department` VALUES (149,'spainTeamCatchment','EQUIPO ESPAÑA CAPTACIÓN',75,76,1203,0,0,0,2,0,43,'/1/43/','es_captacion_equipo',1,'es_captacion@verdnatura.es',0,0,0,0,NULL,NULL,'5700',NULL);
|
||||
INSERT INTO `department` VALUES (150,'spainTeamLevanteIslands','EQUIPO ESPAÑA LEVANTE',77,78,1118,0,0,0,2,0,43,'/1/43/','es_levante_equipo',1,'levanteislas.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5000',NULL);
|
||||
INSERT INTO `department` VALUES (151,'spainTeamNorthwest','EQUIPO ESPAÑA NOROESTE',79,80,7102,0,0,0,2,0,43,'/1/43/','es_noroeste_equipo',1,'noroeste.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5300',NULL);
|
||||
INSERT INTO `department` VALUES (152,'spainTeamNortheast','EQUIPO ESPAÑA NORESTE',81,82,1118,0,0,0,2,0,43,'/1/43/','es_noreste_equipo',1,'noreste.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5200',NULL);
|
||||
INSERT INTO `department` VALUES (153,'spainTeamSouth','EQUIPO ESPAÑA SUR',83,84,36578,0,0,0,2,0,43,'/1/43/','es_sur_equipo',1,'sur.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5400',NULL);
|
||||
INSERT INTO `department` VALUES (154,'spainTeamCenter','EQUIPO ESPAÑA CENTRO',85,86,4661,0,0,0,2,0,43,'/1/43/','es_centro_equipo',1,'centro.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5100',NULL);
|
||||
INSERT INTO `department` VALUES (155,'spainTeamVip','EQUIPO ESPAÑA VIP',87,88,5432,0,0,0,2,0,43,'/1/43/','es_vip_equipo',1,'vip.verdnatura@gmail.com',0,0,0,0,NULL,NULL,'5600',NULL);
|
||||
INSERT INTO `department` VALUES (150,'spainTeamLevanteIslands','EQUIPO ESPAÑA LEVANTE',77,78,1118,0,0,0,2,0,43,'/1/43/','es_levante_equipo',1,'es_levante@verdnatura.es',0,0,0,0,NULL,NULL,'5000',NULL);
|
||||
INSERT INTO `department` VALUES (151,'spainTeamNorthwest','EQUIPO ESPAÑA NOROESTE',79,80,7102,0,0,0,2,0,43,'/1/43/','es_noroeste_equipo',1,'es_noroeste@verdnatura.es',0,0,0,0,NULL,NULL,'5300',NULL);
|
||||
INSERT INTO `department` VALUES (152,'spainTeamNortheast','EQUIPO ESPAÑA NORESTE',81,82,1118,0,0,0,2,0,43,'/1/43/','es_noreste_equipo',1,'es_noreste@verdnatura.es',0,0,0,0,NULL,NULL,'5200',NULL);
|
||||
INSERT INTO `department` VALUES (153,'spainTeamSouth','EQUIPO ESPAÑA SUR',83,84,36578,0,0,0,2,0,43,'/1/43/','es_sur_equipo',1,'es_sur@verdnatura.es',0,0,0,0,NULL,NULL,'5400',NULL);
|
||||
INSERT INTO `department` VALUES (154,'spainTeamCenter','EQUIPO ESPAÑA CENTRO',85,86,4661,0,0,0,2,0,43,'/1/43/','es_centro_equipo',1,'es_centro@verdnatura.es',0,0,0,0,NULL,NULL,'5100',NULL);
|
||||
INSERT INTO `department` VALUES (155,'spainTeamVip','EQUIPO ESPAÑA VIP',87,88,5432,0,0,0,2,0,43,'/1/43/','es_vip_equipo',1,'es_vip@verdnatura.es',0,0,0,0,NULL,NULL,'5600',NULL);
|
||||
|
||||
INSERT INTO `docuware` VALUES (1,'deliveryNote','Albaranes cliente','find','find','N__ALBAR_N',NULL);
|
||||
INSERT INTO `docuware` VALUES (2,'deliveryNote','Albaranes cliente','store','Archivar','N__ALBAR_N',NULL);
|
||||
|
@ -3046,6 +3052,7 @@ INSERT INTO `message` VALUES (20,'clientNotVerified','Incomplete tax data, pleas
|
|||
INSERT INTO `message` VALUES (21,'quantityLessThanMin','The quantity cannot be less than the minimum');
|
||||
INSERT INTO `message` VALUES (22,'ORDER_ROW_UNAVAILABLE','The ordered quantity exceeds the available');
|
||||
INSERT INTO `message` VALUES (23,'AMOUNT_NOT_MATCH_GROUPING','The quantity ordered does not match the grouping');
|
||||
INSERT INTO `message` VALUES (24,'orderLinesWithZero','There are empty lines. Please delete them');
|
||||
|
||||
INSERT INTO `metatag` VALUES (2,'title','Verdnatura Levante SL, mayorista de flores, plantas y complementos para floristería y decoración');
|
||||
INSERT INTO `metatag` VALUES (3,'description','Verdnatura Levante SL, mayorista de flores, plantas y complementos para floristería y decoración. Envío a toda España, pedidos por internet o por teléfono.');
|
||||
|
|
|
@ -1494,6 +1494,10 @@ INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','travelThermograph','
|
|||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','thermograph','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn2008','buyerSalesAssistant','Tickets','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Update','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','hr','sim','jenkins@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select,Insert,Update,Delete','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','employee','zoneGeo','guillermo@db-proxy2.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','itemCampaign','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','grafana','itemCampaign','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
INSERT IGNORE INTO `tables_priv` VALUES ('','vn','buyer','campaign','guillermo@db-proxy1.servers.dc.verdnatura.es','0000-00-00 00:00:00','Select','');
|
||||
/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
|
||||
|
||||
/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
|
||||
|
|
|
@ -6249,19 +6249,27 @@ BEGIN
|
|||
* @param vDateFrom Fecha desde
|
||||
* @param vDateTo Fecha hasta
|
||||
*/
|
||||
IF vDateFrom IS NULL THEN
|
||||
SET vDateFrom = util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
|
||||
DECLARE vDaysInYear INT;
|
||||
SET vDaysInYear = DATEDIFF(util.lastDayOfYear(CURDATE()), util.firstDayOfYear(CURDATE()));
|
||||
|
||||
SET vDateFrom = COALESCE(vDateFrom, util.VN_CURDATE());
|
||||
SET vDateTo = COALESCE(vDateTo, util.VN_CURDATE());
|
||||
|
||||
IF DATEDIFF(vDateTo, vDateFrom) > vDaysInYear THEN
|
||||
CALL util.throw('The period cannot be longer than one year');
|
||||
END IF;
|
||||
|
||||
IF vDateTo IS NULL THEN
|
||||
SET vDateTo = vDateFrom + INTERVAL 6 DAY;
|
||||
END IF;
|
||||
-- Obtiene el primer día de la semana de esa fecha
|
||||
SET vDateFrom = DATE_SUB(vDateFrom, INTERVAL ((WEEKDAY(vDateFrom) + 1) % 7) DAY);
|
||||
|
||||
-- Obtiene el último día de la semana de esa fecha
|
||||
SET vDateTo = DATE_ADD(vDateTo, INTERVAL (6 - ((WEEKDAY(vDateTo) + 1) % 7)) DAY);
|
||||
|
||||
CALL cache.last_buy_refresh(FALSE);
|
||||
|
||||
REPLACE bs.waste
|
||||
SELECT YEAR(t.shipped),
|
||||
WEEK(t.shipped, 4),
|
||||
SELECT YEARWEEK(t.shipped, 6) DIV 100,
|
||||
WEEK(t.shipped, 6),
|
||||
it.workerFk,
|
||||
it.id,
|
||||
s.itemFk,
|
||||
|
@ -6307,9 +6315,9 @@ BEGIN
|
|||
JOIN cache.last_buy lb ON lb.item_id = i.id
|
||||
AND lb.warehouse_id = w.id
|
||||
JOIN vn.buy b ON b.id = lb.buy_id
|
||||
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
|
||||
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDateTo)
|
||||
AND w.isManaged
|
||||
GROUP BY YEAR(t.shipped), WEEK(t.shipped, 4), i.id;
|
||||
GROUP BY YEARWEEK(t.shipped, 6) DIV 100, WEEK(t.shipped, 6), i.id;
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -13807,7 +13815,7 @@ BEGIN
|
|||
) INTO vHas0Amount;
|
||||
|
||||
IF vHas0Amount THEN
|
||||
CALL util.throw('Hay líneas vacías. Por favor, elimínelas');
|
||||
CALL util.throw('orderLinesWithZero');
|
||||
END IF;
|
||||
|
||||
START TRANSACTION;
|
||||
|
@ -28922,6 +28930,7 @@ CREATE TABLE `country` (
|
|||
`isSocialNameUnique` tinyint(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `country_unique` (`code`),
|
||||
UNIQUE KEY `country_unique_name` (`name`),
|
||||
KEY `currency_id_fk_idx` (`currencyFk`),
|
||||
KEY `country_Ix4` (`name`),
|
||||
KEY `continent_id_fk_idx` (`continentFk`),
|
||||
|
@ -31971,6 +31980,7 @@ CREATE TABLE `item` (
|
|||
`value12` varchar(50) DEFAULT NULL,
|
||||
`tag13` varchar(20) DEFAULT NULL,
|
||||
`value13` varchar(50) DEFAULT NULL,
|
||||
`isCustomInspectionRequired` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Indicates if the item requires physical inspection at customs',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `item_supplyResponseFk_idx` (`supplyResponseFk`),
|
||||
KEY `Color` (`inkFk`),
|
||||
|
@ -68661,10 +68671,11 @@ BEGIN
|
|||
TRUE,
|
||||
sc.userFk,
|
||||
s.id
|
||||
FROM vn.sectorCollection sc
|
||||
JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id
|
||||
JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk
|
||||
JOIN vn.state s ON s.code = 'OK PREVIOUS'
|
||||
FROM sectorCollection sc
|
||||
JOIN sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id
|
||||
JOIN saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk
|
||||
JOIN state s ON s.code = 'OK PREVIOUS'
|
||||
JOIN itemShelvingSale iss ON iss.saleFk = sgd.saleFk
|
||||
WHERE sc.id = vSectorCollectionFk;
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
|
@ -90882,4 +90893,4 @@ USE `vn2008`;
|
|||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-01-07 6:51:38
|
||||
-- Dump completed on 2025-01-14 6:39:04
|
||||
|
|
|
@ -11499,4 +11499,4 @@ USE `vn2008`;
|
|||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-01-07 6:51:57
|
||||
-- Dump completed on 2025-01-14 6:39:25
|
||||
|
|
|
@ -10,18 +10,26 @@ BEGIN
|
|||
* @param vDateFrom Fecha desde
|
||||
* @param vDateTo Fecha hasta
|
||||
*/
|
||||
IF vDateFrom IS NULL THEN
|
||||
SET vDateFrom = util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY;
|
||||
DECLARE vDaysInYear INT;
|
||||
SET vDaysInYear = DATEDIFF(util.lastDayOfYear(CURDATE()), util.firstDayOfYear(CURDATE()));
|
||||
|
||||
SET vDateFrom = COALESCE(vDateFrom, util.VN_CURDATE());
|
||||
SET vDateTo = COALESCE(vDateTo, util.VN_CURDATE());
|
||||
|
||||
IF DATEDIFF(vDateTo, vDateFrom) > vDaysInYear THEN
|
||||
CALL util.throw('The period cannot be longer than one year');
|
||||
END IF;
|
||||
|
||||
IF vDateTo IS NULL THEN
|
||||
SET vDateTo = vDateFrom + INTERVAL 6 DAY;
|
||||
END IF;
|
||||
-- Obtiene el primer día de la semana de esa fecha
|
||||
SET vDateFrom = DATE_SUB(vDateFrom, INTERVAL ((WEEKDAY(vDateFrom) + 1) % 7) DAY);
|
||||
|
||||
-- Obtiene el último día de la semana de esa fecha
|
||||
SET vDateTo = DATE_ADD(vDateTo, INTERVAL (6 - ((WEEKDAY(vDateTo) + 1) % 7)) DAY);
|
||||
|
||||
CALL cache.last_buy_refresh(FALSE);
|
||||
|
||||
REPLACE bs.waste
|
||||
SELECT YEAR(t.shipped),
|
||||
SELECT YEARWEEK(t.shipped, 6) DIV 100,
|
||||
WEEK(t.shipped, 6),
|
||||
it.workerFk,
|
||||
it.id,
|
||||
|
@ -68,8 +76,8 @@ BEGIN
|
|||
JOIN cache.last_buy lb ON lb.item_id = i.id
|
||||
AND lb.warehouse_id = w.id
|
||||
JOIN vn.buy b ON b.id = lb.buy_id
|
||||
WHERE t.shipped BETWEEN vDateFrom AND vDateTo
|
||||
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDateTo)
|
||||
AND w.isManaged
|
||||
GROUP BY YEAR(t.shipped), WEEK(t.shipped, 6), i.id;
|
||||
GROUP BY YEARWEEK(t.shipped, 6) DIV 100, WEEK(t.shipped, 6), i.id;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -16,10 +16,11 @@ BEGIN
|
|||
TRUE,
|
||||
sc.userFk,
|
||||
s.id
|
||||
FROM vn.sectorCollection sc
|
||||
JOIN vn.sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id
|
||||
JOIN vn.saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk
|
||||
JOIN vn.state s ON s.code = 'OK PREVIOUS'
|
||||
FROM sectorCollection sc
|
||||
JOIN sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id
|
||||
JOIN saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk
|
||||
JOIN state s ON s.code = 'OK PREVIOUS'
|
||||
JOIN itemShelvingSale iss ON iss.saleFk = sgd.saleFk
|
||||
WHERE sc.id = vSectorCollectionFk;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -3,10 +3,12 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`workerTimeControl_after
|
|||
AFTER DELETE ON `workerTimeControl`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO workerLog
|
||||
SET `action` = 'delete',
|
||||
`changedModel` = 'WorkerTimeControl',
|
||||
`changedModelId` = OLD.id,
|
||||
`userFk` = account.myUser_getId();
|
||||
IF account.myUser_getId() IS NOT NULL THEN
|
||||
INSERT INTO workerLog
|
||||
SET `action` = 'delete',
|
||||
`changedModel` = 'WorkerTimeControl',
|
||||
`changedModelId` = OLD.id,
|
||||
`userFk` = account.myUser_getId();
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
DELETE FROM salix.ACL WHERE property = 'canCreateAbsenceInPast';
|
||||
|
||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
||||
VALUES ('Worker','canModifyAbsenceInPast','WRITE','ALLOW','ROLE','hr');
|
|
@ -211,6 +211,7 @@
|
|||
"Name should be uppercase": "Name should be uppercase",
|
||||
"You cannot update these fields": "You cannot update these fields",
|
||||
"CountryFK cannot be empty": "Country cannot be empty",
|
||||
"No tickets to invoice": "There are no tickets to invoice that meet the invoicing requirements",
|
||||
"You are not allowed to modify the alias": "You are not allowed to modify the alias",
|
||||
"You already have the mailAlias": "You already have the mailAlias",
|
||||
"This machine is already in use.": "This machine is already in use.",
|
||||
|
@ -251,4 +252,4 @@
|
|||
"Price cannot be blank": "Price cannot be blank",
|
||||
"There are tickets to be invoiced": "There are tickets to be invoiced",
|
||||
"The address of the customer must have information about Incoterms and Customs Agent": "The address of the customer must have information about Incoterms and Customs Agent"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,7 +339,7 @@
|
|||
"Incorrect pin": "Pin incorrecto.",
|
||||
"You already have the mailAlias": "Ya tienes este alias de correo",
|
||||
"The alias cant be modified": "Este alias de correo no puede ser modificado",
|
||||
"No tickets to invoice": "No hay tickets para facturar",
|
||||
"No tickets to invoice": "No hay tickets para facturar que cumplan los requisitos de facturación",
|
||||
"this warehouse has not dms": "El Almacén no acepta documentos",
|
||||
"This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
|
||||
"Name should be uppercase": "El nombre debe ir en mayúscula",
|
||||
|
|
|
@ -339,7 +339,7 @@
|
|||
"Incorrect pin": "Pin incorrect.",
|
||||
"You already have the mailAlias": "Vous avez déjà cet alias de courrier",
|
||||
"The alias cant be modified": "Cet alias de courrier ne peut pas être modifié",
|
||||
"No tickets to invoice": "Pas de tickets à facturer",
|
||||
"No tickets to invoice": "Il n'y a pas de tickets à facturer qui répondent aux exigences de facturation",
|
||||
"this warehouse has not dms": "L'entrepôt n'accepte pas les documents",
|
||||
"This ticket already has a cmr saved": "Ce ticket a déjà un cmr enregistré",
|
||||
"Name should be uppercase": "Le nom doit être en majuscules",
|
||||
|
|
|
@ -339,7 +339,7 @@
|
|||
"Incorrect pin": "PIN incorreto.",
|
||||
"You already have the mailAlias": "Você já tem o alias de e-mail",
|
||||
"The alias cant be modified": "O alias não pode ser modificado",
|
||||
"No tickets to invoice": "Não há tickets para faturar",
|
||||
"No tickets to invoice": "Não há bilhetes para faturar que atendam aos requisitos de faturamento",
|
||||
"this warehouse has not dms": "Este armazém não tem DMS",
|
||||
"This ticket already has a cmr saved": "Este ticket já tem um CMR salvo",
|
||||
"Name should be uppercase": "O nome deve estar em maiúsculas",
|
||||
|
|
|
@ -49,12 +49,6 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
try {
|
||||
const clientCanBeInvoiced =
|
||||
await Self.app.models.Client.canBeInvoiced(clientId, companyFk, myOptions);
|
||||
|
||||
if (!clientCanBeInvoiced)
|
||||
throw new UserError(`This client can't be invoiced`);
|
||||
|
||||
const vIsAllInvoiceable = false;
|
||||
await Self.rawSql('CALL ticketPackaging_add(?, ?, ?, ?)', [
|
||||
clientId,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
describe('InvoiceOut clientsToInvoice()', () => {
|
||||
const userId = 1;
|
||||
|
@ -20,6 +21,21 @@ describe('InvoiceOut clientsToInvoice()', () => {
|
|||
headers: {origin: 'http://localhost'}
|
||||
};
|
||||
const ctx = {req: activeCtx};
|
||||
let tx;
|
||||
let options;
|
||||
|
||||
beforeEach(async() => {
|
||||
LoopBackContext.getCurrentContext = () => ({
|
||||
active: activeCtx,
|
||||
});
|
||||
|
||||
tx = await models.InvoiceOut.beginTransaction({});
|
||||
options = {transaction: tx};
|
||||
});
|
||||
|
||||
afterEach(async() => {
|
||||
await tx.rollback();
|
||||
});
|
||||
|
||||
it('should return a list of clients to invoice', async() => {
|
||||
spyOn(models.InvoiceOut, 'rawSql').and.callFake(query => {
|
||||
|
@ -37,24 +53,14 @@ describe('InvoiceOut clientsToInvoice()', () => {
|
|||
}
|
||||
});
|
||||
|
||||
const tx = await models.InvoiceOut.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
const addresses = await models.InvoiceOut.clientsToInvoice(
|
||||
ctx, clientId, invoiceDate, maxShipped, companyFk, options);
|
||||
|
||||
try {
|
||||
const addresses = await models.InvoiceOut.clientsToInvoice(
|
||||
ctx, clientId, invoiceDate, maxShipped, companyFk, options);
|
||||
|
||||
expect(addresses.length).toBeGreaterThan(0);
|
||||
expect(addresses[0].clientId).toBe(clientId);
|
||||
expect(addresses[0].clientName).toBe('Test Client');
|
||||
expect(addresses[0].id).toBe(1);
|
||||
expect(addresses[0].nickname).toBe('Address 1');
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
expect(addresses.length).toBeGreaterThan(0);
|
||||
expect(addresses[0].clientId).toBe(clientId);
|
||||
expect(addresses[0].clientName).toBe('Test Client');
|
||||
expect(addresses[0].id).toBe(1);
|
||||
expect(addresses[0].nickname).toBe('Address 1');
|
||||
});
|
||||
|
||||
it('should handle errors and rollback transaction', async() => {
|
||||
|
@ -62,14 +68,20 @@ describe('InvoiceOut clientsToInvoice()', () => {
|
|||
return Promise.reject(new Error('Test Error'));
|
||||
});
|
||||
|
||||
const tx = await models.InvoiceOut.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
await models.InvoiceOut.clientsToInvoice(ctx, clientId, invoiceDate, maxShipped, companyFk, options);
|
||||
} catch (e) {
|
||||
expect(e.message).toBe('Test Error');
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
|
||||
it('should return all list', async() => {
|
||||
const minShipped = Date.vnNew();
|
||||
minShipped.setFullYear(maxShipped.getFullYear() - 1);
|
||||
|
||||
const toInvoice = await models.InvoiceOut.clientsToInvoice(
|
||||
ctx, null, invoiceDate, maxShipped, companyFk, options);
|
||||
|
||||
expect(toInvoice).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
|||
Object.assign(myOptions, options);
|
||||
|
||||
const query =
|
||||
`SELECT DISTINCT u.id, u.nickname
|
||||
`SELECT DISTINCT u.id, u.nickname, w.firstName, w.lastName
|
||||
FROM itemType it
|
||||
JOIN worker w ON w.id = it.workerFk
|
||||
JOIN account.user u ON u.id = w.id`;
|
||||
|
|
|
@ -58,12 +58,10 @@ module.exports = Self => {
|
|||
if (!isSubordinate || (isSubordinate && userId == id && !isTeamBoss))
|
||||
throw new UserError(`You don't have enough privileges`);
|
||||
|
||||
const canCreateAbsenceInPast =
|
||||
await models.ACL.checkAccessAcl(ctx, 'Worker', 'canCreateAbsenceInPast', 'WRITE');
|
||||
const now = Date.vnNew();
|
||||
const newDate = new Date(args.dated).getTime();
|
||||
|
||||
if ((now.getTime() > newDate) && !canCreateAbsenceInPast)
|
||||
if (!await Self.canModifyAbsenceInPast(ctx, newDate))
|
||||
throw new UserError(`Holidays to past days not available`);
|
||||
|
||||
const labour = await models.WorkerLabour.findById(args.businessFk,
|
||||
|
|
|
@ -53,6 +53,10 @@ module.exports = Self => {
|
|||
}
|
||||
}
|
||||
}, myOptions);
|
||||
|
||||
if (!await Self.canModifyAbsenceInPast(ctx, absence.dated.getTime()))
|
||||
throw new UserError(`Holidays to past days not available`);
|
||||
|
||||
const result = await absence.destroy(myOptions);
|
||||
const labour = absence.labour();
|
||||
const department = labour && labour.department();
|
||||
|
|
|
@ -4,6 +4,8 @@ const LoopBackContext = require('loopback-context');
|
|||
describe('Worker deleteAbsence()', () => {
|
||||
const businessId = 18;
|
||||
const workerId = 18;
|
||||
const hrId = 37;
|
||||
const salesBossId = 19;
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 1106},
|
||||
headers: {origin: 'http://localhost'}
|
||||
|
@ -50,16 +52,16 @@ describe('Worker deleteAbsence()', () => {
|
|||
});
|
||||
|
||||
it('should successfully delete an absence', async() => {
|
||||
activeCtx.accessToken.userId = 19;
|
||||
activeCtx.accessToken.userId = salesBossId;
|
||||
|
||||
const tx = await app.models.Calendar.beginTransaction({});
|
||||
|
||||
const pastDate = new Date(Date.vnNow() + 24 * 60 * 60 * 1000);
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const createdAbsence = await app.models.Calendar.create({
|
||||
businessFk: businessId,
|
||||
dayOffTypeFk: 1,
|
||||
dated: Date.vnNew()
|
||||
dated: pastDate
|
||||
}, options);
|
||||
|
||||
ctx.args = {absenceId: createdAbsence.id};
|
||||
|
@ -76,4 +78,61 @@ describe('Worker deleteAbsence()', () => {
|
|||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should successfully delete an absence if the user is HR even if the date is in the past', async() => {
|
||||
activeCtx.accessToken.userId = hrId;
|
||||
const tx = await app.models.Calendar.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const pastDate = new Date(Date.vnNow() - 24 * 60 * 60 * 1000); // Restar un día
|
||||
const createdAbsence = await app.models.Calendar.create({
|
||||
businessFk: businessId,
|
||||
dayOffTypeFk: 1,
|
||||
dated: pastDate
|
||||
}, options);
|
||||
|
||||
ctx.args = {absenceId: createdAbsence.id};
|
||||
await app.models.Worker.deleteAbsence(ctx, workerId, options);
|
||||
|
||||
const deletedAbsence = await app.models.Calendar.findById(createdAbsence.id, null, options);
|
||||
|
||||
expect(deletedAbsence).toBeNull();
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should throw an error if the date is in the past', async() => {
|
||||
activeCtx.accessToken.userId = salesBossId;
|
||||
const tx = await app.models.Calendar.beginTransaction({});
|
||||
|
||||
let error;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const pastDate = new Date(Date.vnNow() - 24 * 60 * 60 * 1000);
|
||||
const createdAbsence = await app.models.Calendar.create({
|
||||
businessFk: businessId,
|
||||
dayOffTypeFk: 1,
|
||||
dated: pastDate
|
||||
}, options);
|
||||
|
||||
ctx.args = {absenceId: createdAbsence.id};
|
||||
await app.models.Worker.deleteAbsence(ctx, workerId, options);
|
||||
|
||||
const deletedAbsence = await app.models.Calendar.findById(createdAbsence.id, null, options);
|
||||
|
||||
expect(deletedAbsence).toBeNull();
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
error = e;
|
||||
}
|
||||
|
||||
expect(error.message).toBe('Holidays to past days not available');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -26,6 +26,13 @@ module.exports = Self => {
|
|||
message: 'Invalid TIN'
|
||||
});
|
||||
|
||||
Self.canModifyAbsenceInPast = async(ctx, time) => {
|
||||
const hasPrivs = await Self.app.models.ACL.checkAccessAcl(ctx, 'Worker', 'canModifyAbsenceInPast', 'WRITE');
|
||||
const today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
return hasPrivs || today.getTime() < time;
|
||||
};
|
||||
|
||||
async function tinIsValid(err, done) {
|
||||
const country = await Self.app.models.Country.findOne({
|
||||
fields: ['code'],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
html {
|
||||
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
||||
margin-top: -7px;
|
||||
font-size: 28px;
|
||||
font-size: 20px;
|
||||
}
|
||||
table {
|
||||
border: 1px solid;
|
||||
|
@ -10,22 +10,22 @@ table {
|
|||
}
|
||||
td {
|
||||
border: 1px solid;
|
||||
padding: 5px;
|
||||
padding: 2px;
|
||||
width: 100%;
|
||||
}
|
||||
span {
|
||||
font-size: 48px;
|
||||
font-size: 34px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.lbl {
|
||||
color: gray;
|
||||
font-weight: lighter;
|
||||
font-size: 18px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
}
|
||||
.cell {
|
||||
width: 157px;
|
||||
height: 50px;
|
||||
height: 35px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
async serverPrefetch() {
|
||||
const buy = await models.Buy.findById(this.id, null);
|
||||
this.buys = await this.rawSqlFromDef('buy', [buy.entryFk, buy.entryFk, buy.entryFk, this.id, this.id]);
|
||||
const date = new Date();
|
||||
const date = Date.vnNew();
|
||||
this.weekNum = moment(date).isoWeek();
|
||||
this.dayNum = moment(date).day();
|
||||
},
|
||||
|
@ -24,7 +24,8 @@ module.exports = {
|
|||
format: 'code128',
|
||||
displayValue: false,
|
||||
width: 3.8,
|
||||
height: 115,
|
||||
height: 60,
|
||||
margin: 3,
|
||||
});
|
||||
return new XMLSerializer().serializeToString(svgNode);
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"width": "10cm",
|
||||
"height": "10cm",
|
||||
"height": "6.5cm",
|
||||
"margin": {
|
||||
"top": "0.17cm",
|
||||
"right": "0.2cm",
|
||||
|
|
Loading…
Reference in New Issue