Merge branch 'dev' into 7346

This commit is contained in:
Javi Gallego 2024-08-14 12:19:40 +02:00
commit f21c292e20
17 changed files with 110 additions and 97 deletions

View File

@ -24,6 +24,10 @@ module.exports = Self => {
arg: 'lang', arg: 'lang',
type: 'string', type: 'string',
description: 'The user lang' description: 'The user lang'
}, {
arg: 'twoFactor',
type: 'string',
description: 'The user twoFactor'
} }
], ],
http: { http: {
@ -32,8 +36,8 @@ module.exports = Self => {
} }
}); });
Self.updateUser = async(ctx, id, name, nickname, email, lang) => { Self.updateUser = async(ctx, id, name, nickname, email, lang, twoFactor) => {
await Self.userSecurity(ctx, id); await Self.userSecurity(ctx, id);
await Self.upsertWithWhere({id}, {name, nickname, email, lang}); await Self.upsertWithWhere({id}, {name, nickname, email, lang, twoFactor});
}; };
}; };

View File

@ -101,9 +101,10 @@ module.exports = function(Self) {
const headers = httpRequest.headers; const headers = httpRequest.headers;
const origin = headers.origin; const origin = headers.origin;
const defaultHash = '/reset-password?access_token=$token$'; const defaultHash = '!/reset-password?access_token=$token$';
const recoverHashes = { const recoverHashes = {
hedera: 'verificationToken=$token$' hedera: '!verificationToken=$token$',
lilium: '/resetPassword?access_token=$token$'
}; };
const app = info.options?.app; const app = info.options?.app;
@ -115,7 +116,7 @@ module.exports = function(Self) {
const params = { const params = {
recipient: info.email, recipient: info.email,
lang: user.lang, lang: user.lang,
url: origin + '/#!' + recoverHash url: origin + '/#' + recoverHash
}; };
const options = Object.assign({}, info.options); const options = Object.assign({}, info.options);

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_afterDelete`
AFTER DELETE ON `ACL` AFTER DELETE ON `ACL`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
INSERT INTO ACL INSERT INTO ACLLog
SET `action` = 'delete', SET `action` = 'delete',
`changedModel` = 'Acl', `changedModel` = 'Acl',
`changedModelId` = OLD.id, `changedModelId` = OLD.id,

View File

@ -189,7 +189,7 @@ BEGIN
SELECT * FROM sales SELECT * FROM sales
UNION ALL UNION ALL
SELECT * FROM orders SELECT * FROM orders
ORDER BY shipped, ORDER BY shipped DESC,
(inventorySupplierFk = entityId) DESC, (inventorySupplierFk = entityId) DESC,
alertLevel DESC, alertLevel DESC,
isTicket, isTicket,

View File

@ -4,7 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`
vDateTo DATE vDateTo DATE
) )
BEGIN BEGIN
DECLARE vIsDone BOOL;
DECLARE vLanding DATE; DECLARE vLanding DATE;
DECLARE vShipment DATE; DECLARE vShipment DATE;
DECLARE vWarehouseFk INT; DECLARE vWarehouseFk INT;
@ -15,36 +14,37 @@ BEGIN
DECLARE vAgencyModeFk INT; DECLARE vAgencyModeFk INT;
DECLARE vNewTicket INT; DECLARE vNewTicket INT;
DECLARE vYear INT; DECLARE vYear INT;
DECLARE vSalesPersonFK INT; DECLARE vObservationSalesPersonFk INT
DECLARE vItemPicker INT; DEFAULT (SELECT id FROM observationType WHERE code = 'salesPerson');
DECLARE vObservationItemPickerFk INT
DEFAULT (SELECT id FROM observationType WHERE code = 'itemPicker');
DECLARE vEmail VARCHAR(255);
DECLARE vIsDuplicateMail BOOL;
DECLARE vSubject VARCHAR(100);
DECLARE vMessage TEXT;
DECLARE vDone BOOL;
DECLARE rsTicket CURSOR FOR DECLARE vTickets CURSOR FOR
SELECT tt.ticketFk, SELECT tt.ticketFk,
t.clientFk, t.clientFk,
t.warehouseFk, t.warehouseFk,
t.companyFk, t.companyFk,
t.addressFk, t.addressFk,
tt.agencyModeFk, tt.agencyModeFk,
ti.dated ti.dated
FROM ticketWeekly tt FROM ticketWeekly tt
JOIN ticket t ON tt.ticketFk = t.id JOIN ticket t ON tt.ticketFk = t.id
JOIN tmp.time ti JOIN tmp.time ti
WHERE WEEKDAY(ti.dated) = tt.weekDay; WHERE WEEKDAY(ti.dated) = tt.weekDay;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
CALL `util`.`time_generate`(vDateFrom,vDateTo); CALL `util`.`time_generate`(vDateFrom, vDateTo);
OPEN rsTicket; OPEN vTickets;
myLoop: LOOP l: LOOP
BEGIN SET vDone = FALSE;
DECLARE vSalesPersonEmail VARCHAR(150); FETCH vTickets INTO
DECLARE vIsDuplicateMail BOOL;
DECLARE vSubject VARCHAR(150);
DECLARE vMessage TEXT;
SET vIsDone = FALSE;
FETCH rsTicket INTO
vTicketFk, vTicketFk,
vClientFk, vClientFk,
vWarehouseFk, vWarehouseFk,
@ -53,11 +53,11 @@ BEGIN
vAgencyModeFk, vAgencyModeFk,
vShipment; vShipment;
IF vIsDone THEN IF vDone THEN
LEAVE myLoop; LEAVE l;
END IF; END IF;
-- busca si el ticket ya ha sido clonado -- Busca si el ticket ya ha sido clonado
IF EXISTS (SELECT TRUE FROM ticket tOrig IF EXISTS (SELECT TRUE FROM ticket tOrig
JOIN sale saleOrig ON tOrig.id = saleOrig.ticketFk JOIN sale saleOrig ON tOrig.id = saleOrig.ticketFk
JOIN saleCloned sc ON sc.saleOriginalFk = saleOrig.id JOIN saleCloned sc ON sc.saleOriginalFk = saleOrig.id
@ -67,7 +67,7 @@ BEGIN
AND tClon.isDeleted = FALSE AND tClon.isDeleted = FALSE
AND DATE(tClon.shipped) = vShipment) AND DATE(tClon.shipped) = vShipment)
THEN THEN
ITERATE myLoop; ITERATE l;
END IF; END IF;
IF vAgencyModeFk IS NULL THEN IF vAgencyModeFk IS NULL THEN
@ -107,15 +107,15 @@ BEGIN
priceFixed, priceFixed,
isPriceFixed) isPriceFixed)
SELECT vNewTicket, SELECT vNewTicket,
saleOrig.itemFk, itemFk,
saleOrig.concept, concept,
saleOrig.quantity, quantity,
saleOrig.price, price,
saleOrig.discount, discount,
saleOrig.priceFixed, priceFixed,
saleOrig.isPriceFixed isPriceFixed
FROM sale saleOrig FROM sale
WHERE saleOrig.ticketFk = vTicketFk; WHERE ticketFk = vTicketFk;
INSERT IGNORE INTO saleCloned(saleOriginalFk, saleClonedFk) INSERT IGNORE INTO saleCloned(saleOriginalFk, saleClonedFk)
SELECT saleOriginal.id, saleClon.id SELECT saleOriginal.id, saleClon.id
@ -152,15 +152,7 @@ BEGIN
attenderFk, attenderFk,
vNewTicket vNewTicket
FROM ticketRequest FROM ticketRequest
WHERE ticketFk =vTicketFk; WHERE ticketFk = vTicketFk;
SELECT id INTO vSalesPersonFK
FROM observationType
WHERE code = 'salesPerson';
SELECT id INTO vItemPicker
FROM observationType
WHERE code = 'itemPicker';
INSERT INTO ticketObservation( INSERT INTO ticketObservation(
ticketFk, ticketFk,
@ -168,7 +160,7 @@ BEGIN
description) description)
VALUES( VALUES(
vNewTicket, vNewTicket,
vSalesPersonFK, vObservationSalesPersonFk,
CONCAT('turno desde ticket: ',vTicketFk)) CONCAT('turno desde ticket: ',vTicketFk))
ON DUPLICATE KEY UPDATE description = ON DUPLICATE KEY UPDATE description =
CONCAT(ticketObservation.description,VALUES(description),' '); CONCAT(ticketObservation.description,VALUES(description),' ');
@ -178,16 +170,17 @@ BEGIN
description) description)
VALUES( VALUES(
vNewTicket, vNewTicket,
vItemPicker, vObservationItemPickerFk,
'ATENCION: Contiene lineas de TURNO') 'ATENCION: Contiene lineas de TURNO')
ON DUPLICATE KEY UPDATE description = ON DUPLICATE KEY UPDATE description =
CONCAT(ticketObservation.description,VALUES(description),' '); CONCAT(ticketObservation.description,VALUES(description),' ');
IF (vLanding IS NULL) THEN IF vLanding IS NULL THEN
SELECT IFNULL(d.notificationEmail, e.email) INTO vEmail
SELECT e.email INTO vSalesPersonEmail
FROM client c FROM client c
JOIN account.emailUser e ON e.userFk = c.salesPersonFk JOIN account.emailUser e ON e.userFk = c.salesPersonFk
LEFT JOIN workerDepartment wd ON wd.workerFk = c.salesPersonFk
LEFT JOIN department d ON d.id = wd.departmentFk
WHERE c.id = vClientFk; WHERE c.id = vClientFk;
SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ', SET vSubject = CONCAT('Turnos - No se ha podido clonar correctamente el ticket ',
@ -199,20 +192,21 @@ BEGIN
SELECT COUNT(*) INTO vIsDuplicateMail SELECT COUNT(*) INTO vIsDuplicateMail
FROM mail FROM mail
WHERE receiver = vSalesPersonEmail WHERE receiver = vEmail
AND subject = vSubject; AND subject = vSubject;
IF NOT vIsDuplicateMail THEN IF NOT vIsDuplicateMail THEN
CALL mail_insert(vSalesPersonEmail, NULL, vSubject, vMessage); CALL mail_insert(vEmail, NULL, vSubject, vMessage);
END IF; END IF;
CALL ticket_setState(vNewTicket, 'FIXING'); CALL ticket_setState(vNewTicket, 'FIXING');
ELSE ELSE
CALL ticketCalculateClon(vNewTicket, vTicketFk); CALL ticketCalculateClon(vNewTicket, vTicketFk);
END IF; END IF;
END;
END LOOP; END LOOP;
CLOSE rsTicket; CLOSE vTickets;
DROP TEMPORARY TABLE IF EXISTS tmp.time, tmp.zoneGetLanded;
DROP TEMPORARY TABLE IF EXISTS
tmp.time,
tmp.zoneGetLanded;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`host_beforeInsert`
BEFORE INSERT ON `host`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -4,5 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`host_beforeUpdate`
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
SET new.updated = util.VN_NOW(); SET new.updated = util.VN_NOW();
SET NEW.editorFk = account.myUser_getId();
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.productionConfig
DROP COLUMN scannableCodeType,
DROP COLUMN scannablePreviusCodeType;

