Merge branch '6493-refactorizar-procedimientos-vn2008-parte_2' of https://gitea.verdnatura.es/verdnatura/salix into 6493-refactorizar-procedimientos-vn2008-parte_2
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
022264ffff
|
@ -5,7 +5,9 @@ All notable changes to this project will be documented in this file.
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [24.18.01] - 2024-05-02
|
## [24.20.01] - 2024-05-14
|
||||||
|
|
||||||
|
## [24.18.01] - 2024-05-07
|
||||||
|
|
||||||
## [24.16.01] - 2024-04-18
|
## [24.16.01] - 2024-04-18
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ node {
|
||||||
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
||||||
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
|
RUN_TESTS = !PROTECTED_BRANCH && FROM_GIT
|
||||||
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
|
RUN_BUILD = PROTECTED_BRANCH && FROM_GIT
|
||||||
env.DEBUG = 'strong-remoting:shared-method'
|
// env.DEBUG = 'strong-remoting:shared-method'
|
||||||
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
// https://www.jenkins.io/doc/book/pipeline/jenkinsfile/#using-environment-variables
|
||||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
echo "NODE_NAME: ${env.NODE_NAME}"
|
||||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||||
|
|
|
@ -12,8 +12,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: `/renewToken`,
|
path: `/renewToken`,
|
||||||
verb: 'POST'
|
verb: 'POST'
|
||||||
}
|
},
|
||||||
});
|
accessScopes: ['DEFAULT', 'read:multimedia']});
|
||||||
|
|
||||||
Self.renewToken = async function(ctx) {
|
Self.renewToken = async function(ctx) {
|
||||||
const {accessToken: token} = ctx.req;
|
const {accessToken: token} = ctx.req;
|
||||||
|
|
|
@ -2617,7 +2617,7 @@ INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amo
|
||||||
|
|
||||||
UPDATE `vn`.`invoiceIn`
|
UPDATE `vn`.`invoiceIn`
|
||||||
SET isBooked = TRUE
|
SET isBooked = TRUE
|
||||||
WHERE id IN (2, 5, 7, 8, 9, 10);
|
WHERE id IN (5, 7, 8, 9, 10);
|
||||||
|
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE PROCEDURE `tmp`.`ticket_recalc`()
|
CREATE PROCEDURE `tmp`.`ticket_recalc`()
|
||||||
|
|
|
@ -19,10 +19,10 @@ BEGIN
|
||||||
AND a.hasWeightVolumetric
|
AND a.hasWeightVolumetric
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.buysToCheck;
|
DROP TEMPORARY TABLE tmp.buysToCheck;
|
||||||
|
|
||||||
IF hasVolumetricAgency THEN
|
IF hasVolumetricAgency THEN
|
||||||
CALL util.throw('Some purchase line has an item without size or weight per stem in the volumetric agency.');
|
CALL util.throw('Item lacks size/weight in purchase line at agency');
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -9,6 +9,14 @@ BEGIN
|
||||||
DECLARE vCurrencyName VARCHAR(25);
|
DECLARE vCurrencyName VARCHAR(25);
|
||||||
DECLARE vComission INT;
|
DECLARE vComission INT;
|
||||||
|
|
||||||
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
ROLLBACK;
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
|
START TRANSACTION;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.recalcEntryCommision
|
CREATE OR REPLACE TEMPORARY TABLE tmp.recalcEntryCommision
|
||||||
SELECT e.id
|
SELECT e.id
|
||||||
FROM vn.entry e
|
FROM vn.entry e
|
||||||
|
@ -28,12 +36,15 @@ BEGIN
|
||||||
WHERE id = vCurrency;
|
WHERE id = vCurrency;
|
||||||
|
|
||||||
CALL entry_recalc();
|
CALL entry_recalc();
|
||||||
|
|
||||||
|
COMMIT;
|
||||||
|
|
||||||
SELECT util.notification_send(
|
SELECT util.notification_send(
|
||||||
'entry-update-comission',
|
'entry-update-comission',
|
||||||
JSON_OBJECT('currencyName', vCurrencyName, 'referenceCurrent', vComission),
|
JSON_OBJECT('currencyName', vCurrencyName, 'referenceCurrent', vComission),
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.recalcEntryCommision;
|
DROP TEMPORARY TABLE tmp.recalcEntryCommision;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`recipe_Cook`(vItemFk INT, vBunchesQuantity INT, vDate DATE)
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
DECLARE vCalc INT;
|
|
||||||
DECLARE vWarehouseFk INT DEFAULT 1; -- Silla FV
|
|
||||||
|
|
||||||
SET @element := '';
|
|
||||||
SET @counter := 0;
|
|
||||||
|
|
||||||
CALL cache.available_refresh(vCalc, FALSE, vWarehouseFk, vDate);
|
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.recipeCook;
|
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tmp.recipeCook
|
|
||||||
SELECT *,
|
|
||||||
@counter := IF(@element = element COLLATE utf8_general_ci , @counter + 1, 1) as counter,
|
|
||||||
@element := element COLLATE utf8_general_ci
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT i.id itemFk,
|
|
||||||
CONCAT(i.longName, ' (ref: ',i.id,')') longName,
|
|
||||||
i.size,
|
|
||||||
i.inkFk,
|
|
||||||
a.available,
|
|
||||||
r.element,
|
|
||||||
vBunchesQuantity * r.quantity as quantity,
|
|
||||||
r.itemFk as bunchItemFk,
|
|
||||||
IFNULL((i.inkFk = r.inkFk ) ,0)
|
|
||||||
+ IFNULL((i.size = r.size) ,0)
|
|
||||||
+ IFNULL((i.name LIKE CONCAT('%',r.name,'%')) ,0)
|
|
||||||
+ IFNULL((i.longName LIKE CONCAT('%',r.longName,'%')),0)
|
|
||||||
+ IFNULL((i.typeFk = r.typeFk),0) as matches,
|
|
||||||
i.typeFk,
|
|
||||||
rl.previousSelected
|
|
||||||
FROM vn.recipe r
|
|
||||||
JOIN vn.item i ON (IFNULL(i.name LIKE CONCAT('%',r.name,'%'), 0)
|
|
||||||
OR IFNULL(i.longName LIKE CONCAT('%',r.longName,'%'),0))
|
|
||||||
OR i.typeFk <=> r.typeFk
|
|
||||||
JOIN cache.available a ON a.item_id = i.id AND a.calc_id = vCalc
|
|
||||||
LEFT JOIN (SELECT recipe_ItemFk, element as log_element, selected_ItemFk, count(*) as previousSelected
|
|
||||||
FROM vn.recipe_log
|
|
||||||
GROUP BY recipe_ItemFk, element, selected_ItemFk) rl ON rl.recipe_ItemFk = r.itemFk
|
|
||||||
AND rl.log_element = r.element
|
|
||||||
AND rl.selected_ItemFk = i.id
|
|
||||||
WHERE r.itemFk = vItemFk
|
|
||||||
AND a.available > vBunchesQuantity * r.quantity
|
|
||||||
UNION ALL
|
|
||||||
SELECT 100 itemFk,
|
|
||||||
CONCAT('? ',r.element,' ',IFNULL(r.size,''),' ',IFNULL(r.inkFk,'')) as longName,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
r.element,
|
|
||||||
vBunchesQuantity * r.quantity as quantity,
|
|
||||||
r.itemFk as bunchItemFk,
|
|
||||||
-1 as matches,
|
|
||||||
r.typeFk,
|
|
||||||
NULL
|
|
||||||
FROM vn.recipe r
|
|
||||||
WHERE r.itemFk = vItemFk
|
|
||||||
GROUP BY r.element
|
|
||||||
) sub
|
|
||||||
|
|
||||||
ORDER BY element, matches DESC, previousSelected DESC;
|
|
||||||
|
|
||||||
SELECT *
|
|
||||||
FROM tmp.recipeCook
|
|
||||||
WHERE counter < 6
|
|
||||||
OR itemFk = 100
|
|
||||||
;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
CREATE OR REPLACE TABLE `vn`.`farmingDeliveryNote` (
|
||||||
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`farmingFk` int(10) unsigned NOT NULL,
|
||||||
|
`deliveryNoteFk` int(11) NOT NULL,
|
||||||
|
`amount` decimal(10,2) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `farmingDeliveryNoteFk_FK` (`deliveryNoteFk`),
|
||||||
|
KEY `farmingDeliveryNoteFk_FK_1` (`farmingFk`),
|
||||||
|
CONSTRAINT `farmingDeliveryNoteFk_FK` FOREIGN KEY (`deliveryNoteFk`) REFERENCES `deliveryNote` (`id`),
|
||||||
|
CONSTRAINT `farmingDeliveryNoteFk_FK_1` FOREIGN KEY (`farmingFk`) REFERENCES `farming` (`id`)
|
||||||
|
);
|
|
@ -76,6 +76,6 @@ describe('Entry basic data path', () => {
|
||||||
expect(confirmed).toBe('checked');
|
expect(confirmed).toBe('checked');
|
||||||
expect(inventory).toBe('checked');
|
expect(inventory).toBe('checked');
|
||||||
expect(raid).toBe('checked');
|
expect(raid).toBe('checked');
|
||||||
expect(booked).toBe('checked');
|
expect(booked).toBe('unchecked');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
|
const TOKEN_MULTIMEDIA = 'vnTokenMultimedia';
|
||||||
|
const TOKEN = 'vnToken';
|
||||||
/**
|
/**
|
||||||
* Saves and loads the token for the current logged in user.
|
* Saves and loads the token for the current logged in user.
|
||||||
*
|
*
|
||||||
|
@ -58,8 +59,8 @@ export default class Token {
|
||||||
}
|
}
|
||||||
|
|
||||||
getStorage(storage) {
|
getStorage(storage) {
|
||||||
this.token = storage.getItem('vnToken');
|
this.token = storage.getItem(TOKEN);
|
||||||
this.tokenMultimedia = storage.getItem('vnTokenMultimedia');
|
this.tokenMultimedia = storage.getItem(TOKEN_MULTIMEDIA);
|
||||||
if (!this.token) return;
|
if (!this.token) return;
|
||||||
const created = storage.getItem('vnTokenCreated');
|
const created = storage.getItem('vnTokenCreated');
|
||||||
this.created = created && new Date(created);
|
this.created = created && new Date(created);
|
||||||
|
@ -67,15 +68,15 @@ export default class Token {
|
||||||
}
|
}
|
||||||
|
|
||||||
setStorage(storage, token, tokenMultimedia, created, ttl) {
|
setStorage(storage, token, tokenMultimedia, created, ttl) {
|
||||||
storage.setItem('vnTokenMultimedia', tokenMultimedia);
|
storage.setItem(TOKEN_MULTIMEDIA, tokenMultimedia);
|
||||||
storage.setItem('vnToken', token);
|
storage.setItem(TOKEN, token);
|
||||||
storage.setItem('vnTokenCreated', created.toJSON());
|
storage.setItem('vnTokenCreated', created.toJSON());
|
||||||
storage.setItem('vnTokenTtl', ttl);
|
storage.setItem('vnTokenTtl', ttl);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeStorage(storage) {
|
removeStorage(storage) {
|
||||||
storage.removeItem('vnToken');
|
storage.removeItem(TOKEN);
|
||||||
storage.removeItem('vnTokenMultimedia');
|
storage.removeItem(TOKEN_MULTIMEDIA);
|
||||||
storage.removeItem('vnTokenCreated');
|
storage.removeItem('vnTokenCreated');
|
||||||
storage.removeItem('vnTokenTtl');
|
storage.removeItem('vnTokenTtl');
|
||||||
}
|
}
|
||||||
|
@ -96,9 +97,9 @@ export default class Token {
|
||||||
this.checking = true;
|
this.checking = true;
|
||||||
const renewPeriod = Math.min(this.ttl, this.renewPeriod) * 1000;
|
const renewPeriod = Math.min(this.ttl, this.renewPeriod) * 1000;
|
||||||
const maxDate = this.created.getTime() + renewPeriod;
|
const maxDate = this.created.getTime() + renewPeriod;
|
||||||
const now = new Date();
|
const now = new Date().getTime();
|
||||||
|
|
||||||
if (now.getTime() <= maxDate) {
|
if (now <= maxDate) {
|
||||||
this.checking = false;
|
this.checking = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -106,7 +107,17 @@ export default class Token {
|
||||||
this.$http.post('VnUsers/renewToken')
|
this.$http.post('VnUsers/renewToken')
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const token = res.data;
|
const token = res.data;
|
||||||
this.set(token.id, now, token.ttl, this.remember);
|
const tokenMultimedia =
|
||||||
|
localStorage.getItem(TOKEN_MULTIMEDIA)
|
||||||
|
?? sessionStorage.getItem(TOKEN_MULTIMEDIA);
|
||||||
|
|
||||||
|
return this.$http.post('VnUsers/renewToken', null, {
|
||||||
|
headers: {Authorization: tokenMultimedia}
|
||||||
|
})
|
||||||
|
.then(({data}) => {
|
||||||
|
const tokenMultimedia = data;
|
||||||
|
this.set(token.id, tokenMultimedia.id, new Date(), token.ttl, this.remember);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
this.checking = false;
|
this.checking = false;
|
||||||
|
@ -119,4 +130,4 @@ export default class Token {
|
||||||
}
|
}
|
||||||
Token.$inject = ['vnInterceptor', '$http', '$rootScope'];
|
Token.$inject = ['vnInterceptor', '$http', '$rootScope'];
|
||||||
|
|
||||||
ngModule.service('vnToken', Token);
|
ngModule.service(TOKEN, Token);
|
||||||
|
|
|
@ -158,7 +158,7 @@ describe('InvoiceIn filter()', () => {
|
||||||
|
|
||||||
const result = await models.InvoiceIn.filter(ctx, {}, options);
|
const result = await models.InvoiceIn.filter(ctx, {}, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(4);
|
expect(result.length).toEqual(5);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -180,7 +180,7 @@ describe('InvoiceIn filter()', () => {
|
||||||
|
|
||||||
const result = await models.InvoiceIn.filter(ctx, {}, options);
|
const result = await models.InvoiceIn.filter(ctx, {}, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(6);
|
expect(result.length).toEqual(5);
|
||||||
expect(result[0].isBooked).toBeTruthy();
|
expect(result[0].isBooked).toBeTruthy();
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
|
@ -33,54 +33,54 @@ module.exports = Self => {
|
||||||
|
|
||||||
const stmt = new ParameterizedSQL(
|
const stmt = new ParameterizedSQL(
|
||||||
`SELECT
|
`SELECT
|
||||||
t.id,
|
t.id,
|
||||||
t.packages,
|
t.packages,
|
||||||
t.warehouseFk,
|
t.warehouseFk,
|
||||||
t.nickname,
|
t.nickname,
|
||||||
t.clientFk,
|
t.clientFk,
|
||||||
t.priority,
|
t.priority,
|
||||||
t.addressFk,
|
t.addressFk,
|
||||||
st.code ticketStateCode,
|
st.code ticketStateCode,
|
||||||
st.name ticketStateName,
|
st.name ticketStateName,
|
||||||
wh.name warehouseName,
|
wh.name warehouseName,
|
||||||
tob.description observationDelivery,
|
tob.description observationDelivery,
|
||||||
tob2.description observationDropOff,
|
tob2.description observationDropOff,
|
||||||
tob2.id,
|
tob2.id observationId,
|
||||||
a.street,
|
a.street,
|
||||||
a.postalCode,
|
a.postalCode,
|
||||||
a.city,
|
a.city,
|
||||||
am.name agencyModeName,
|
am.name agencyModeName,
|
||||||
u.nickname userNickname,
|
u.nickname userNickname,
|
||||||
vn.ticketTotalVolume(t.id) volume,
|
vn.ticketTotalVolume(t.id) volume,
|
||||||
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
|
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
|
||||||
c.phone clientPhone,
|
c.phone clientPhone,
|
||||||
c.mobile clientMobile,
|
c.mobile clientMobile,
|
||||||
a.phone addressPhone,
|
a.phone addressPhone,
|
||||||
a.mobile addressMobile,
|
a.mobile addressMobile,
|
||||||
a.longitude,
|
a.longitude,
|
||||||
a.latitude,
|
a.latitude,
|
||||||
wm.mediaValue salePersonPhone,
|
wm.mediaValue salePersonPhone,
|
||||||
t.cmrFk,
|
t.cmrFk,
|
||||||
t.isSigned signed
|
t.isSigned signed
|
||||||
FROM vn.route r
|
FROM vn.route r
|
||||||
JOIN ticket t ON t.routeFk = r.id
|
JOIN ticket t ON t.routeFk = r.id
|
||||||
JOIN client c ON t.clientFk = c.id
|
JOIN client c ON t.clientFk = c.id
|
||||||
LEFT JOIN vn.sale s ON s.ticketFk = t.id
|
LEFT JOIN vn.sale s ON s.ticketFk = t.id
|
||||||
LEFT JOIN vn.item i ON i.id = s.itemFk
|
LEFT JOIN vn.item i ON i.id = s.itemFk
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
LEFT JOIN state st ON st.id = ts.stateFk
|
LEFT JOIN state st ON st.id = ts.stateFk
|
||||||
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
|
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
|
||||||
LEFT JOIN observationType ot ON ot.code = 'delivery'
|
LEFT JOIN observationType ot ON ot.code = 'delivery'
|
||||||
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
|
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
|
||||||
AND tob.observationTypeFk = ot.id
|
AND tob.observationTypeFk = ot.id
|
||||||
LEFT JOIN observationType ot2 ON ot2.code = 'dropOff'
|
LEFT JOIN observationType ot2 ON ot2.code = 'dropOff'
|
||||||
LEFT JOIN ticketObservation tob2 ON tob2.ticketFk = t.id
|
LEFT JOIN ticketObservation tob2 ON tob2.ticketFk = t.id
|
||||||
AND tob2.observationTypeFk = ot2.id
|
AND tob2.observationTypeFk = ot2.id
|
||||||
LEFT JOIN address a ON a.id = t.addressFk
|
LEFT JOIN address a ON a.id = t.addressFk
|
||||||
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
LEFT JOIN account.user u ON u.id = r.workerFk
|
LEFT JOIN account.user u ON u.id = r.workerFk
|
||||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||||
LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk`
|
LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!filter.where) filter.where = {};
|
if (!filter.where) filter.where = {};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "24.18.0",
|
"version": "24.20.0",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Salix backend",
|
"description": "Salix backend",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue