#5926 - Worker/PDA docuware #2482

Open
jsegarra wants to merge 40 commits from 5926_pda_worker_docuware into dev
6 changed files with 27 additions and 17 deletions
Showing only changes of commit 0ffbe75a01 - Show all commits

View File

@ -43,7 +43,7 @@ module.exports = Self => {
...data.getHeaders()
},
};
return uploadOptions;
return {data, uploadOptions};
};
/**

View File

@ -46,7 +46,8 @@ module.exports = Self => {
throw new UserError('This user does not have an assigned tablet');
const docuwareOptions = await Self.getOptions();
const {modelFk} = await Self.getDocuware({where: {code: fileCabinet, action}});
const docuware = await Self.getDocuware({where: {code: fileCabinet, action}});
const {modelFk, fileCabinetName} = docuware;
const modelIsValid = await Self.app.models.Module.findOne({where: {code: modelFk}});
if (!modelIsValid)
@ -54,13 +55,13 @@ module.exports = Self => {
const model = modelFk.replace(/^.{1}/g, modelFk[0].toUpperCase());
const fileCabinetId = await Self.getFileCabinet(fileCabinet);
const dialogId = await Self.getDialog(fileCabinet, action, fileCabinetId);
const fileCabinetId = await Self.getFileCabinet(fileCabinetName);
const dialogId = await Self.getDialog(fileCabinetName, action, fileCabinetId);
const uri = `${docuwareOptions.url}/FileCabinets/${fileCabinetId}/Documents`;
const uri = `${docuwareOptions.url}/FileCabinets/${fileCabinetName}/Documents`;
if (!isProduction(false))
throw new UserError('Action not allowed on the test environment');
// if (!isProduction(false))
// throw new UserError('Action not allowed on the test environment');
const upload = {ctx, tabletFk, ids, myOptions, uri, fileCabinet, fileCabinetId, dialogId};
await Self.app.models[model].docuwareUpload(upload);

View File

@ -2748,7 +2748,7 @@ INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`)
INSERT INTO `vn`.`docuwareConfig` (`id`, `url`)
VALUES
(1, 'http://docuware.url/');
(1, 'http://docuware.url');
INSERT INTO `vn`.`calendarHolidaysName` (`id`, `name`)
VALUES
@ -3101,6 +3101,11 @@ INSERT INTO `vn`.`docuwareTablet` (`tablet`,`description`)
('Tablet1','Jarvis tablet'),
('Tablet2','Avengers tablet');
-- Auto-generated SQL script #202406060955
INSERT INTO `vn`.`docuwareTablet` (`tablet`,`description`,`fileCabinet`)
VALUES ('Tablet4','Docuware Tablet','RRHH');
INSERT INTO `vn`.`sms` (`id`, `senderFk`, `sender`, `destination`, `message`, `statusCode`, `status`, `created`)
VALUES (1, 66, '111111111', '0001111111111', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'OK', util.VN_CURDATE()),
(2, 66, '222222222', '0002222222222', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'PENDING', util.VN_CURDATE()),
@ -3829,8 +3834,8 @@ INSERT INTO `vn`.`ledgerConfig` SET
-- Auto-generated SQL script #202405201318
UPDATE vn.userConfig
SET tabletFk='Tablet1'
WHERE userFk=9;
SET tabletFk='Tablet4'
WHERE userFk=5;
-- Auto-generated SQL script #202405201207
UPDATE vn.docuware
@ -3884,3 +3889,6 @@ INSERT INTO vn.sectorCollectionSaleGroup
SET id = 9,
sectorCollectionFk = 3,
saleGroupFk = 6;
-- Auto-generated SQL script #202406061004
INSERT INTO vn.userConfig (userFk,warehouseFk,companyFk,darkMode,tabletFk)
VALUES (37,1,442,1,'Tablet4');

View File

@ -6,8 +6,9 @@ ALTER TABLE vn.docuwareTablet ADD fileCabinet varchar(100) NULL;
-- Auto-generated SQL script #202405221107
-- Auto-generated SQL script #202405201951
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Worker','isPDASigned','READ','ALLOW','ROLE','hr');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Worker','signPdaPdf','READ','ALLOW','ROLE','hr');
-- Auto-generated SQL script #202406061008
jsegarra marked this conversation as resolved
Review

quitar

quitar
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Docuware','upload','WRITE','ALLOW','ROLE','hr');

View File

@ -70,7 +70,7 @@ module.exports = Self => {
await models.Docuware.deleteOld(id, fileCabinet, uri);
const uploadUri = `${uri}?StoreDialogId=${dialogId}`;
const uploadOptions = models.Docuware.uploadOptions(deliveryNote[0], configTemplate);
const {data, uploadOptions} = models.Docuware.uploadOptions(deliveryNote[0], configTemplate);
try {
await axios.post(uploadUri, data, uploadOptions);

View File

@ -33,14 +33,14 @@ module.exports = Self => {
}
};
if (!isProduction(false))
throw new UserError('Action not allowed on the test environment');
// if (!isProduction(false))
// throw new UserError('Action not allowed on the test environment');
// delete old
await models.Docuware.deleteOld(id, fileCabinet, uri);
const uploadUri = `${uri}?StoreDialogId=${dialogId}`;
const uploadOptions = models.Docuware.uploadOptions(signPda[0], configTemplate);
const {data, uploadOptions} = await models.Docuware.uploadOptions(signPda[0], configTemplate);
try {
await axios.post(uploadUri, data, uploadOptions);