View File

@ -0,0 +1 @@
DROP TABLE bi.Greuges_comercial_detail;

View File

@ -0,0 +1 @@
ALTER TABLE vn.host ADD editorFk int(10) unsigned DEFAULT NULL NULL;

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.item
ADD CONSTRAINT item_itemPackingType_FK FOREIGN KEY (itemPackingTypeFk)
REFERENCES vn.itemPackingType(code) ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -0,0 +1,9 @@
ALTER TABLE hedera.tpvMerchantEnable
DROP FOREIGN KEY tpvMerchantEnable_ibfk_1,
DROP PRIMARY KEY,
ADD CONSTRAINT tpvMerchantEnable_pk PRIMARY KEY (merchantFk),
ADD CONSTRAINT tpvMerchantEnable_tpvMerchant_FK
FOREIGN KEY (merchantFk)
REFERENCES hedera.tpvMerchant(id)
ON DELETE RESTRICT
ON UPDATE CASCADE;

View File

@ -0,0 +1,7 @@
name: time control
columns:
direction: direction
isSendMail: sent mail
logExclude: excluded log
manual: manual
timed: timed

View File

@ -0,0 +1,7 @@
name: control horario
columns:
direction: dirección
isSendMail: correo enviado
logExclude: registro excluido
manual: manual
timed: fichada

