testToMaster hotFix #2457

Merged
alexm merged 7 commits from test into master 2024-05-15 10:26:14 +00:00
5 changed files with 49 additions and 58 deletions
Showing only changes of commit af198e2832 - Show all commits

2
Jenkinsfile vendored
View File

@ -24,7 +24,6 @@ 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'
// 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}"
@ -162,6 +161,7 @@ pipeline {
def packageJson = readJSON file: 'package.json' def packageJson = readJSON file: 'package.json'
env.VERSION = packageJson.version env.VERSION = packageJson.version
} }
echo "BRANCH_NAME: ${env.BRANCH_NAME}"
sh 'gulp build' sh 'gulp build'
sh 'docker-compose build front' sh 'docker-compose build front'
} }

View File

@ -1,7 +1,8 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`sale_add`( CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`sale_add`(
IN vStarted DATE, IN vStarted DATE,
IN vEnded DATE) IN vEnded DATE
)
BEGIN BEGIN
/** /**
* Añade las ventas que se realizaron entre 2 fechas a la tabla bs.sale * Añade las ventas que se realizaron entre 2 fechas a la tabla bs.sale
@ -10,63 +11,54 @@ BEGIN
* @param vEnded Fecha de fin * @param vEnded Fecha de fin
* *
*/ */
DECLARE vLoopDate DATE;
DECLARE vLoopDateTime DATETIME;
IF vStarted < (util.VN_CURDATE() - INTERVAL 5 YEAR) OR vStarted > vEnded THEN IF vStarted < (util.VN_CURDATE() - INTERVAL 5 YEAR) OR vStarted > vEnded THEN
CALL util.throw('Wrong date'); CALL util.throw('Wrong date');
END IF; END IF;
SET vLoopDate = vStarted;
DELETE FROM sale DELETE FROM sale
WHERE dated BETWEEN vStarted AND vEnded; WHERE dated BETWEEN vStarted AND vEnded;
WHILE vLoopDate <= vEnded DO REPLACE sale(
SET vLoopDateTime = util.dayEnd(vLoopDate); saleFk,
amount,
REPLACE sale( surcharge,
saleFk, dated,
amount, typeFk,
surcharge, clientFk,
dated, companyFk,
typeFk, margin
clientFk, )WITH calculatedSales AS(
companyFk, SELECT s.id saleFk,
margin CAST(SUM(IF(ct.isBase, s.quantity * sc.value, 0)) AS DECIMAL(10, 3)) amount,
)WITH calculatedSales AS( CAST(SUM(IF(ct.isBase, 0, s.quantity * sc.value)) AS DECIMAL(10, 3)) surcharge,
SELECT s.id saleFk, s.total,
SUM(IF(ct.isBase, s.quantity * sc.value, 0)) amount, DATE(t.shipped) dated,
SUM(IF(ct.isBase, 0, s.quantity * sc.value)) surcharge, i.typeFk,
s.total pvp, t.clientFk,
DATE(t.shipped) dated, t.companyFk,
i.typeFk, CAST(SUM(IF(ct.isMargin, s.quantity * sc.value, 0 )) AS DECIMAL(10, 3)) marginComponents
t.clientFk, FROM vn.ticket t
t.companyFk, STRAIGHT_JOIN vn.sale s ON s.ticketFk = t.id
SUM(IF(ct.isMargin, s.quantity * sc.value, 0 )) marginComponents JOIN vn.item i ON i.id = s.itemFk
FROM vn.ticket t JOIN vn.itemType it ON it.id = i.typeFk
STRAIGHT_JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.itemCategory ic ON ic.id = it.categoryFk
JOIN vn.item i ON i.id = s.itemFk JOIN vn.saleComponent sc ON sc.saleFk = s.id
JOIN vn.itemType it ON it.id = i.typeFk JOIN vn.component c ON c.id = sc.componentFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk JOIN vn.componentType ct ON ct.id = c.typeFk
JOIN vn.saleComponent sc ON sc.saleFk = s.id WHERE t.shipped BETWEEN vStarted AND vEnded
JOIN vn.component c ON c.id = sc.componentFk AND s.quantity <> 0
JOIN vn.componentType ct ON ct.id = c.typeFk AND ic.merchandise
WHERE t.shipped BETWEEN vLoopDate AND vLoopDateTime GROUP BY s.id
AND s.quantity <> 0 )SELECT saleFk,
AND ic.merchandise amount,
GROUP BY s.id surcharge,
)SELECT saleFk, dated,
amount, typeFk,
surcharge, clientFk,
dated, companyFk,
typeFk, IF (marginComponents IS NULL,
clientFk, 0,
companyFk, CAST(marginComponents + amount + surcharge - total AS DECIMAL(10, 3)))
marginComponents + amount + surcharge - pvp FROM calculatedSales;
FROM calculatedSales;
SET vLoopDate = vLoopDate + INTERVAL 1 DAY;
END WHILE;
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -12,7 +12,7 @@ AS SELECT `s`.`user_id` AS `id`,
`c`.`permit` AS `permit`, `c`.`permit` AS `permit`,
`c`.`type` AS `type`, `c`.`type` AS `type`,
`c`.`context` AS `context`, `c`.`context` AS `context`,
`c`.`incomingLimit` AS `incominglimit`, `c`.`call-limit` AS `call-limit`,
`c`.`pickupGroup` AS `pickupgroup`, `c`.`pickupGroup` AS `pickupgroup`,
`c`.`directMedia` AS `directmedia`, `c`.`directMedia` AS `directmedia`,
`c`.`insecure` AS `insecure`, `c`.`insecure` AS `insecure`,

View File

@ -0,0 +1,3 @@
ALTER TABLE pbx.sipConfig
CHANGE incomingLimit `call-limit` varchar(10)
CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL;

View File

@ -87,10 +87,6 @@ module.exports = Self => {
const where = filter.where; const where = filter.where;
where['r.id'] = filter.id; where['r.id'] = filter.id;
where.and = [{or: [
{'t.packages': {gt: 0}},
{and: [{'ot.code': 'delivery'}, {'tob.observationTypeFk': {neq: null}}]}
]}];
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));
stmt.merge(conn.makeGroupBy('t.id')); stmt.merge(conn.makeGroupBy('t.id'));