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/),
|
||||
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,7 +24,7 @@ node {
|
|||
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
||||
RUN_TESTS = !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
|
||||
echo "NODE_NAME: ${env.NODE_NAME}"
|
||||
echo "WORKSPACE: ${env.WORKSPACE}"
|
||||
|
|
|
@ -12,8 +12,8 @@ module.exports = Self => {
|
|||
http: {
|
||||
path: `/renewToken`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
},
|
||||
accessScopes: ['DEFAULT', 'read:multimedia']});
|
||||
|
||||
Self.renewToken = async function(ctx) {
|
||||
const {accessToken: token} = ctx.req;
|
||||
|
|
|
@ -2617,7 +2617,7 @@ INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amo
|
|||
|
||||
UPDATE `vn`.`invoiceIn`
|
||||
SET isBooked = TRUE
|
||||
WHERE id IN (2, 5, 7, 8, 9, 10);
|
||||
WHERE id IN (5, 7, 8, 9, 10);
|
||||
|
||||
DELIMITER $$
|
||||
CREATE PROCEDURE `tmp`.`ticket_recalc`()
|
||||
|
|
|
@ -19,10 +19,10 @@ BEGIN
|
|||
AND a.hasWeightVolumetric
|
||||
LIMIT 1;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.buysToCheck;
|
||||
DROP TEMPORARY TABLE tmp.buysToCheck;
|
||||
|
||||
IF hasVolumetricAgency THEN
|
||||
CALL util.throw('Some purchase line has an item without size or weight per stem in the volumetric agency.');
|
||||
IF hasVolumetricAgency THEN
|
||||
CALL util.throw('Item lacks size/weight in purchase line at agency');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -9,6 +9,14 @@ BEGIN
|
|||
DECLARE vCurrencyName VARCHAR(25);
|
||||
DECLARE vComission INT;
|
||||
|
||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||
BEGIN
|
||||
ROLLBACK;
|
||||
RESIGNAL;
|
||||
END;
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.recalcEntryCommision
|
||||
SELECT e.id
|
||||
FROM vn.entry e
|
||||
|
@ -28,12 +36,15 @@ BEGIN
|
|||
WHERE id = vCurrency;
|
||||
|
||||
CALL entry_recalc();
|
||||
|
||||
COMMIT;
|
||||
|
||||
SELECT util.notification_send(
|
||||
'entry-update-comission',
|
||||
JSON_OBJECT('currencyName', vCurrencyName, 'referenceCurrent', vComission),
|
||||
NULL
|
||||
);
|
||||
|
||||
DROP TEMPORARY TABLE tmp.recalcEntryCommision;
|
||||
DROP TEMPORARY TABLE tmp.recalcEntryCommision;
|
||||
END$$
|
||||
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(inventory).toBe('checked');
|
||||
expect(raid).toBe('checked');
|
||||
expect(booked).toBe('checked');
|
||||
expect(booked).toBe('unchecked');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
const TOKEN_MULTIMEDIA = 'vnTokenMultimedia';
|
||||
const TOKEN = 'vnToken';
|
||||
/**
|
||||
* Saves and loads the token for the current logged in user.
|
||||
*
|
||||
|
@ -58,8 +59,8 @@ export default class Token {
|
|||
}
|
||||
|
||||
getStorage(storage) {
|
||||
this.token = storage.getItem('vnToken');
|
||||
this.tokenMultimedia = storage.getItem('vnTokenMultimedia');
|
||||
this.token = storage.getItem(TOKEN);
|
||||
this.tokenMultimedia = storage.getItem(TOKEN_MULTIMEDIA);
|
||||
if (!this.token) return;
|
||||
const created = storage.getItem('vnTokenCreated');
|
||||
this.created = created && new Date(created);
|
||||
|
@ -67,15 +68,15 @@ export default class Token {
|
|||
}
|
||||
|
||||
setStorage(storage, token, tokenMultimedia, created, ttl) {
|
||||
storage.setItem('vnTokenMultimedia', tokenMultimedia);
|
||||
storage.setItem('vnToken', token);
|
||||
storage.setItem(TOKEN_MULTIMEDIA, tokenMultimedia);
|
||||
storage.setItem(TOKEN, token);
|
||||
storage.setItem('vnTokenCreated', created.toJSON());
|
||||
storage.setItem('vnTokenTtl', ttl);
|
||||
}
|
||||
|
||||
removeStorage(storage) {
|
||||
storage.removeItem('vnToken');
|
||||
storage.removeItem('vnTokenMultimedia');
|
||||
storage.removeItem(TOKEN);
|
||||
storage.removeItem(TOKEN_MULTIMEDIA);
|
||||
storage.removeItem('vnTokenCreated');
|
||||
storage.removeItem('vnTokenTtl');
|
||||
}
|
||||
|
@ -96,9 +97,9 @@ export default class Token {
|
|||
this.checking = true;
|
||||
const renewPeriod = Math.min(this.ttl, this.renewPeriod) * 1000;
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
@ -106,7 +107,17 @@ export default class Token {
|
|||
this.$http.post('VnUsers/renewToken')
|
||||
.then(res => {
|
||||
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(() => {
|
||||
this.checking = false;
|
||||
|
@ -119,4 +130,4 @@ export default class Token {
|
|||
}
|
||||
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);
|
||||
|
||||
expect(result.length).toEqual(4);
|
||||
expect(result.length).toEqual(5);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -180,7 +180,7 @@ describe('InvoiceIn filter()', () => {
|
|||
|
||||
const result = await models.InvoiceIn.filter(ctx, {}, options);
|
||||
|
||||
expect(result.length).toEqual(6);
|
||||
expect(result.length).toEqual(5);
|
||||
expect(result[0].isBooked).toBeTruthy();
|
||||
|
||||
await tx.rollback();
|
||||
|
|
|
@ -33,54 +33,54 @@ module.exports = Self => {
|
|||
|
||||
const stmt = new ParameterizedSQL(
|
||||
`SELECT
|
||||
t.id,
|
||||
t.packages,
|
||||
t.warehouseFk,
|
||||
t.nickname,
|
||||
t.clientFk,
|
||||
t.priority,
|
||||
t.addressFk,
|
||||
st.code ticketStateCode,
|
||||
st.name ticketStateName,
|
||||
wh.name warehouseName,
|
||||
tob.description observationDelivery,
|
||||
tob2.description observationDropOff,
|
||||
tob2.id,
|
||||
a.street,
|
||||
a.postalCode,
|
||||
a.city,
|
||||
am.name agencyModeName,
|
||||
u.nickname userNickname,
|
||||
vn.ticketTotalVolume(t.id) volume,
|
||||
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
|
||||
c.phone clientPhone,
|
||||
c.mobile clientMobile,
|
||||
a.phone addressPhone,
|
||||
a.mobile addressMobile,
|
||||
a.longitude,
|
||||
a.latitude,
|
||||
wm.mediaValue salePersonPhone,
|
||||
t.cmrFk,
|
||||
t.isSigned signed
|
||||
FROM vn.route r
|
||||
JOIN ticket t ON t.routeFk = r.id
|
||||
JOIN client c ON t.clientFk = c.id
|
||||
LEFT JOIN vn.sale s ON s.ticketFk = t.id
|
||||
LEFT JOIN vn.item i ON i.id = s.itemFk
|
||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||
LEFT JOIN state st ON st.id = ts.stateFk
|
||||
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
|
||||
LEFT JOIN observationType ot ON ot.code = 'delivery'
|
||||
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
|
||||
AND tob.observationTypeFk = ot.id
|
||||
LEFT JOIN observationType ot2 ON ot2.code = 'dropOff'
|
||||
LEFT JOIN ticketObservation tob2 ON tob2.ticketFk = t.id
|
||||
AND tob2.observationTypeFk = ot2.id
|
||||
LEFT JOIN address a ON a.id = t.addressFk
|
||||
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
LEFT JOIN account.user u ON u.id = r.workerFk
|
||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||
LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk`
|
||||
t.id,
|
||||
t.packages,
|
||||
t.warehouseFk,
|
||||
t.nickname,
|
||||
t.clientFk,
|
||||
t.priority,
|
||||
t.addressFk,
|
||||
st.code ticketStateCode,
|
||||
st.name ticketStateName,
|
||||
wh.name warehouseName,
|
||||
tob.description observationDelivery,
|
||||
tob2.description observationDropOff,
|
||||
tob2.id observationId,
|
||||
a.street,
|
||||
a.postalCode,
|
||||
a.city,
|
||||
am.name agencyModeName,
|
||||
u.nickname userNickname,
|
||||
vn.ticketTotalVolume(t.id) volume,
|
||||
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
|
||||
c.phone clientPhone,
|
||||
c.mobile clientMobile,
|
||||
a.phone addressPhone,
|
||||
a.mobile addressMobile,
|
||||
a.longitude,
|
||||
a.latitude,
|
||||
wm.mediaValue salePersonPhone,
|
||||
t.cmrFk,
|
||||
t.isSigned signed
|
||||
FROM vn.route r
|
||||
JOIN ticket t ON t.routeFk = r.id
|
||||
JOIN client c ON t.clientFk = c.id
|
||||
LEFT JOIN vn.sale s ON s.ticketFk = t.id
|
||||
LEFT JOIN vn.item i ON i.id = s.itemFk
|
||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||
LEFT JOIN state st ON st.id = ts.stateFk
|
||||
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
|
||||
LEFT JOIN observationType ot ON ot.code = 'delivery'
|
||||
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
|
||||
AND tob.observationTypeFk = ot.id
|
||||
LEFT JOIN observationType ot2 ON ot2.code = 'dropOff'
|
||||
LEFT JOIN ticketObservation tob2 ON tob2.ticketFk = t.id
|
||||
AND tob2.observationTypeFk = ot2.id
|
||||
LEFT JOIN address a ON a.id = t.addressFk
|
||||
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
LEFT JOIN account.user u ON u.id = r.workerFk
|
||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||
LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk`
|
||||
);
|
||||
|
||||
if (!filter.where) filter.where = {};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "salix-back",
|
||||
"version": "24.18.0",
|
||||
"version": "24.20.0",
|
||||
"author": "Verdnatura Levante SL",
|
||||
"description": "Salix backend",
|
||||
"license": "GPL-3.0",
|
||||
|
|
Loading…
Reference in New Issue