8524-devToTest #3415

Merged
alexm merged 343 commits from 8524-devToTest into test 2025-02-04 13:42:16 +00:00
5 changed files with 5 additions and 18 deletions
Showing only changes of commit f68f62543d - Show all commits

View File

@ -1,5 +1,5 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`entry_transfer`( CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_transfer`(
vOriginalEntry INT, vOriginalEntry INT,
OUT vNewEntryFk INT OUT vNewEntryFk INT
) )

View File

@ -0,0 +1,2 @@
INSERT IGNORE INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES('Entry', 'transfer', 'WRITE', 'ALLOW', 'ROLE', 'coolerBoss');

View File

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

View File

@ -1,6 +1,7 @@
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('transfer', { Self.remoteMethodCtx('transfer', {
description: 'Transfer merchandise from one entry to the next day', description: 'Transfer merchandise from one entry to the next day',
accessType: 'WRITE',
accepts: [ accepts: [
{ {
arg: 'id', arg: 'id',

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();
}
}; };