View File

@ -10,14 +10,10 @@
</td> </td>
<td colspan="2" id="shipped">{{dashIfEmpty(labelData.shipped)}}</td> <td colspan="2" id="shipped">{{dashIfEmpty(labelData.shipped)}}</td>
</tr> </tr>
<tr v-if="labelData?.qrData"> <tr>
<td rowspan="3"><img :src="labelData.qrData" class="qr"/></td> <td rowspan="3"><img :src="labelData.qrData" class="qr"/></td>
<td id="outline" class="ellipsize">{{dashIfEmpty(labelData.workerCode)}}</td> <td id="outline" class="ellipsize">{{dashIfEmpty(labelData.workerCode)}}</td>
</tr> </tr>
<tr v-else>
<td rowspan="3"><div v-html="getBarcode(labelData.ticketFk)" class="basrcode"></div></td>
<td id="outline" class="ellipsize">{{dashIfEmpty(labelData.workerCode)}}</td>
</tr>
<tr> <tr>
<td id="outline" class="ellipsize">{{labelCount || labelData.labelCount || 0}}</td> <td id="outline" class="ellipsize">{{labelCount || labelData.labelCount || 0}}</td>
</tr> </tr>

View File

@ -1,7 +1,5 @@
const {DOMImplementation, XMLSerializer} = require('xmldom');
const vnReport = require('../../../core/mixins/vn-report.js'); const vnReport = require('../../../core/mixins/vn-report.js');
const {toDataURL} = require('qrcode'); const {toDataURL} = require('qrcode');
const jsBarcode = require('jsbarcode');
module.exports = { module.exports = {
name: 'collection-label', name: 'collection-label',
@ -30,11 +28,8 @@ module.exports = {
const labels = await this.rawSqlFromDef('labelsData', [ticketIds]); const labels = await this.rawSqlFromDef('labelsData', [ticketIds]);
const [{scannableCodeType}] = await this.rawSqlFromDef('barcodeType'); for (const labelData of labels)
if (scannableCodeType === 'qr') { labelData.qrData = await this.getQr(labelData?.ticketFk, labelData?.workerFk);
for (const labelData of labels)
labelData.qrData = await this.getQr(labelData?.ticketFk, labelData?.workerFk);
}
this.labelsData = labels; this.labelsData = labels;
this.checkMainEntity(this.labelsData); this.checkMainEntity(this.labelsData);
@ -50,20 +45,6 @@ module.exports = {
}); });
return toDataURL(QRdata, {margin: 0}); return toDataURL(QRdata, {margin: 0});
}, },
getBarcode(id) {
const xmlSerializer = new XMLSerializer();
const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null);
const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
jsBarcode(svgNode, id, {
xmlDocument: document,
format: 'code128',
displayValue: false,
width: 3.8,
height: 115,
});
return xmlSerializer.serializeToString(svgNode);
},
getVertical(labelData) { getVertical(labelData) {
let value; let value;
if (labelData.collectionFk) { if (labelData.collectionFk) {

View File

@ -1,3 +0,0 @@
SELECT scannableCodeType
FROM productionConfig
LIMIT 1