diff --git a/back/methods/vn-token/killSession.js b/back/methods/vn-token/killSession.js
new file mode 100644
index 000000000..23d02bfc2
--- /dev/null
+++ b/back/methods/vn-token/killSession.js
@@ -0,0 +1,29 @@
+module.exports = Self => {
+ Self.remoteMethodCtx('killSession', {
+ description: 'Kill session',
+ accepts: [{
+ arg: 'userId',
+ type: 'integer',
+ description: 'The user id',
+ required: true,
+ }, {
+ arg: 'created',
+ type: 'date',
+ description: 'The created time',
+ required: true,
+ }],
+ accessType: 'WRITE',
+ http: {
+ path: `/killSession`,
+ verb: 'POST'
+ }
+ });
+
+ Self.killSession = async function(ctx, userId, created) {
+ await Self.app.models.VnUser.userSecurity(ctx, ctx.req.accessToken.userId);
+ const tokens = await Self.app.models.AccessToken.find({where: {userId, created}});
+ if (!tokens?.length) return;
+ for (const token of tokens)
+ await Self.app.models.AccessToken.deleteById(token.id);
+ };
+};
diff --git a/back/model-config.json b/back/model-config.json
index cb9ee4fdb..07ce5fe88 100644
--- a/back/model-config.json
+++ b/back/model-config.json
@@ -175,6 +175,9 @@
"ViaexpressConfig": {
"dataSource": "vn"
},
+ "VnToken": {
+ "dataSource": "vn"
+ },
"VnUser": {
"dataSource": "vn"
},
diff --git a/back/models/vn-token.js b/back/models/vn-token.js
new file mode 100644
index 000000000..03d45dae2
--- /dev/null
+++ b/back/models/vn-token.js
@@ -0,0 +1,5 @@
+const vnModel = require('vn-loopback/common/models/vn-model');
+module.exports = function(Self) {
+ vnModel(Self);
+ require('../methods/vn-token/killSession')(Self);
+};
diff --git a/back/models/vn-token.json b/back/models/vn-token.json
new file mode 100644
index 000000000..fab8965d6
--- /dev/null
+++ b/back/models/vn-token.json
@@ -0,0 +1,22 @@
+{
+ "name": "VnToken",
+ "base": "AccessToken",
+ "options": {
+ "mysql": {
+ "table": "salix.AccessToken"
+ }
+ },
+ "properties": {
+ "created": {
+ "type": "date"
+ }
+ },
+ "relations": {
+ "user": {
+ "type": "belongsTo",
+ "model": "VnUser",
+ "foreignKey": "userId"
+ }
+ },
+ "hidden": ["id"]
+}
diff --git a/back/models/warehouse.json b/back/models/warehouse.json
index 54006130b..9267900a5 100644
--- a/back/models/warehouse.json
+++ b/back/models/warehouse.json
@@ -25,6 +25,9 @@
"isManaged": {
"type": "boolean"
},
+ "isDestiny": {
+ "type": "boolean"
+ },
"countryFk": {
"type": "number"
}
diff --git a/db/.pullinfo.json b/db/.pullinfo.json
index 27d2c7535..5b75584d1 100644
--- a/db/.pullinfo.json
+++ b/db/.pullinfo.json
@@ -9,7 +9,7 @@
},
"vn": {
"view": {
- "expeditionPallet_Print": "ced2b84a114fcb99fce05f0c34f4fc03f3fa387bef92621be1bc306608a84345"
+ "expeditionPallet_Print": "99f75145ac2e7b612a6d71e74b6e55f194a465780fd9875a15eb01e6596b447e"
}
}
}
diff --git a/db/routines/hedera/procedures/order_addItem.sql b/db/routines/hedera/procedures/order_addItem.sql
index 204dcb6bf..1470ddf35 100644
--- a/db/routines/hedera/procedures/order_addItem.sql
+++ b/db/routines/hedera/procedures/order_addItem.sql
@@ -47,11 +47,15 @@ BEGIN
FROM tmp.zoneGetShipped
WHERE warehouseFk = vWarehouse;
- SELECT IFNULL(available, 0) INTO vAvailable
+ SELECT available INTO vAvailable
FROM tmp.ticketLot
WHERE warehouseFk = vWarehouse
AND itemFk = vItem;
+ IF vAvailable IS NULL THEN
+ SET vAvailable = 0;
+ END IF;
+
IF vAmount > vAvailable THEN
CALL util.throw ('ORDER_ROW_UNAVAILABLE');
END IF;
diff --git a/db/routines/util/events/log_clean.sql b/db/routines/util/events/log_clean.sql
new file mode 100644
index 000000000..8447069e6
--- /dev/null
+++ b/db/routines/util/events/log_clean.sql
@@ -0,0 +1,8 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `util`.`log_clean`
+ ON SCHEDULE EVERY 1 DAY
+ STARTS '2024-07-09 00:30:00.000'
+ ON COMPLETION PRESERVE
+ ENABLE
+DO CALL util.log_clean$$
+DELIMITER ;
diff --git a/db/routines/util/procedures/log_clean.sql b/db/routines/util/procedures/log_clean.sql
new file mode 100644
index 000000000..aeed9dc44
--- /dev/null
+++ b/db/routines/util/procedures/log_clean.sql
@@ -0,0 +1,54 @@
+DELIMITER $$
+CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `util`.`log_clean`()
+BEGIN
+/**
+ * Hace limpieza de los datos de las tablas log,
+ * dejando únicamente los días de retención configurados.
+ */
+ DECLARE vSchemaName VARCHAR(65);
+ DECLARE vSchemaNameQuoted VARCHAR(65);
+ DECLARE vTableName VARCHAR(65);
+ DECLARE vTableNameQuoted VARCHAR(65);
+ DECLARE vRetentionDays INT;
+ DECLARE vStarted DATETIME;
+ DECLARE vDated DATE;
+ DECLARE vDone BOOL;
+
+ DECLARE vQueue CURSOR FOR
+ SELECT schemaName, tableName, retentionDays
+ FROM logCleanMultiConfig
+ ORDER BY `order`;
+
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
+
+ OPEN vQueue;
+ l: LOOP
+ SET vDone = FALSE;
+ FETCH vQueue INTO vSchemaName, vTableName, vRetentionDays;
+
+ IF vDone THEN
+ LEAVE l;
+ END IF;
+
+ IF vRetentionDays THEN
+ SET vStarted = VN_NOW();
+ SET vSchemaNameQuoted = quoteIdentifier(vSchemaName);
+ SET vTableNameQuoted = quoteIdentifier(vTableName);
+ SET vDated = VN_CURDATE() - INTERVAL vRetentionDays DAY;
+
+ EXECUTE IMMEDIATE CONCAT(
+ 'DELETE FROM ', vSchemaNameQuoted,
+ '.', vTableNameQuoted,
+ " WHERE creationDate < '", vDated, "'"
+ );
+
+ UPDATE logCleanMultiConfig
+ SET `started` = vStarted,
+ `finished` = VN_NOW()
+ WHERE schemaName = vSchemaName
+ AND tableName = vTableName;
+ END IF;
+ END LOOP;
+ CLOSE vQueue;
+END$$
+DELIMITER ;
diff --git a/db/routines/vn/procedures/buy_chekItem.sql b/db/routines/vn/procedures/buy_checkItem.sql
similarity index 63%
rename from db/routines/vn/procedures/buy_chekItem.sql
rename to db/routines/vn/procedures/buy_checkItem.sql
index e9e9336b7..1144db889 100644
--- a/db/routines/vn/procedures/buy_chekItem.sql
+++ b/db/routines/vn/procedures/buy_checkItem.sql
@@ -6,9 +6,10 @@ BEGIN
*
* @param tmp.buysToCheck(id as INT).
*/
- DECLARE hasVolumetricAgency INT;
+ DECLARE vHasVolumetricAgency INT;
+ DECLARE vItemFk INT;
- SELECT a.hasWeightVolumetric INTO hasVolumetricAgency
+ SELECT a.hasWeightVolumetric, i.id INTO vHasVolumetricAgency, vItemFk
FROM entry e
JOIN travel t ON t.id = e.travelFk
JOIN agencyMode a ON a.id = t.agencyModeFk
@@ -19,10 +20,10 @@ BEGIN
AND a.hasWeightVolumetric
LIMIT 1;
- DROP TEMPORARY TABLE tmp.buysToCheck;
+ DROP TEMPORARY TABLE tmp.buysToCheck;
- IF hasVolumetricAgency THEN
- CALL util.throw('Item lacks size/weight in purchase line at agency');
- END IF;
+ IF vHasVolumetricAgency THEN
+ CALL util.throw(CONCAT('Missing size/weight in buy line at agency, item: ', vItemFk));
+ END IF;
END$$
-DELIMITER ;
\ No newline at end of file
+DELIMITER ;
diff --git a/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql b/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql
index b603041c3..24bb94b7e 100644
--- a/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql
+++ b/db/routines/vn/procedures/itemShelvingSale_addBySectorCollection.sql
@@ -30,6 +30,8 @@ BEGIN
FROM operator
WHERE workerFk = account.myUser_getId();
+ CALL util.debugAdd('itemShelvingSale_addBySectorCollection',CONCAT(vSectorCollectionFk,' - ', account.myUser_getId()));
+
OPEN vSales;
l: LOOP
SET vDone = FALSE;
diff --git a/db/routines/vn/procedures/sale_getProblems.sql b/db/routines/vn/procedures/sale_getProblems.sql
index 3f2c76251..2bba8fbc3 100644
--- a/db/routines/vn/procedures/sale_getProblems.sql
+++ b/db/routines/vn/procedures/sale_getProblems.sql
@@ -51,7 +51,6 @@ BEGIN
hasTicketRequest,
isTaxDataChecked,
hasComponentLack,
- hasRounding,
isTooLittle)
SELECT sgp.ticketFk,
s.id,
@@ -62,10 +61,6 @@ BEGIN
IF(FIND_IN_SET('hasTicketRequest', t.problem), TRUE, FALSE) hasTicketRequest,
IF(FIND_IN_SET('isTaxDataChecked', t.problem), FALSE, TRUE) isTaxDataChecked,
IF(FIND_IN_SET('hasComponentLack', s.problem), TRUE, FALSE) hasComponentLack,
- IF(FIND_IN_SET('hasRounding', s.problem),
- LEFT(GROUP_CONCAT('RE: ', i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250),
- NULL
- ) hasRounding,
IF(FIND_IN_SET('isTooLittle', t.problem)
AND util.VN_NOW() < (util.VN_CURDATE() + INTERVAL HOUR(zc.`hour`) HOUR) + INTERVAL MINUTE(zc.`hour`) MINUTE,
TRUE, FALSE) isTooLittle
@@ -208,24 +203,31 @@ BEGIN
GROUP BY sgp.ticketFk
) sub
ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk;
+
+ -- Redondeo: cantidad incorrecta con respecto al grouping
+ CALL buy_getUltimate(NULL, vWarehouseFk, vDate);
+ INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
+ SELECT ticketFk, problem, saleFk
+ FROM (
+ SELECT sgp.ticketFk,
+ s.id saleFk,
+ LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
+ FROM tmp.sale_getProblems sgp
+ JOIN ticket t ON t.id = sgp.ticketFk
+ AND t.warehouseFk = vWarehouseFk
+ JOIN sale s ON s.ticketFk = sgp.ticketFk
+ JOIN item i ON i.id = s.itemFk
+ JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
+ JOIN buy b ON b.id = bu.buyFk
+ WHERE MOD(s.quantity, b.`grouping`)
+ GROUP BY sgp.ticketFk
+ )sub
+ ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
+
+ DROP TEMPORARY TABLE tmp.buyUltimate;
END LOOP;
CLOSE vCursor;
- INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
- SELECT ticketFk, problem, saleFk
- FROM (
- SELECT sgp.ticketFk,
- s.id saleFk,
- LEFT(GROUP_CONCAT('RE: ', i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
- FROM tmp.sale_getProblems sgp
- JOIN ticket t ON t.id = sgp.ticketFk
- JOIN sale s ON s.ticketFk = sgp.ticketFk
- JOIN item i ON i.id = s.itemFk
- WHERE FIND_IN_SET('hasRounding', s.problem)
- GROUP BY sgp.ticketFk
- ) sub
- ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
-
DROP TEMPORARY TABLE tItemShelvingStock_byWarehouse;
END$$
DELIMITER ;
diff --git a/db/routines/vn/procedures/sale_setProblemRounding.sql b/db/routines/vn/procedures/sale_setProblemRounding.sql
deleted file mode 100644
index 38f598140..000000000
--- a/db/routines/vn/procedures/sale_setProblemRounding.sql
+++ /dev/null
@@ -1,37 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_setProblemRounding`(
- vSelf INT
-)
-BEGIN
-/**
- * Update the rounding problem for a sales line
- * @param vSelf Id sale
- */
- DECLARE vItemFk INT;
- DECLARE vWarehouseFk INT;
- DECLARE vShipped DATE;
- DECLARE vQuantity INT;
- DECLARE vIsProblemCalcNeeded BOOL;
-
- SELECT s.itemFk, t.warehouseFk, t.shipped, s.quantity, ticket_isProblemCalcNeeded(t.id)
- INTO vItemFk, vWarehouseFk, vShipped, vQuantity, vIsProblemCalcNeeded
- FROM sale s
- JOIN ticket t ON t.id = s.ticketFk
- WHERE s.id = vSelf;
-
- CALL buy_getUltimate(vItemFk, vWarehouseFk, vShipped);
-
- CREATE OR REPLACE TEMPORARY TABLE tmp.sale
- SELECT vSelf saleFk,
- MOD(vQuantity, b.`grouping`) hasProblem,
- vIsProblemCalcNeeded isProblemCalcNeeded
- FROM tmp.buyUltimate bu
- JOIN buy b ON b.id = bu.buyFk
- WHERE bu.itemFk = vItemFk;
-
- CALL sale_setProblem('hasRounding');
-
- DROP TEMPORARY TABLE tmp.sale;
- DROP TEMPORARY TABLE tmp.buyUltimate;
-END$$
-DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/procedures/sale_setProblemRoundingByBuy.sql b/db/routines/vn/procedures/sale_setProblemRoundingByBuy.sql
deleted file mode 100644
index b0e286d25..000000000
--- a/db/routines/vn/procedures/sale_setProblemRoundingByBuy.sql
+++ /dev/null
@@ -1,75 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblemRoundingByBuy`(
- vBuyFk INT
-)
-BEGIN
-/**
- * Update rounding problem for all sales related to a buy.
- *
- * @param vBuyFk Buy id
- */
- DECLARE vItemFk INT;
- DECLARE vWarehouseFk INT;
- DECLARE vMaxDated DATE;
- DECLARE vMinDated DATE;
- DECLARE vLanding DATE;
- DECLARE vLastBuy INT;
- DECLARE vCurrentBuy INT;
- DECLARE vGrouping INT;
-
- SELECT b.itemFk, t.warehouseInFk
- INTO vItemFk, vWarehouseFk
- FROM buy b
- JOIN entry e ON e.id = b.entryFk
- JOIN travel t ON t.id = e.travelFk
- WHERE b.id = vBuyFk;
-
- IF vItemFk AND vWarehouseFk THEN
- SELECT DATE(MAX(t.shipped)) + INTERVAL 1 DAY, DATE(MIN(t.shipped))
- INTO vMaxDated, vMinDated
- FROM sale s
- JOIN ticket t ON t.id = s.ticketFk
- WHERE t.shipped >= util.VN_CURDATE()
- AND s.itemFk = vItemFk
- AND s.quantity > 0;
-
- CALL buy_getUltimate(vItemFk, vWarehouseFk, vMinDated);
-
- SELECT bu.buyFk, b.grouping INTO vLastBuy, vGrouping
- FROM tmp.buyUltimate bu
- JOIN buy b ON b.id = bu.buyFk;
-
- DROP TEMPORARY TABLE tmp.buyUltimate;
-
- SET vLanding = vMaxDated;
-
- WHILE vCurrentBuy <> vLastBuy OR vLanding > vMinDated DO
- SET vMaxDated = vLanding - INTERVAL 1 DAY;
-
- CALL buy_getUltimate(vItemFk, vWarehouseFk, vMaxDated);
-
- SELECT buyFk, landing
- INTO vCurrentBuy, vLanding
- FROM tmp.buyUltimate;
-
- DROP TEMPORARY TABLE tmp.buyUltimate;
- END WHILE;
-
- CREATE OR REPLACE TEMPORARY TABLE tmp.sale
- (INDEX(saleFk, isProblemCalcNeeded))
- ENGINE = MEMORY
- SELECT s.id saleFk,
- MOD(s.quantity, vGrouping) hasProblem,
- ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
- FROM sale s
- JOIN ticket t ON t.id = s.ticketFk
- WHERE s.itemFk = vItemFk
- AND s.quantity > 0
- AND t.shipped BETWEEN vMinDated AND util.dayEnd(vMaxDated);
-
- CALL sale_setProblem('hasRounding');
-
- DROP TEMPORARY TABLE tmp.sale;
- END IF;
-END$$
-DELIMITER ;
\ No newline at end of file
diff --git a/db/routines/vn/procedures/ticket_canAdvance.sql b/db/routines/vn/procedures/ticket_canAdvance.sql
index 44149126a..57c3f4235 100644
--- a/db/routines/vn/procedures/ticket_canAdvance.sql
+++ b/db/routines/vn/procedures/ticket_canAdvance.sql
@@ -19,8 +19,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
- SELECT
- origin.ticketFk futureId,
+ SELECT origin.ticketFk futureId,
dest.ticketFk id,
dest.state,
origin.futureState,
@@ -51,48 +50,48 @@ BEGIN
origin.warehouseFk futureWarehouseFk,
origin.companyFk futureCompanyFk,
IFNULL(dest.nickname, origin.nickname) nickname,
- dest.landed
+ dest.landed,
+ dest.preparation
FROM (
- SELECT
- s.ticketFk,
- c.salesPersonFk workerFk,
- t.shipped,
- t.totalWithVat,
- st.name futureState,
- am.name futureAgency,
- count(s.id) futureLines,
- GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
- CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
- SUM(s.quantity <= (IFNULL(il.stock,0) + IFNULL(im.amount, 0))) hasStock,
- z.id futureZoneFk,
- z.name futureZoneName,
- st.classColor,
- t.clientFk,
- t.nickname,
- t.addressFk,
- t.warehouseFk,
- t.companyFk,
- t.agencyModeFk
- FROM ticket t
- JOIN client c ON c.id = t.clientFk
- JOIN sale s ON s.ticketFk = t.id
- JOIN saleVolume sv ON sv.saleFk = s.id
- JOIN item i ON i.id = s.itemFk
- JOIN ticketState ts ON ts.ticketFk = t.id
- JOIN state st ON st.id = ts.stateFk
- JOIN agencyMode am ON t.agencyModeFk = am.id
- JOIN zone z ON t.zoneFk = z.id
- LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
- LEFT JOIN tmp.itemMinacum im ON im.itemFk = i.id
- AND im.warehouseFk = vWarehouseFk
- LEFT JOIN tmp.itemList il ON il.itemFk = i.id
- WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
- AND t.warehouseFk = vWarehouseFk
- GROUP BY t.id
+ SELECT s.ticketFk,
+ c.salesPersonFk workerFk,
+ t.shipped,
+ t.totalWithVat,
+ st.name futureState,
+ am.name futureAgency,
+ count(s.id) futureLines,
+ GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
+ CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
+ SUM(s.quantity <= (IFNULL(il.stock,0) + IFNULL(im.amount, 0))) hasStock,
+ z.id futureZoneFk,
+ z.name futureZoneName,
+ st.classColor,
+ t.clientFk,
+ t.nickname,
+ t.addressFk,
+ t.warehouseFk,
+ t.companyFk,
+ t.agencyModeFk
+ FROM ticket t
+ JOIN client c ON c.id = t.clientFk
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN saleVolume sv ON sv.saleFk = s.id
+ JOIN item i ON i.id = s.itemFk
+ JOIN ticketState ts ON ts.ticketFk = t.id
+ JOIN `state` st ON st.id = ts.stateFk
+ JOIN agencyMode am ON t.agencyModeFk = am.id
+ JOIN `zone` z ON t.zoneFk = z.id
+ LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
+ LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
+ LEFT JOIN tmp.itemMinacum im ON im.itemFk = i.id
+ AND im.warehouseFk = vWarehouseFk
+ LEFT JOIN tmp.itemList il ON il.itemFk = i.id
+ WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
+ AND t.warehouseFk = vWarehouseFk
+ GROUP BY t.id
) origin
LEFT JOIN (
- SELECT
- t.id ticketFk,
+ SELECT t.id ticketFk,
st.name state,
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
t.shipped,
@@ -108,18 +107,25 @@ BEGIN
t.warehouseFk,
t.companyFk,
t.landed,
- t.agencyModeFk
+ t.agencyModeFk,
+ SEC_TO_TIME(
+ COALESCE(HOUR(t.shipped), HOUR(zc.hour), HOUR(z.hour)) * 3600 +
+ COALESCE(MINUTE(t.shipped), MINUTE(zc.hour), MINUTE(z.hour)) * 60
+ ) preparation
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk
JOIN ticketState ts ON ts.ticketFk = t.id
- JOIN state st ON st.id = ts.stateFk
+ JOIN `state` st ON st.id = ts.stateFk
JOIN agencyMode am ON t.agencyModeFk = am.id
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
+ LEFT JOIN `zone` z ON z.id = t.zoneFk
+ LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
+ JOIN ticketCanAdvanceConfig tc
WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
AND t.warehouseFk = vWarehouseFk
- AND st.order <= 5
+ AND st.order <= tc.destinationOrder
GROUP BY t.id
) dest ON dest.addressFk = origin.addressFk
WHERE origin.hasStock;
diff --git a/db/routines/vn/procedures/ticket_canbePostponed.sql b/db/routines/vn/procedures/ticket_canbePostponed.sql
index 871cafddc..1f3c43057 100644
--- a/db/routines/vn/procedures/ticket_canbePostponed.sql
+++ b/db/routines/vn/procedures/ticket_canbePostponed.sql
@@ -21,6 +21,7 @@ BEGIN
t.clientFk,
t.warehouseFk,
ts.alertLevel,
+ sub2.alertLevel futureAlertLevel,
t.shipped,
t.totalWithVat,
sub2.shipped futureShipped,
@@ -47,6 +48,7 @@ BEGIN
t.addressFk,
t.id,
t.shipped,
+ ts.alertLevel,
st.name state,
st.code,
st.classColor,
diff --git a/db/routines/vn/procedures/ticket_close.sql b/db/routines/vn/procedures/ticket_close.sql
index 5db8afb23..0da001ffa 100644
--- a/db/routines/vn/procedures/ticket_close.sql
+++ b/db/routines/vn/procedures/ticket_close.sql
@@ -85,7 +85,7 @@ BEGIN
IF(vHasDailyInvoice) AND vHasToInvoice THEN
SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial;
- IF NOT vSerial THEN
+ IF vSerial IS NULL THEN
CALL util.throw('Cannot booking without a serial');
END IF;
diff --git a/db/routines/vn/procedures/ticket_setProblemRounding.sql b/db/routines/vn/procedures/ticket_setProblemRounding.sql
deleted file mode 100644
index e66288eab..000000000
--- a/db/routines/vn/procedures/ticket_setProblemRounding.sql
+++ /dev/null
@@ -1,37 +0,0 @@
-DELIMITER $$
-CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_setProblemRounding`(
- vSelf INT
-)
-BEGIN
-/**
- * Update the rounding problem for the sales lines of a ticket
- *
- * @param vSelf Id de ticket
- */
- DECLARE vWarehouseFk INT;
- DECLARE vDated DATE;
-
- SELECT warehouseFk, shipped
- INTO vWarehouseFk, vDated
- FROM ticket
- WHERE id = vSelf;
-
- CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
-
- CREATE OR REPLACE TEMPORARY TABLE tmp.sale
- (INDEX(saleFk, isProblemCalcNeeded))
- SELECT s.id saleFk ,
- MOD(s.quantity, b.`grouping`) hasProblem,
- ticket_isProblemCalcNeeded(t.id) isProblemCalcNeeded
- FROM ticket t
- JOIN sale s ON s.ticketFk = t.id
- JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
- JOIN buy b ON b.id = bu.buyFk
- WHERE t.id = vSelf;
-
- CALL sale_setProblem('hasRounding');
-
- DROP TEMPORARY TABLE tmp.sale;
- DROP TEMPORARY TABLE tmp.buyUltimate;
-END$$
-DELIMITER ;
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/00-firstScript.sql b/db/versions/11107-pinkAspidistra/00-firstScript.sql
new file mode 100644
index 000000000..62af9c306
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/00-firstScript.sql
@@ -0,0 +1,13 @@
+CREATE OR REPLACE TABLE `util`.`logCleanMultiConfig` (
+ `schemaName` varchar(64) NOT NULL,
+ `tableName` varchar(64) NOT NULL,
+ `retentionDays` int(11) DEFAULT NULL,
+ `order` int(11) DEFAULT NULL,
+ `started` datetime DEFAULT NULL,
+ `finished` datetime DEFAULT NULL,
+ PRIMARY KEY (`schemaName`,`tableName`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+
+INSERT INTO `util`.`logCleanMultiConfig` (`schemaName`, `tableName`)
+ SELECT TABLE_SCHEMA, TABLE_NAME FROM information_schema.`COLUMNS`
+ WHERE COLUMN_NAME IN ('newInstance', 'newInstance');
diff --git a/db/versions/11107-pinkAspidistra/01-firstScript.sql b/db/versions/11107-pinkAspidistra/01-firstScript.sql
new file mode 100644
index 000000000..426fcc5b8
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/01-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX userLog_creationDate_IDX USING BTREE ON account.userLog (creationDate DESC);
diff --git a/db/versions/11107-pinkAspidistra/02-firstScript.sql b/db/versions/11107-pinkAspidistra/02-firstScript.sql
new file mode 100644
index 000000000..e916754e3
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/02-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX roleLog_creationDate_IDX USING BTREE ON account.roleLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/03-firstScript.sql b/db/versions/11107-pinkAspidistra/03-firstScript.sql
new file mode 100644
index 000000000..f7400c866
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/03-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX ACLLog_creationDate_IDX USING BTREE ON salix.ACLLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/04-firstScript.sql b/db/versions/11107-pinkAspidistra/04-firstScript.sql
new file mode 100644
index 000000000..0c118284e
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/04-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX supplierLog_creationDate_IDX USING BTREE ON vn.supplierLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/05-firstScript.sql b/db/versions/11107-pinkAspidistra/05-firstScript.sql
new file mode 100644
index 000000000..5cb4070bb
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/05-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX deviceProductionLog_creationDate_IDX USING BTREE ON vn.deviceProductionLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/06-firstScript.sql b/db/versions/11107-pinkAspidistra/06-firstScript.sql
new file mode 100644
index 000000000..332b8a60a
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/06-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX routeLog_creationDate_IDX USING BTREE ON vn.routeLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/07-firstScript.sql b/db/versions/11107-pinkAspidistra/07-firstScript.sql
new file mode 100644
index 000000000..b80f8b75f
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/07-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX itemLog_creationDate_IDX USING BTREE ON vn.itemLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/08-firstScript.sql b/db/versions/11107-pinkAspidistra/08-firstScript.sql
new file mode 100644
index 000000000..315f9b256
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/08-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX userLog_creationDate_IDX USING BTREE ON vn.userLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/09-firstScript.sql b/db/versions/11107-pinkAspidistra/09-firstScript.sql
new file mode 100644
index 000000000..7bb604915
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/09-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX invoiceInLog_creationDate_IDX USING BTREE ON vn.invoiceInLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/10-firstScript.sql b/db/versions/11107-pinkAspidistra/10-firstScript.sql
new file mode 100644
index 000000000..06e186e0e
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/10-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX zoneLog_creationDate_IDX USING BTREE ON vn.zoneLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/11-firstScript.sql b/db/versions/11107-pinkAspidistra/11-firstScript.sql
new file mode 100644
index 000000000..be539e7b0
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/11-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX clientLog_creationDate_IDX USING BTREE ON vn.clientLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/12-firstScript.sql b/db/versions/11107-pinkAspidistra/12-firstScript.sql
new file mode 100644
index 000000000..4abc284b6
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/12-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX workerLog_creationDate_IDX USING BTREE ON vn.workerLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/14-firstScript.sql b/db/versions/11107-pinkAspidistra/14-firstScript.sql
new file mode 100644
index 000000000..02d2a37b0
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/14-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX rateLog_creationDate_IDX USING BTREE ON vn.rateLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/15-firstScript.sql b/db/versions/11107-pinkAspidistra/15-firstScript.sql
new file mode 100644
index 000000000..ad75ff6d0
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/15-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX claimLog_creationDate_IDX USING BTREE ON vn.claimLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/17-firstScript.sql b/db/versions/11107-pinkAspidistra/17-firstScript.sql
new file mode 100644
index 000000000..3de084bcf
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/17-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX packingSiteDeviceLog_creationDate_IDX USING BTREE ON vn.packingSiteDeviceLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/18-firstScript.sql b/db/versions/11107-pinkAspidistra/18-firstScript.sql
new file mode 100644
index 000000000..1181f8263
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/18-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX travelLog_creationDate_IDX USING BTREE ON vn.travelLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/19-firstScript.sql b/db/versions/11107-pinkAspidistra/19-firstScript.sql
new file mode 100644
index 000000000..e95f93031
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/19-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX shelvingLog_creationDate_IDX USING BTREE ON vn.shelvingLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/20-firstScript.sql b/db/versions/11107-pinkAspidistra/20-firstScript.sql
new file mode 100644
index 000000000..d3598466d
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/20-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX productionConfigLog_creationDate_IDX USING BTREE ON vn.productionConfigLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/21-firstScript.sql b/db/versions/11107-pinkAspidistra/21-firstScript.sql
new file mode 100644
index 000000000..5db8d3c63
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/21-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX entryLog_creationDate_IDX USING BTREE ON vn.entryLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/22-firstScript.sql b/db/versions/11107-pinkAspidistra/22-firstScript.sql
new file mode 100644
index 000000000..91e68c43b
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/22-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX agencyLog_creationDate_IDX USING BTREE ON vn.agencyLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/23-firstScript.sql b/db/versions/11107-pinkAspidistra/23-firstScript.sql
new file mode 100644
index 000000000..edd79473e
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/23-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX parkingLog_creationDate_IDX USING BTREE ON vn.parkingLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11107-pinkAspidistra/24-firstScript.sql b/db/versions/11107-pinkAspidistra/24-firstScript.sql
new file mode 100644
index 000000000..81e84c405
--- /dev/null
+++ b/db/versions/11107-pinkAspidistra/24-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX bufferLog_creationDate_IDX USING BTREE ON srt.bufferLog (creationDate DESC);
\ No newline at end of file
diff --git a/db/versions/11112-blackRose/00-firstScript.sql b/db/versions/11112-blackRose/00-firstScript.sql
new file mode 100644
index 000000000..c26149240
--- /dev/null
+++ b/db/versions/11112-blackRose/00-firstScript.sql
@@ -0,0 +1,13 @@
+UPDATE `salix`.`ACL`
+ SET accessType='READ'
+ WHERE model = 'ACL';
+
+UPDATE `salix`.`ACL`
+ SET principalId='developerBoss'
+ WHERE model = 'AccessToken';
+
+INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
+ VALUES
+ ('VnToken', '*', 'READ', 'ALLOW', 'ROLE', 'developer'),
+ ('VnToken', 'killSession', '*', 'ALLOW', 'ROLE', 'developer'),
+ ('ACL', '*', 'WRITE', 'ALLOW', 'ROLE', 'developerBoss');
diff --git a/db/versions/11124-greenBamboo/01-firstScript.sql b/db/versions/11124-greenBamboo/01-firstScript.sql
index 9cacbd5ff..af3a40f14 100644
--- a/db/versions/11124-greenBamboo/01-firstScript.sql
+++ b/db/versions/11124-greenBamboo/01-firstScript.sql
@@ -1,4 +1,5 @@
-- Calculamos todos los volumenes de todos los tickets una sola vez
+/* Se ejecutará el dia de test - master manualmente para no hacer lenta la subida
CREATE OR REPLACE TEMPORARY TABLE tmp.tTicketVolume
(PRIMARY KEY (id))
ENGINE = MEMORY
@@ -14,3 +15,4 @@ UPDATE vn.ticket t
SET t.volume = tv.volume;
DROP TEMPORARY TABLE tmp.tTicketVolume;
+*/
diff --git a/db/versions/11178-yellowCamellia/00-aclSetWeight.sql b/db/versions/11178-yellowCamellia/00-aclSetWeight.sql
new file mode 100644
index 000000000..d70287738
--- /dev/null
+++ b/db/versions/11178-yellowCamellia/00-aclSetWeight.sql
@@ -0,0 +1,9 @@
+-- Place your SQL code here
+INSERT INTO salix.ACL
+ SET model = 'Ticket',
+ property = 'setWeight',
+ accessType = 'WRITE',
+ permission = 'ALLOW',
+ principalType = 'ROLE',
+ principalId = 'salesPerson';
+
\ No newline at end of file
diff --git a/db/versions/11216-salmonPaniculata/00-firstScript.sql b/db/versions/11216-salmonPaniculata/00-firstScript.sql
new file mode 100644
index 000000000..956dcc25b
--- /dev/null
+++ b/db/versions/11216-salmonPaniculata/00-firstScript.sql
@@ -0,0 +1,12 @@
+-- Place your SQL code here
+DELETE FROM salix.ACL WHERE model = 'Province' LIMIT 1;
+DELETE FROM salix.ACL WHERE model = 'Town' LIMIT 1;
+
+UPDATE salix.ACL SET accessType = 'READ' WHERE model = 'BankEntity';
+INSERT INTO salix.ACL
+ SET model = 'BankEntity',
+ property = '*',
+ accessType = 'WRITE',
+ permission = 'ALLOW',
+ principalType = 'ROLE',
+ principalId = 'financial';
diff --git a/db/versions/11217-greenDracena/00-hederaMessages.sql b/db/versions/11217-greenDracena/00-hederaMessages.sql
new file mode 100644
index 000000000..f6c9bdce3
--- /dev/null
+++ b/db/versions/11217-greenDracena/00-hederaMessages.sql
@@ -0,0 +1,19 @@
+INSERT INTO hedera.message (code,description)
+ VALUES ('ORDER_ROW_UNAVAILABLE','The ordered quantity exceeds the available');
+INSERT INTO hedera.message (code,description)
+ VALUES ('AMOUNT_NOT_MATCH_GROUPING','The quantity ordered does not match the grouping');
+
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('ORDER_ROW_UNAVAILABLE','es','La cantidad pedida excede el disponible');
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('AMOUNT_NOT_MATCH_GROUPING','es','La cantidad pedida no coincide con el agrupado');
+
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('ORDER_ROW_UNAVAILABLE','fr','La quantité demandée dépasse ce qui est disponible');
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('AMOUNT_NOT_MATCH_GROUPING','fr','La quantité commandée ne correspond pas au regroupement');
+
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('ORDER_ROW_UNAVAILABLE','pt','A quantidade de entrega excede a disponibilidade');
+INSERT INTO hedera.messageI18n (code,lang,description)
+ VALUES ('AMOUNT_NOT_MATCH_GROUPING','pt','A quantidade solicitada não corresponde ao agrupamento');
diff --git a/db/versions/11219-goldenCataractarum/00-firstScript.sql b/db/versions/11219-goldenCataractarum/00-firstScript.sql
new file mode 100644
index 000000000..4c4b9eac5
--- /dev/null
+++ b/db/versions/11219-goldenCataractarum/00-firstScript.sql
@@ -0,0 +1 @@
+CREATE INDEX saleGroupLog_creationDate_IDX USING BTREE ON vn.saleGroupLog (creationDate DESC);
diff --git a/db/versions/11221-chocolateSalal/00-firstScript.sql b/db/versions/11221-chocolateSalal/00-firstScript.sql
new file mode 100644
index 000000000..bca742585
--- /dev/null
+++ b/db/versions/11221-chocolateSalal/00-firstScript.sql
@@ -0,0 +1,9 @@
+-- Place your SQL code here
+CREATE TABLE IF NOT EXISTS vn.ticketCanAdvanceConfig (
+ id int(10) unsigned NOT NULL,
+ destinationOrder INT NULL,
+ PRIMARY KEY (`id`),
+ CONSTRAINT `ticketCanAdvanceConfig_check` CHECK (`id` = 1)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
+
+INSERT INTO vn.ticketCanAdvanceConfig SET id =1, destinationOrder = 5;
\ No newline at end of file
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index 097c6e1ab..0a3892c86 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -687,8 +687,8 @@ export default {
ticketFuture: {
searchResult: 'vn-ticket-future tbody tr',
openAdvancedSearchButton: 'vn-searchbar .append vn-icon[icon="arrow_drop_down"]',
- originDated: 'vn-date-picker[label="Origin date"]',
- futureDated: 'vn-date-picker[label="Destination date"]',
+ originScopeDays: 'vn-date-picker[label="Origin date"]',
+ futureScopeDays: 'vn-date-picker[label="Destination date"]',
linesMax: 'vn-textfield[label="Max Lines"]',
litersMax: 'vn-textfield[label="Max Liters"]',
ipt: 'vn-autocomplete[label="Origin IPT"]',
diff --git a/e2e/paths/02-client/04_edit_billing_data.spec.js b/e2e/paths/02-client/04_edit_billing_data.spec.js
index 10eb85406..ca2c3b953 100644
--- a/e2e/paths/02-client/04_edit_billing_data.spec.js
+++ b/e2e/paths/02-client/04_edit_billing_data.spec.js
@@ -35,6 +35,14 @@ describe('Client Edit billing data path', () => {
it(`should attempt to edit the billing data without an IBAN but fail`, async() => {
await page.autocompleteSearch($.payMethod, 'PayMethod with IBAN');
+ await page.waitToClick($.saveButton);
+ const message = await page.waitForSnackbar();
+
+ expect(message.text).toContain('That payment method requires an IBAN');
+ });
+
+ it(`should edit the billing data and save the form`, async() => {
+ await page.autocompleteSearch($.payMethod, 'PayMethod five');
await page.autocompleteSearch($.swiftBic, 'BBKKESMMMMM');
await page.clearInput($.dueDay);
await page.write($.dueDay, '60');
@@ -45,10 +53,13 @@ describe('Client Edit billing data path', () => {
await page.waitToClick($.saveButton);
const message = await page.waitForSnackbar();
- expect(message.text).toContain('That payment method requires an IBAN');
+ expect(message.text).toContain('Notification sent!');
});
it(`should create a new BIC code`, async() => {
+ await page.loginAndModule('financial', 'client');
+ await page.accessToSearchResult('Bruce Banner');
+ await page.accessToSection('client.card.billingData');
await page.waitToClick($.newBankEntityButton);
await page.write($.newBankEntityName, 'Gotham City Bank');
await page.write($.newBankEntityBIC, 'GTHMCT');
@@ -66,7 +77,7 @@ describe('Client Edit billing data path', () => {
it(`should confirm the IBAN pay method was sucessfully saved`, async() => {
const payMethod = await page.waitToGetProperty($.payMethod, 'value');
- expect(payMethod).toEqual('PayMethod with IBAN');
+ expect(payMethod).toEqual('PayMethod five');
});
it(`should clear the BIC code field, update the IBAN to see how he BIC code autocompletes`, async() => {
@@ -79,14 +90,6 @@ describe('Client Edit billing data path', () => {
expect(automaticCode).toEqual('CAIXESBB');
});
- it(`should save the form with all its new data`, async() => {
- await page.waitForWatcherData($.watcher);
- await page.waitToClick($.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Notification sent!');
- });
-
it('should confirm the billing data have been edited', async() => {
const dueDate = await page.waitToGetProperty($.dueDay, 'value');
const IBAN = await page.waitToGetProperty($.IBAN, 'value');
@@ -94,7 +97,9 @@ describe('Client Edit billing data path', () => {
const receivedCoreLCR = await page.checkboxState($.receivedCoreLCRCheckbox);
const receivedCoreVNL = await page.checkboxState($.receivedCoreVNLCheckbox);
const receivedB2BVNL = await page.checkboxState($.receivedB2BVNLCheckbox);
+ const payMethod = await page.waitToGetProperty($.payMethod, 'value');
+ expect(payMethod).toEqual('PayMethod five');
expect(dueDate).toEqual('60');
expect(IBAN).toEqual('ES9121000418450200051332');
expect(swiftBic).toEqual('CAIXESBB');
diff --git a/e2e/paths/05-ticket/21_future.spec.js b/e2e/paths/05-ticket/21_future.spec.js
index 7b7d478f7..60bb9c38d 100644
--- a/e2e/paths/05-ticket/21_future.spec.js
+++ b/e2e/paths/05-ticket/21_future.spec.js
@@ -30,18 +30,18 @@ describe('Ticket Future path', () => {
expect(message.text).toContain('warehouseFk is a required argument');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
- await page.clearInput(selectors.ticketFuture.futureDated);
+ await page.clearInput(selectors.ticketFuture.futureScopeDays);
await page.waitToClick(selectors.ticketFuture.submit);
message = await page.waitForSnackbar();
- expect(message.text).toContain('futureDated is a required argument');
+ expect(message.text).toContain('futureScopeDays is a required argument');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
- await page.clearInput(selectors.ticketFuture.originDated);
+ await page.clearInput(selectors.ticketFuture.originScopeDays);
await page.waitToClick(selectors.ticketFuture.submit);
message = await page.waitForSnackbar();
- expect(message.text).toContain('originDated is a required argument');
+ expect(message.text).toContain('originScopeDays is a required argument');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.waitToClick(selectors.ticketFuture.submit);
@@ -71,7 +71,7 @@ describe('Ticket Future path', () => {
await page.autocompleteSearch(selectors.ticketFuture.state, 'Free');
await page.waitToClick(selectors.ticketFuture.submit);
- expect(httpRequest).toContain('state=FREE');
+ expect(httpRequest).toContain('state=0');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
@@ -80,7 +80,7 @@ describe('Ticket Future path', () => {
await page.autocompleteSearch(selectors.ticketFuture.futureState, 'Free');
await page.waitToClick(selectors.ticketFuture.submit);
- expect(httpRequest).toContain('futureState=FREE');
+ expect(httpRequest).toContain('futureState=0');
await page.waitToClick(selectors.ticketFuture.openAdvancedSearchButton);
await page.clearInput(selectors.ticketFuture.state);
diff --git a/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js b/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js
deleted file mode 100644
index a2e194e42..000000000
--- a/e2e/paths/13-supplier/01_summary_and_descriptor.spec.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier summary & descriptor path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'supplier');
- await page.accessToSearchResult('1');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- // summary
- it('should reach the second entry summary section', async() => {
- await page.waitForState('supplier.card.summary');
- });
-
- it(`should confirm there's data on the summary header`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierSummary.header, 'innerText');
-
- expect(result).toContain('PLANTS SL - 1');
- });
-
- it(`should confirm there's data on the summary basic data`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierSummary.basicDataId, 'innerText');
-
- expect(result).toContain('Id 1');
- });
-
- it(`should confirm there's data on the summary fiscal address`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierSummary.fiscalAddressTaxNumber, 'innerText');
-
- expect(result).toContain('Tax number 06089160W');
- });
-
- it(`should confirm there's data on the summary fiscal pay method`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierSummary.billingDataPayMethod, 'innerText');
-
- expect(result).toContain('Pay method PayMethod one');
- });
-
- // descriptor
- it(`should confirm there's data on the descriptor`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierDescriptor.alias, 'innerText');
-
- expect(result).toContain('Plants nick');
- });
-
- it(`should navigate to the supplier's client summary using the icon client button`, async() => {
- await page.waitToClick(selectors.supplierDescriptor.clientButton);
- await page.waitForState('client.card.summary');
- });
-
- it(`should navigate back to the supplier`, async() => {
- await page.waitToClick(selectors.globalItems.homeButton);
- await page.waitForState('home');
- await page.selectModule('supplier');
- await page.accessToSearchResult('1');
- await page.waitForState('supplier.card.summary');
- });
-
- it(`should navigate back to suppliers but a different one this time`, async() => {
- await page.waitToClick(selectors.globalItems.homeButton);
- await page.waitForState('home');
- await page.selectModule('supplier');
- await page.accessToSearchResult('2');
- await page.waitForState('supplier.card.summary');
- });
-
- it(`should check the client button isn't present since this supplier should not be a client`, async() => {
- await page.waitForSelector(selectors.supplierDescriptor.clientButton, {visible: false});
- });
-});
diff --git a/e2e/paths/13-supplier/02_basic_data.spec.js b/e2e/paths/13-supplier/02_basic_data.spec.js
deleted file mode 100644
index 710ebd8df..000000000
--- a/e2e/paths/13-supplier/02_basic_data.spec.js
+++ /dev/null
@@ -1,67 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier basic data path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('financial', 'supplier');
- await page.accessToSearchResult('1');
- await page.accessToSection('supplier.card.basicData');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should edit the basic data', async() => {
- await page.clearInput(selectors.supplierBasicData.alias);
- await page.write(selectors.supplierBasicData.alias, 'Plants Nick SL');
- await page.waitToClick(selectors.supplierBasicData.isReal);
- await page.waitToClick(selectors.supplierBasicData.isActive);
- await page.waitToClick(selectors.supplierBasicData.isPayMethodChecked);
- await page.write(selectors.supplierBasicData.notes, 'Some notes');
-
- await page.waitToClick(selectors.supplierBasicData.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should reload the section', async() => {
- await page.reloadSection('supplier.card.basicData');
- });
-
- it('should check the alias was edited', async() => {
- const result = await page.waitToGetProperty(selectors.supplierBasicData.alias, 'value');
-
- expect(result).toEqual('Plants Nick SL');
- });
-
- it('should check the isReal checkbox is now checked', async() => {
- const result = await page.checkboxState(selectors.supplierBasicData.isReal);
-
- expect(result).toBe('checked');
- });
-
- it('should check the isActive checkbox is now unchecked', async() => {
- const result = await page.checkboxState(selectors.supplierBasicData.isActive);
-
- expect(result).toBe('unchecked');
- });
-
- it('should check the isPayMethodChecked checkbox is now unchecked', async() => {
- const result = await page.checkboxState(selectors.supplierBasicData.isPayMethodChecked);
-
- expect(result).toBe('unchecked');
- });
-
- it('should check the notes were edited', async() => {
- const result = await page.waitToGetProperty(selectors.supplierBasicData.notes, 'value');
-
- expect(result).toEqual('Some notes');
- });
-});
diff --git a/e2e/paths/13-supplier/03_fiscal_data.spec.js b/e2e/paths/13-supplier/03_fiscal_data.spec.js
deleted file mode 100644
index ccd9d7809..000000000
--- a/e2e/paths/13-supplier/03_fiscal_data.spec.js
+++ /dev/null
@@ -1,56 +0,0 @@
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier fiscal data path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'supplier');
- await page.accessToSearchResult('2');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should attempt to edit the fiscal data and check data iss saved', async() => {
- await page.accessToSection('supplier.card.fiscalData');
-
- const form = 'vn-supplier-fiscal-data form';
- const values = {
- province: null,
- country: null,
- postcode: null,
- city: 'Valencia',
- socialName: 'FARMER KING SL',
- taxNumber: '12345678Z',
- account: '0123456789',
- sageWithholding: 'retencion estimacion objetiva',
- sageTaxType: 'operaciones no sujetas'
- };
-
- const errorMessage = await page.sendForm(form, {
- taxNumber: 'Wrong tax number'
- });
- const message = await page.sendForm(form, values);
-
- await page.reloadSection('supplier.card.fiscalData');
- const formValues = await page.fetchForm(form, Object.keys(values));
-
- expect(errorMessage.text).toContain('Invalid Tax number');
- expect(message.isSuccess).toBeTrue();
- expect(formValues).toEqual({
- province: 'Province one',
- country: 'España',
- postcode: '46000',
- city: 'Valencia',
- socialName: 'FARMER KING SL',
- taxNumber: '12345678Z',
- account: '0123456789',
- sageWithholding: 'RETENCION ESTIMACION OBJETIVA',
- sageTaxType: 'Operaciones no sujetas'
- });
- });
-});
diff --git a/e2e/paths/13-supplier/04_billing_data.spec.js b/e2e/paths/13-supplier/04_billing_data.spec.js
deleted file mode 100644
index d3cb6dcab..000000000
--- a/e2e/paths/13-supplier/04_billing_data.spec.js
+++ /dev/null
@@ -1,52 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier billing data path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'supplier');
- await page.accessToSearchResult('442');
- await page.accessToSection('supplier.card.billingData');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should edit the billing data', async() => {
- await page.autocompleteSearch(selectors.supplierBillingData.payMethod, 'PayMethod with IBAN');
- await page.autocompleteSearch(selectors.supplierBillingData.payDem, '10');
- await page.clearInput(selectors.supplierBillingData.payDay);
- await page.write(selectors.supplierBillingData.payDay, '19');
- await page.waitToClick(selectors.supplierBillingData.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should reload the section', async() => {
- await page.reloadSection('supplier.card.billingData');
- });
-
- it('should check the pay method was edited', async() => {
- const result = await page.waitToGetProperty(selectors.supplierBillingData.payMethod, 'value');
-
- expect(result).toEqual('PayMethod with IBAN');
- });
-
- it('should check the payDem was edited', async() => {
- const result = await page.waitToGetProperty(selectors.supplierBillingData.payDem, 'value');
-
- expect(result).toEqual('10');
- });
-
- it('should check the pay day was edited', async() => {
- const result = await page.waitToGetProperty(selectors.supplierBillingData.payDay, 'value');
-
- expect(result).toEqual('19');
- });
-});
diff --git a/e2e/paths/13-supplier/05_address.spec.js b/e2e/paths/13-supplier/05_address.spec.js
deleted file mode 100644
index 5bccba3ee..000000000
--- a/e2e/paths/13-supplier/05_address.spec.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier address path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('employee', 'supplier');
- await page.accessToSearchResult('1');
- await page.accessToSection('supplier.card.address.index');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should count the addresses before creating one', async() => {
- const count = await page.countElement(selectors.supplierAddress.anyAddress);
-
- expect(count).toEqual(2);
- });
-
- it('should open the new address form by clicking the add button', async() => {
- await page.waitToClick(selectors.supplierAddress.newAddress);
- await page.waitForState('supplier.card.address.create');
- });
-
- it('should create a new address', async() => {
- await page.write(selectors.supplierAddress.newNickname, 'Darkest dungeon');
- await page.write(selectors.supplierAddress.newStreet, 'Wayne manor');
- await page.write(selectors.supplierAddress.newPostcode, '46000');
- await page.write(selectors.supplierAddress.newCity, 'Valencia');
- await page.autocompleteSearch(selectors.supplierAddress.newProvince, 'Province one');
- await page.write(selectors.supplierAddress.newPhone, '888888888');
- await page.write(selectors.supplierAddress.newMobile, '444444444');
- await page.waitToClick(selectors.supplierAddress.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should have been redirected to the addresses index', async() => {
- await page.waitForState('supplier.card.address.index');
- });
-
- it('should count the addresses and find one more now', async() => {
- const count = await page.countElement(selectors.supplierAddress.anyAddress);
-
- expect(count).toEqual(3);
- });
-
- it('should open the edit address form by clicking the new address', async() => {
- await page.waitToClick(selectors.supplierAddress.thirdAddress);
- await page.waitForState('supplier.card.address.edit');
- });
-
- it('should edit the address', async() => {
- await page.overwrite(selectors.supplierAddress.editNickname, 'Wayne manor');
- await page.overwrite(selectors.supplierAddress.editStreet, '1007 Mountain Drive');
- await page.overwrite(selectors.supplierAddress.editPostcode, '46000');
- await page.overwrite(selectors.supplierAddress.editCity, 'Valencia');
- await page.autocompleteSearch(selectors.supplierAddress.editProvince, 'Province one');
- await page.overwrite(selectors.supplierAddress.editPhone, '777777777');
- await page.overwrite(selectors.supplierAddress.editMobile, '555555555');
- await page.waitToClick(selectors.supplierAddress.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it('should check the address has now the expected data', async() => {
- let thirdAddress = await page.waitToGetProperty(selectors.supplierAddress.thirdAddress, 'innerText');
-
- expect(thirdAddress).toContain('Wayne manor');
- });
-});
diff --git a/e2e/paths/13-supplier/06_contact.spec.js b/e2e/paths/13-supplier/06_contact.spec.js
deleted file mode 100644
index 60fd28f9c..000000000
--- a/e2e/paths/13-supplier/06_contact.spec.js
+++ /dev/null
@@ -1,89 +0,0 @@
-import selectors from '../../helpers/selectors.js';
-import getBrowser from '../../helpers/puppeteer';
-
-describe('Supplier contact path', () => {
- let browser;
- let page;
-
- beforeAll(async() => {
- browser = await getBrowser();
- page = browser.page;
- await page.loginAndModule('administrative', 'supplier');
- await page.accessToSearchResult('1');
- await page.accessToSection('supplier.card.contact');
- });
-
- afterAll(async() => {
- await browser.close();
- });
-
- it('should create a new contact', async() => {
- await page.waitToClick(selectors.supplierContact.addNewContact);
- await page.write(selectors.supplierContact.thirdContactName, 'The tester');
- await page.write(selectors.supplierContact.thirdContactPhone, '99 999 99 99');
- await page.write(selectors.supplierContact.thirdContactMobile, '555 55 55 55');
- await page.write(selectors.supplierContact.thirdContactEmail, 'testing@puppeteer.com');
- await page.write(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester');
- await page.waitToClick(selectors.supplierContact.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it(`should reload the section and count the contacts`, async() => {
- await page.reloadSection('supplier.card.contact');
- const result = await page.countElement(selectors.supplierContact.anyContact);
-
- expect(result).toEqual(3);
- });
-
- it(`should check the new contact name was saved correctly`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactName, 'value');
-
- expect(result).toContain('The tester');
- });
-
- it(`should check the new contact phone was saved correctly`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactPhone, 'value');
-
- expect(result).toContain('99 999 99 99');
- });
-
- it(`should check the new contact mobile was saved correctly`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactMobile, 'value');
-
- expect(result).toContain('555 55 55 55');
- });
-
- it(`should check the new contact email was saved correctly`, async() => {
- const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactEmail, 'value');
-
- expect(result).toContain('testing@puppeteer.com');
- });
-
- it(`should check the new contact note was saved correctly`, async() => {
- await page.waitForTextInField(selectors.supplierContact.thirdContactNotes, 'the end to end integration tester');
- const result = await page.waitToGetProperty(selectors.supplierContact.thirdContactNotes, 'value');
-
- expect(result).toContain('the end to end integration tester');
- });
-
- it(`should remove the created contact`, async() => {
- await page.waitToClick(selectors.supplierContact.thirdContactDeleteButton, 'value');
- const result = await page.countElement(selectors.supplierContact.anyContact);
-
- expect(result).toEqual(2);
-
- await page.waitToClick(selectors.supplierContact.saveButton);
- const message = await page.waitForSnackbar();
-
- expect(message.text).toContain('Data saved!');
- });
-
- it(`should reload the section and count the amount of contacts went back to 2`, async() => {
- await page.reloadSection('supplier.card.contact');
- const result = await page.countElement(selectors.supplierContact.anyContact);
-
- expect(result).toEqual(2);
- });
-});
diff --git a/loopback/common/models/vn-model.js b/loopback/common/models/vn-model.js
index a11bed11d..e24653d13 100644
--- a/loopback/common/models/vn-model.js
+++ b/loopback/common/models/vn-model.js
@@ -33,7 +33,7 @@ module.exports = function(Self) {
const defaultLimit = this.app.orm.selectLimit;
const filter = ctx.args.filter || {limit: defaultLimit};
- if (filter.limit > defaultLimit) {
+ if (!filter.limit || filter.limit > defaultLimit) {
filter.limit = defaultLimit;
ctx.args.filter = filter;
}
@@ -349,9 +349,10 @@ module.exports = function(Self) {
},
hasFilter(ctx) {
- return ctx.req.method.toUpperCase() === 'GET' &&
- ctx.method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object');
- }
-
+ const {method, req} = ctx;
+ if (method.noLimit) return false;
+ return req.method.toUpperCase() === 'GET' &&
+ method.accepts.some(x => x.arg === 'filter' && x.type.toLowerCase() === 'object');
+ },
});
};
diff --git a/loopback/locale/es.json b/loopback/locale/es.json
index 8b443d96b..064ea4a95 100644
--- a/loopback/locale/es.json
+++ b/loopback/locale/es.json
@@ -372,5 +372,7 @@
"The entry not have stickers": "La entrada no tiene etiquetas",
"Too many records": "Demasiados registros",
"Original invoice not found": "Factura original no encontrada",
- "The entry has no lines or does not exist": "La entrada no tiene lineas o no existe"
+ "The entry has no lines or does not exist": "La entrada no tiene lineas o no existe",
+ "Weight already set": "El peso ya está establecido",
+ "This ticket is not allocated to your department": "Este ticket no está asignado a tu departamento"
}
\ No newline at end of file
diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js
index 0a8ebcae5..dc19c5d81 100644
--- a/modules/client/back/models/client.js
+++ b/modules/client/back/models/client.js
@@ -320,7 +320,8 @@ module.exports = Self => {
// Credit management changes
- if (changes?.rating >= 0 || changes?.recommendedCredit >= 0)
+ if ((changes?.rating != null && changes.rating >= 0)
+ || (changes?.recommendedCredit != null && changes.recommendedCredit >= 0))
await Self.changeCreditManagement(ctx, finalState, changes);
const oldInstance = {};
diff --git a/modules/item/back/methods/fixed-price/filter.js b/modules/item/back/methods/fixed-price/filter.js
index edc804dc4..488c2441d 100644
--- a/modules/item/back/methods/fixed-price/filter.js
+++ b/modules/item/back/methods/fixed-price/filter.js
@@ -128,6 +128,9 @@ module.exports = Self => {
return {[param]: value};
}
});
+ if (ctx.req.query?.showBadDates === 'true')
+ where['fp.started'] = {gte: Date.vnNew()};
+
filter = mergeFilters(filter, {where});
const stmts = [];
@@ -136,6 +139,7 @@ module.exports = Self => {
SELECT DISTINCT fp.id,
fp.itemFk,
fp.warehouseFk,
+ w.name warehouseName,
fp.rate2,
fp.rate3,
fp.started,
@@ -159,6 +163,7 @@ module.exports = Self => {
FROM priceFixed fp
JOIN item i ON i.id = fp.itemFk
JOIN itemType it ON it.id = i.typeFk
+ JOIN warehouse w ON fp.warehouseFk = w.id
`);
if (ctx.args.tags) {
@@ -184,7 +189,6 @@ module.exports = Self => {
}
stmt.merge(conn.makeSuffix(filter));
-
const fixedPriceIndex = stmts.push(stmt) - 1;
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions);
diff --git a/modules/item/back/methods/item/getBalance.js b/modules/item/back/methods/item/getBalance.js
index 207f8020f..c835cd56f 100644
--- a/modules/item/back/methods/item/getBalance.js
+++ b/modules/item/back/methods/item/getBalance.js
@@ -16,7 +16,8 @@ module.exports = Self => {
http: {
path: `/getBalance`,
verb: 'GET'
- }
+ },
+ noLimit: true
});
Self.getBalance = async(ctx, filter, options) => {
diff --git a/modules/monitor/back/methods/sales-monitor/salesFilter.js b/modules/monitor/back/methods/sales-monitor/salesFilter.js
index 8ef51a0d1..927f49999 100644
--- a/modules/monitor/back/methods/sales-monitor/salesFilter.js
+++ b/modules/monitor/back/methods/sales-monitor/salesFilter.js
@@ -285,7 +285,7 @@ module.exports = Self => {
if (hasProblems === true) {
whereProblems = {or: [
{'tp.isFreezed': true},
- {'tp.risk': {lt: 0}},
+ {'tp.hasRisk': true},
{'tp.hasTicketRequest': true},
{'tp.hasComponentLack': true},
{'tp.isTaxDataChecked': false},
@@ -295,7 +295,7 @@ module.exports = Self => {
} else if (hasProblems === false) {
whereProblems = {and: [
{'tp.isFreezed': false},
- {'tp.risk': 0},
+ {'tp.hasRisk': false},
{'tp.hasTicketRequest': false},
{'tp.hasComponentLack': false},
{'tp.isTaxDataChecked': true},
diff --git a/modules/supplier/front/account/index.html b/modules/supplier/front/account/index.html
deleted file mode 100644
index a0b58c737..000000000
--- a/modules/supplier/front/account/index.html
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/supplier/front/account/index.js b/modules/supplier/front/account/index.js
deleted file mode 100644
index 5629e65d3..000000000
--- a/modules/supplier/front/account/index.js
+++ /dev/null
@@ -1,66 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-class Controller extends Section {
- constructor($element, $) {
- super($element, $);
- this.include = {
- relation: 'bankEntity',
- scope: {
- fields: ['countryFk', 'id', 'name', 'bic']
- }
- };
- const filter = {
- where: {code: 'wireTransfer'}
- };
-
- this.$http.get(`payMethods/findOne`, {filter})
- .then(res => {
- this.wireTransferFk = res.data.id;
- });
- }
-
- add() {
- this.$.model.insert({
- supplierFk: this.$params.id
- });
- }
-
- onAccept(data) {
- const accounts = this.supplierAccounts;
- const targetAccount = accounts[data.index];
- targetAccount.bankEntityFk = data.id;
- }
-
- onSubmit() {
- this.$.watcher.check();
- return this.$.model.save()
- .then(() => {
- this.$.watcher.notifySaved();
- this.$.watcher.updateOriginalData();
- return this.card.reload();
- })
- .then(() => {
- if (this.supplier.payMethodFk != this.wireTransferFk)
- this.$.payMethodToTransfer.show();
- });
- }
-
- setWireTransfer() {
- const params = {
- id: this.$params.id,
- payMethodFk: this.wireTransferFk
- };
- const query = `Suppliers/${this.$params.id}`;
- return this.$http.patch(query, params)
- .then(() => this.$.watcher.notifySaved());
- }
-}
-
-ngModule.vnComponent('vnSupplierAccount', {
- template: require('./index.html'),
- controller: Controller,
- require: {
- card: '^vnSupplierCard'
- }
-});
diff --git a/modules/supplier/front/account/index.spec.js b/modules/supplier/front/account/index.spec.js
deleted file mode 100644
index ad29d1abc..000000000
--- a/modules/supplier/front/account/index.spec.js
+++ /dev/null
@@ -1,98 +0,0 @@
-import './index.js';
-import watcher from 'core/mocks/watcher';
-import crudModel from 'core/mocks/crud-model';
-
-describe('Supplier Component vnSupplierAccount', () => {
- let $scope;
- let controller;
- let $httpBackend;
-
- beforeEach(ngModule('supplier'));
-
- beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
- $httpBackend = _$httpBackend_;
- $scope = $rootScope.$new();
- $scope.model = crudModel;
- $scope.watcher = watcher;
-
- $scope.bankEntity = {
- open: () => {}
- };
-
- const $element = angular.element('');
- controller = $componentController('vnSupplierAccount', {$element, $scope});
- controller.supplierAccount = {
- supplierFk: 442,
- name: 'Verdnatura'
- };
- }));
-
- describe('onAccept()', () => {
- it('should set the created bank entity id into the target account', () => {
- controller.supplierAccounts = [{}, {}, {}];
-
- const data = {
- id: 999,
- index: 1
- };
-
- controller.onAccept(data);
-
- const targetAccount = controller.supplierAccounts[data.index];
-
- expect(targetAccount.bankEntityFk).toEqual(data.id);
- });
- });
-
- describe('onSubmit()', () => {
- it(`should reload the card`, done => {
- controller.card = {reload: () => {}};
- controller.$.payMethodToTransfer = {show: () => {}};
- jest.spyOn(controller.$.payMethodToTransfer, 'show');
- jest.spyOn(controller.$.model, 'save').mockReturnValue(new Promise(resolve => {
- return resolve({
- id: 1234
- });
- }));
- jest.spyOn(controller.card, 'reload').mockReturnValue(new Promise(resolve => {
- return resolve({
- id: 1234
- });
- }));
-
- controller.wireTransferFk = 'a';
- controller.supplier = {payMethodFk: 'b'};
- controller.onSubmit().then(() => {
- expect(controller.card.reload).toHaveBeenCalledWith();
- expect(controller.$.payMethodToTransfer.show).toHaveBeenCalled();
- done();
- }).catch(done.fail);
- });
- });
-
- describe('setWireTransfer()', () => {
- it(`should make HTTP PATCH request to set wire transfer and call notifySaved`, () => {
- const supplierId = 1;
- const params = {
- id: supplierId,
- payMethodFk: 2
- };
- const response = {
- data: {id: 2}
- };
- const uri = 'payMethods/findOne?filter=%7B%22where%22:%7B%22code%22:%22wireTransfer%22%7D%7D';
- jest.spyOn($scope.watcher, 'notifySaved');
-
- controller.$params.id = supplierId;
- controller.wireTransferFk = 2;
- controller.supplier = {payMethodFk: 1};
- $httpBackend.expectGET(uri).respond(response);
- $httpBackend.expectPATCH(`Suppliers/${supplierId}`, params).respond();
- controller.setWireTransfer();
- $httpBackend.flush();
-
- expect($scope.watcher.notifySaved).toHaveBeenCalledWith();
- });
- });
-});
-
diff --git a/modules/supplier/front/account/locale/en.yml b/modules/supplier/front/account/locale/en.yml
deleted file mode 100644
index f41f5756a..000000000
--- a/modules/supplier/front/account/locale/en.yml
+++ /dev/null
@@ -1 +0,0 @@
-Beneficiary information: Name of the bank account holder if different from the provider
\ No newline at end of file
diff --git a/modules/supplier/front/account/locale/es.yml b/modules/supplier/front/account/locale/es.yml
deleted file mode 100644
index f445a3fb8..000000000
--- a/modules/supplier/front/account/locale/es.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-Bank entity: Entidad bancaria
-swift: Swift BIC
-Add account: Añadir cuenta
-Beneficiary: Beneficiario
-Beneficiary information: Nombre del titular de la cuenta bancaria en caso de ser diferente del proveedor
-Do you want to change the pay method to wire transfer?: ¿Quieres modificar la forma de pago a transferencia?
\ No newline at end of file
diff --git a/modules/supplier/front/address/create/index.html b/modules/supplier/front/address/create/index.html
deleted file mode 100644
index e3f883641..000000000
--- a/modules/supplier/front/address/create/index.html
+++ /dev/null
@@ -1,109 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/modules/supplier/front/address/create/index.js b/modules/supplier/front/address/create/index.js
deleted file mode 100644
index 21b845881..000000000
--- a/modules/supplier/front/address/create/index.js
+++ /dev/null
@@ -1,74 +0,0 @@
-import ngModule from '../../module';
-import Section from 'salix/components/section';
-
-export default class Controller extends Section {
- constructor($element, $) {
- super($element, $);
-
- this.address = {
- supplierFk: this.$params.id
- };
- }
-
- onSubmit() {
- this.$.watcher.submit().then(res => {
- this.$state.go('supplier.card.address.index');
- });
- }
-
- get town() {
- return this._town;
- }
-
- // Town auto complete
- set town(selection) {
- this._town = selection;
-
- if (!selection) return;
-
- const province = selection.province;
- const postcodes = selection.postcodes;
-
- if (!this.address.provinceFk)
- this.address.provinceFk = province.id;
-
- if (postcodes.length === 1)
- this.address.postalCode = postcodes[0].code;
- }
-
- get postcode() {
- return this._postcode;
- }
-
- // Postcode auto complete
- set postcode(selection) {
- this._postcode = selection;
-
- if (!selection) return;
-
- const town = selection.town;
- const province = town.province;
-
- if (!this.address.city)
- this.address.city = town.name;
-
- if (!this.address.provinceFk)
- this.address.provinceFk = province.id;
- }
-
- onResponse(response) {
- this.address.postalCode = response.code;
- this.address.city = response.city;
- this.address.provinceFk = response.provinceFk;
- }
-}
-
-Controller.$inject = ['$element', '$scope'];
-
-ngModule.vnComponent('vnSupplierAddressCreate', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- supplier: '<'
- }
-});
diff --git a/modules/supplier/front/address/create/index.spec.js b/modules/supplier/front/address/create/index.spec.js
deleted file mode 100644
index 026de3769..000000000
--- a/modules/supplier/front/address/create/index.spec.js
+++ /dev/null
@@ -1,102 +0,0 @@
-import './index';
-import watcher from 'core/mocks/watcher';
-
-describe('Supplier', () => {
- describe('Component vnSupplierAddressCreate', () => {
- let $scope;
- let controller;
- let $element;
- let $state;
-
- beforeEach(ngModule('supplier'));
-
- beforeEach(inject(($componentController, $rootScope, _$state_) => {
- $scope = $rootScope.$new();
- $state = _$state_;
- $state.params.id = '1234';
- $element = angular.element('');
- controller = $componentController('vnSupplierAddressCreate', {$element, $scope});
- controller.$.watcher = watcher;
- controller.$.watcher.submit = () => {
- return {
- then: callback => {
- callback({data: {id: 124}});
- }
- };
- };
- controller.supplier = {id: 1};
- }));
-
- describe('onSubmit()', () => {
- it('should perform a PATCH and then redirect to the main section', () => {
- jest.spyOn(controller.$state, 'go');
- controller.onSubmit();
-
- expect(controller.$state.go).toHaveBeenCalledWith('supplier.card.address.index');
- });
- });
-
- describe('town() setter', () => {
- it(`should set provinceFk property`, () => {
- controller.town = {
- provinceFk: 1,
- code: 46001,
- province: {
- id: 1,
- name: 'New york',
- country: {
- id: 2,
- name: 'USA'
- }
- },
- postcodes: []
- };
-
- expect(controller.address.provinceFk).toEqual(1);
- });
-
- it(`should set provinceFk property and fill the postalCode if there's just one`, () => {
- controller.town = {
- provinceFk: 1,
- code: 46001,
- province: {
- id: 1,
- name: 'New york',
- country: {
- id: 2,
- name: 'USA'
- }
- },
- postcodes: [{code: '46001'}]
- };
-
- expect(controller.address.provinceFk).toEqual(1);
- expect(controller.address.postalCode).toEqual('46001');
- });
- });
-
- describe('postcode() setter', () => {
- it(`should set the town and province properties`, () => {
- controller.postcode = {
- townFk: 1,
- code: 46001,
- town: {
- id: 1,
- name: 'New York',
- province: {
- id: 1,
- name: 'New york',
- country: {
- id: 2,
- name: 'USA'
- }
- }
- }
- };
-
- expect(controller.address.city).toEqual('New York');
- expect(controller.address.provinceFk).toEqual(1);
- });
- });
- });
-});
diff --git a/modules/supplier/front/address/edit/index.html b/modules/supplier/front/address/edit/index.html
deleted file mode 100644
index b966023da..000000000
--- a/modules/supplier/front/address/edit/index.html
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/supplier/front/address/edit/index.js b/modules/supplier/front/address/edit/index.js
deleted file mode 100644
index 4c7450666..000000000
--- a/modules/supplier/front/address/edit/index.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import ngModule from '../../module';
-import Section from 'salix/components/section';
-
-export default class Controller extends Section {
- onSubmit() {
- this.$.watcher.submit()
- .then(() => this.$state.go('supplier.card.address.index'));
- }
-
- get town() {
- return this._town;
- }
-
- // Town auto complete
- set town(selection) {
- const oldValue = this._town;
- this._town = selection;
-
- if (!selection || !oldValue) return;
-
- const province = selection.province;
- const postcodes = selection.postcodes;
-
- if (!this.address.provinceFk)
- this.address.provinceFk = province.id;
-
- if (!this.address.postalCode && postcodes.length === 1)
- this.address.postalCode = postcodes[0].code;
- }
-
- get postcode() {
- return this._postcode;
- }
-
- // Postcode auto complete
- set postcode(selection) {
- const oldValue = this._postcode;
- this._postcode = selection;
-
- if (!selection || !oldValue) return;
-
- const town = selection.town;
- const province = town.province;
-
- if (!this.address.city)
- this.address.city = town.name;
-
- if (!this.address.provinceFk)
- this.address.provinceFk = province.id;
- }
-
- onResponse(response) {
- this.address.postalCode = response.code;
- this.address.city = response.city;
- this.address.provinceFk = response.provinceFk;
- }
-}
-
-ngModule.vnComponent('vnSupplierAddressEdit', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/supplier/front/address/edit/index.spec.js b/modules/supplier/front/address/edit/index.spec.js
deleted file mode 100644
index 991163baa..000000000
--- a/modules/supplier/front/address/edit/index.spec.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import './index';
-import watcher from 'core/mocks/watcher';
-
-describe('Supplier', () => {
- describe('Component vnSupplierAddressEdit', () => {
- let $scope;
- let controller;
- let $element;
- let $state;
-
- beforeEach(ngModule('supplier'));
-
- beforeEach(inject(($componentController, $rootScope, _$state_) => {
- $scope = $rootScope.$new();
- $state = _$state_;
- $state.params.addressId = '1';
- $element = angular.element('');
- controller = $componentController('vnSupplierAddressEdit', {$element, $scope});
- controller.address = {id: 1};
- controller.$.watcher = watcher;
- controller.$.watcher.submit = () => {
- return {
- then: callback => {
- callback({data: {id: 124}});
- }
- };
- };
- }));
-
- describe('onSubmit()', () => {
- it('should perform a PATCH and then redirect to the main section', () => {
- jest.spyOn(controller.$state, 'go');
- controller.onSubmit();
-
- expect(controller.$state.go).toHaveBeenCalledWith('supplier.card.address.index');
- });
- });
- });
-});
diff --git a/modules/supplier/front/address/index/index.html b/modules/supplier/front/address/index/index.html
deleted file mode 100644
index cb7b3d56c..000000000
--- a/modules/supplier/front/address/index/index.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/supplier/front/address/index/index.js b/modules/supplier/front/address/index/index.js
deleted file mode 100644
index c3985a0c1..000000000
--- a/modules/supplier/front/address/index/index.js
+++ /dev/null
@@ -1,46 +0,0 @@
-import ngModule from '../../module';
-import Section from 'salix/components/section';
-import './style.scss';
-
-class Controller extends Section {
- constructor($element, $) {
- super($element, $);
- this.filter = {
- fields: [
- 'id',
- 'nickname',
- 'street',
- 'city',
- 'provinceFk',
- 'phone',
- 'mobile',
- 'postalCode'
- ],
- order: ['nickname ASC'],
- include: [{
- relation: 'province',
- scope: {
- fields: ['id', 'name']
- }
- }]
- };
- }
-
- exprBuilder(param, value) {
- switch (param) {
- case 'search':
- return /^\d+$/.test(value)
- ? {id: value}
- : {nickname: {like: `%${value}%`}};
- }
- }
-}
-Controller.$inject = ['$element', '$scope'];
-
-ngModule.vnComponent('vnSupplierAddressIndex', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- supplier: '<'
- }
-});
diff --git a/modules/supplier/front/address/index/index.spec.js b/modules/supplier/front/address/index/index.spec.js
deleted file mode 100644
index 086d3a9fa..000000000
--- a/modules/supplier/front/address/index/index.spec.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import './index';
-
-describe('Supplier', () => {
- describe('Component vnSupplierAddressIndex', () => {
- let controller;
- let $scope;
- let $stateParams;
-
- beforeEach(ngModule('supplier'));
-
- beforeEach(inject(($componentController, $rootScope, _$stateParams_) => {
- $stateParams = _$stateParams_;
- $stateParams.id = 1;
- $scope = $rootScope.$new();
- const $element = angular.element('');
- controller = $componentController('vnSupplierAddressIndex', {$element, $scope});
- controller.supplier = {id: 1};
- }));
-
- describe('exprBuilder()', () => {
- it('should return a filter based on a search by id', () => {
- const filter = controller.exprBuilder('search', '123');
-
- expect(filter).toEqual({id: '123'});
- });
-
- it('should return a filter based on a search by name', () => {
- const filter = controller.exprBuilder('search', 'Arkham Chemicals');
-
- expect(filter).toEqual({nickname: {like: '%Arkham Chemicals%'}});
- });
- });
- });
-});
diff --git a/modules/supplier/front/address/index/style.scss b/modules/supplier/front/address/index/style.scss
deleted file mode 100644
index 44ce07b3c..000000000
--- a/modules/supplier/front/address/index/style.scss
+++ /dev/null
@@ -1,21 +0,0 @@
-@import "variables";
-@import "./effects";
-
-vn-supplier-address-index {
- .address {
- padding-bottom: $spacing-md;
-
- &:last-child {
- padding-bottom: 0;
- }
- & > a {
- @extend %clickable;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- width: 100%;
- color: inherit;
- overflow: hidden;
- }
- }
-}
\ No newline at end of file
diff --git a/modules/supplier/front/address/locale/es.yml b/modules/supplier/front/address/locale/es.yml
deleted file mode 100644
index 30009fa87..000000000
--- a/modules/supplier/front/address/locale/es.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-# Index
-Search by address: Buscar por dirección
-You can search by address id or name: Puedes buscar por el id o nombre de la dirección
-
-# Create
-Street address: Dirección postal
-Postcode: Código postal
-Town/City: Ciudad
-Province: Provincia
-Phone: Teléfono
-Mobile: Móvil
-
-# Common
-Fiscal name: Nombre fiscal
-Street: Dirección fiscal
-Addresses: Direcciones
-New address: Nueva dirección
-Edit address: Editar dirección
\ No newline at end of file
diff --git a/modules/supplier/front/agency-term/create/index.html b/modules/supplier/front/agency-term/create/index.html
deleted file mode 100644
index 728e98146..000000000
--- a/modules/supplier/front/agency-term/create/index.html
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
-
diff --git a/modules/supplier/front/agency-term/create/index.js b/modules/supplier/front/agency-term/create/index.js
deleted file mode 100644
index 3f66ac5e9..000000000
--- a/modules/supplier/front/agency-term/create/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import ngModule from '../../module';
-import Section from 'salix/components/section';
-
-export default class Controller extends Section {
- constructor($element, $) {
- super($element, $);
-
- this.supplierAgencyTerm = {
- supplierFk: this.$params.id
- };
- }
-
- onSubmit() {
- this.$.watcher.submit().then(res => {
- this.$state.go('supplier.card.agencyTerm.index');
- });
- }
-}
-
-ngModule.vnComponent('vnSupplierAgencyTermCreate', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- supplier: '<'
- }
-});
diff --git a/modules/supplier/front/agency-term/create/index.spec.js b/modules/supplier/front/agency-term/create/index.spec.js
deleted file mode 100644
index 682e1cc58..000000000
--- a/modules/supplier/front/agency-term/create/index.spec.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import './index';
-import watcher from 'core/mocks/watcher';
-
-describe('Supplier', () => {
- describe('Component vnSupplierAddressCreate', () => {
- let $scope;
- let controller;
- let $element;
-
- beforeEach(ngModule('supplier'));
-
- beforeEach(inject(($componentController, $rootScope, _$state_) => {
- $scope = $rootScope.$new();
- $scope.watcher = watcher;
- $element = angular.element('');
- controller = $componentController('vnSupplierAgencyTermCreate', {$element, $scope});
- }));
-
- describe('onSubmit()', () => {
- it(`should redirect to 'supplier.card.agencyTerm.index' state`, () => {
- jest.spyOn(controller.$state, 'go');
- controller.onSubmit();
-
- expect(controller.$state.go).toHaveBeenCalledWith('supplier.card.agencyTerm.index');
- });
- });
- });
-});
diff --git a/modules/supplier/front/agency-term/index/index.html b/modules/supplier/front/agency-term/index/index.html
deleted file mode 100644
index 44c6deba9..000000000
--- a/modules/supplier/front/agency-term/index/index.html
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-
-
-
diff --git a/modules/supplier/front/agency-term/index/index.js b/modules/supplier/front/agency-term/index/index.js
deleted file mode 100644
index 9f77d686a..000000000
--- a/modules/supplier/front/agency-term/index/index.js
+++ /dev/null
@@ -1,36 +0,0 @@
-import ngModule from '../../module';
-import Section from 'salix/components/section';
-
-class Controller extends Section {
- constructor($element, $) {
- super($element, $);
- this.filter = {
- include:
- {relation: 'agency',
- scope: {
- fields: ['id', 'name']
- }
- }
- };
- }
-
- add() {
- this.$.model.insert({});
- }
-
- onSubmit() {
- this.$.watcher.check();
- this.$.model.save().then(() => {
- this.$.watcher.notifySaved();
- this.$.watcher.updateOriginalData();
- });
- }
-}
-
-ngModule.vnComponent('vnSupplierAgencyTermIndex', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- supplier: '<'
- }
-});
diff --git a/modules/supplier/front/agency-term/index/index.spec.js b/modules/supplier/front/agency-term/index/index.spec.js
deleted file mode 100644
index 3e9ea4c1e..000000000
--- a/modules/supplier/front/agency-term/index/index.spec.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import './index';
-import watcher from 'core/mocks/watcher';
-import crudModel from 'core/mocks/crud-model';
-
-describe('Supplier', () => {
- describe('Component vnSupplierAddressCreate', () => {
- let $scope;
- let controller;
- let $element;
-
- beforeEach(ngModule('supplier'));
-
- beforeEach(inject(($componentController, $rootScope, _$state_) => {
- $scope = $rootScope.$new();
- $scope.model = crudModel;
- $scope.watcher = watcher;
- $element = angular.element('');
- controller = $componentController('vnSupplierAgencyTermIndex', {$element, $scope});
- }));
-
- describe('onSubmit()', () => {
- it('should make HTTP POST request to save values', () => {
- jest.spyOn($scope.watcher, 'check');
- jest.spyOn($scope.watcher, 'notifySaved');
- jest.spyOn($scope.watcher, 'updateOriginalData');
- jest.spyOn($scope.model, 'save');
-
- controller.onSubmit();
-
- expect($scope.model.save).toHaveBeenCalledWith();
- expect($scope.watcher.updateOriginalData).toHaveBeenCalledWith();
- expect($scope.watcher.check).toHaveBeenCalledWith();
- expect($scope.watcher.notifySaved).toHaveBeenCalledWith();
- });
- });
- });
-});
diff --git a/modules/supplier/front/agency-term/locale/es.yml b/modules/supplier/front/agency-term/locale/es.yml
deleted file mode 100644
index cdbd7c2ca..000000000
--- a/modules/supplier/front/agency-term/locale/es.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-Minimum M3: M3 minimos
-Package Price: Precio bulto
-Km Price: Precio Km
-M3 Price: Precio M3
-Route Price: Precio ruta
-Minimum Km: Km minimos
-Remove row: Eliminar fila
-Add row: Añadir fila
-New autonomous: Nuevo autónomo
diff --git a/modules/supplier/front/basic-data/index.html b/modules/supplier/front/basic-data/index.html
deleted file mode 100644
index fcdb2a522..000000000
--- a/modules/supplier/front/basic-data/index.html
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
diff --git a/modules/supplier/front/basic-data/index.js b/modules/supplier/front/basic-data/index.js
deleted file mode 100644
index 447118ebb..000000000
--- a/modules/supplier/front/basic-data/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-ngModule.vnComponent('vnSupplierBasicData', {
- template: require('./index.html'),
- controller: Section,
- bindings: {
- supplier: '<'
- }
-});
diff --git a/modules/supplier/front/basic-data/locale/es.yml b/modules/supplier/front/basic-data/locale/es.yml
deleted file mode 100644
index e965ffc2e..000000000
--- a/modules/supplier/front/basic-data/locale/es.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-Notes: Notas
-Active: Activo
-Verified: Verificado
-PayMethodChecked: Método de pago validado
-Responsible for approving invoices: Responsable de aprobar las facturas
\ No newline at end of file
diff --git a/modules/supplier/front/billing-data/index.html b/modules/supplier/front/billing-data/index.html
deleted file mode 100644
index 238760c1a..000000000
--- a/modules/supplier/front/billing-data/index.html
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/supplier/front/billing-data/index.js b/modules/supplier/front/billing-data/index.js
deleted file mode 100644
index 9d2863f64..000000000
--- a/modules/supplier/front/billing-data/index.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-export default class Controller extends Section {
- get supplier() {
- return this._supplier;
- }
-
- set supplier(value) {
- this._supplier = value;
- }
-
- onSubmit() {
- this.$.watcher.submit()
- .then(() => this.card.reload());
- }
-}
-
-ngModule.vnComponent('vnSupplierBillingData', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- supplier: '<'
- },
- require: {
- card: '^vnSupplierCard'
- }
-});
diff --git a/modules/supplier/front/billing-data/locale/es.yml b/modules/supplier/front/billing-data/locale/es.yml
deleted file mode 100644
index d84d37f3a..000000000
--- a/modules/supplier/front/billing-data/locale/es.yml
+++ /dev/null
@@ -1 +0,0 @@
-Pay day: Dia de pago
\ No newline at end of file
diff --git a/modules/supplier/front/card/index.html b/modules/supplier/front/card/index.html
deleted file mode 100644
index 2c3c9df36..000000000
--- a/modules/supplier/front/card/index.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/modules/supplier/front/card/index.js b/modules/supplier/front/card/index.js
deleted file mode 100644
index 13fc3d52d..000000000
--- a/modules/supplier/front/card/index.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import ngModule from '../module';
-import ModuleCard from 'salix/components/module-card';
-
-class Controller extends ModuleCard {
- reload() {
- let filter = {
- include: [
- {
- relation: 'province',
- scope: {
- fields: ['id', 'name']
- }
- },
- {
- relation: 'country',
- scope: {
- fields: ['id', 'name', 'code']
- }
- },
- {
- relation: 'payMethod',
- scope: {
- fields: ['id', 'name']
- }
- },
- {
- relation: 'payDem',
- scope: {
- fields: ['id', 'payDem']
- }
- },
- {
- relation: 'client',
- scope: {
- fields: ['id', 'fi']
- }
- }
- ]
- };
- return this.$http.get(`Suppliers/${this.$params.id}`, {filter})
- .then(response => this.supplier = response.data);
- }
-}
-
-ngModule.vnComponent('vnSupplierCard', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/supplier/front/consumption-search-panel/index.html b/modules/supplier/front/consumption-search-panel/index.html
deleted file mode 100644
index 5cba11d3c..000000000
--- a/modules/supplier/front/consumption-search-panel/index.html
+++ /dev/null
@@ -1,67 +0,0 @@
-
diff --git a/modules/supplier/front/consumption-search-panel/index.js b/modules/supplier/front/consumption-search-panel/index.js
deleted file mode 100644
index f6c63c55c..000000000
--- a/modules/supplier/front/consumption-search-panel/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import ngModule from '../module';
-import SearchPanel from 'core/components/searchbar/search-panel';
-
-ngModule.vnComponent('vnSupplierConsumptionSearchPanel', {
- template: require('./index.html'),
- controller: SearchPanel
-});
diff --git a/modules/supplier/front/consumption-search-panel/locale/es.yml b/modules/supplier/front/consumption-search-panel/locale/es.yml
deleted file mode 100644
index f136283f8..000000000
--- a/modules/supplier/front/consumption-search-panel/locale/es.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-Item id: Id artículo
-From: Desde
-To: Hasta
-Campaign: Campaña
-allSaints: Día de todos los Santos
-valentinesDay: Día de San Valentín
-mothersDay: Día de la madre
\ No newline at end of file
diff --git a/modules/supplier/front/consumption/index.html b/modules/supplier/front/consumption/index.html
deleted file mode 100644
index e6c86abe3..000000000
--- a/modules/supplier/front/consumption/index.html
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- Entry
- {{::entry.id}}
- Date
- {{::entry.shipped | date: 'dd/MM/yyyy'}}
- Reference
- {{::entry.invoiceNumber}}
-
-
-
-
-
-
- {{::buy.itemName}}
-
-
-
-
-
-
- {{::buy.subName}}
-
-
-
-
-
- {{::buy.quantity | dashIfEmpty}}
- {{::buy.price | dashIfEmpty}}
- {{::buy.total | dashIfEmpty}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/supplier/front/consumption/index.js b/modules/supplier/front/consumption/index.js
deleted file mode 100644
index 9af0d1747..000000000
--- a/modules/supplier/front/consumption/index.js
+++ /dev/null
@@ -1,88 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-class Controller extends Section {
- constructor($element, $, vnReport, vnEmail) {
- super($element, $);
- this.vnReport = vnReport;
- this.vnEmail = vnEmail;
-
- this.setDefaultFilter();
- }
-
- setDefaultFilter() {
- const minDate = Date.vnNew();
- minDate.setHours(0, 0, 0, 0);
- minDate.setMonth(minDate.getMonth() - 2);
-
- const maxDate = Date.vnNew();
- maxDate.setHours(23, 59, 59, 59);
-
- this.filterParams = {
- from: minDate,
- to: maxDate
- };
- }
-
- get reportParams() {
- const userParams = this.$.model.userParams;
- return Object.assign({
- authorization: this.vnToken.token,
- recipientId: this.supplier.id
- }, userParams);
- }
-
- showReport() {
- const path = `Suppliers/${this.supplier.id}/campaign-metrics-pdf`;
- this.vnReport.show(path, this.reportParams);
- }
-
- sendEmail() {
- const params = {
- filter: {
- where: {
- supplierFk: this.$params.id,
- email: {neq: null}
- },
- limit: 1
- }
- };
- this.$http.get('SupplierContacts', params).then(({data}) => {
- if (data.length) {
- const contact = data[0];
- const params = Object.assign({
- recipient: contact.email
- }, this.reportParams);
-
- const path = `Suppliers/${this.supplier.id}/campaign-metrics-email`;
- this.vnEmail.send(path, params);
- } else {
- const message = this.$t(`This supplier doesn't have a contact with an email address`);
- this.vnApp.showError(message);
- }
- });
- }
-
- getTotal(entry) {
- if (entry.buys) {
- let total = 0;
- for (let buy of entry.buys)
- total += buy.total;
-
- return total;
- }
- }
-}
-
-Controller.$inject = ['$element', '$scope', 'vnReport', 'vnEmail'];
-
-ngModule.vnComponent('vnSupplierConsumption', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- supplier: '<'
- },
- require: {
- card: '^vnSupplierCard'
- }
-});
diff --git a/modules/supplier/front/consumption/index.spec.js b/modules/supplier/front/consumption/index.spec.js
deleted file mode 100644
index 0ac531a68..000000000
--- a/modules/supplier/front/consumption/index.spec.js
+++ /dev/null
@@ -1,110 +0,0 @@
-import './index.js';
-import crudModel from 'core/mocks/crud-model';
-
-describe('Supplier', () => {
- describe('Component vnSupplierConsumption', () => {
- let $scope;
- let controller;
- let $httpParamSerializer;
- let $httpBackend;
- const supplierId = 2;
-
- beforeEach(ngModule('supplier'));
-
- beforeEach(inject(($componentController, $rootScope, _$httpParamSerializer_, _$httpBackend_) => {
- $scope = $rootScope.$new();
- $httpParamSerializer = _$httpParamSerializer_;
- $httpBackend = _$httpBackend_;
- const $element = angular.element(' {
- it('should call the window.open function', () => {
- jest.spyOn(window, 'open').mockReturnThis();
-
- const now = Date.vnNew();
- controller.$.model.userParams = {
- from: now,
- to: now
- };
-
- controller.showReport();
-
- const expectedParams = {
- recipientId: 2,
- from: now,
- to: now
- };
- const serializedParams = $httpParamSerializer(expectedParams);
- const path = `api/Suppliers/${supplierId}/campaign-metrics-pdf?${serializedParams}`;
-
- expect(window.open).toHaveBeenCalledWith(path);
- });
- });
-
- describe('sendEmail()', () => {
- it('should throw an error', () => {
- jest.spyOn(controller.vnApp, 'showError');
-
- const expectedParams = {
- filter: {
- where: {
- supplierFk: supplierId,
- email: {neq: null}
- },
- limit: 1
- }
- };
- const serializedParams = $httpParamSerializer(expectedParams);
- $httpBackend.expectGET(`SupplierContacts?${serializedParams}`).respond({});
- controller.sendEmail();
- $httpBackend.flush();
-
- expect(controller.vnApp.showError)
- .toHaveBeenCalledWith(`This supplier doesn't have a contact with an email address`);
- });
-
- it('should make a GET query sending the report', () => {
- let serializedParams;
- const params = {
- filter: {
- where: {
- supplierFk: supplierId,
- email: {neq: null}
- },
- limit: 1
- }
- };
- serializedParams = $httpParamSerializer(params);
- $httpBackend.whenGET(`SupplierContacts?${serializedParams}`).respond([
- {id: 1, email: 'batman@gothamcity.com'}
- ]);
-
- const now = Date.vnNew();
- controller.$.model.userParams = {
- from: now,
- to: now
- };
- const expectedParams = {
- recipient: 'batman@gothamcity.com',
- from: now,
- to: now
- };
-
- serializedParams = $httpParamSerializer(expectedParams);
- const path = `Suppliers/${supplierId}/campaign-metrics-email`;
-
- $httpBackend.expect('POST', path).respond({});
- controller.sendEmail();
- $httpBackend.flush();
- });
- });
- });
-});
-
diff --git a/modules/supplier/front/consumption/locale/es.yml b/modules/supplier/front/consumption/locale/es.yml
deleted file mode 100644
index 08c2a22e5..000000000
--- a/modules/supplier/front/consumption/locale/es.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-Total entry: Total entrada
-This supplier doesn't have a contact with an email address: Este proveedor no tiene ningún contacto con una dirección de email
diff --git a/modules/supplier/front/contact/index.html b/modules/supplier/front/contact/index.html
deleted file mode 100644
index 347e4261a..000000000
--- a/modules/supplier/front/contact/index.html
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/supplier/front/contact/index.js b/modules/supplier/front/contact/index.js
deleted file mode 100644
index 48db3d526..000000000
--- a/modules/supplier/front/contact/index.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import ngModule from '../module';
-import './style.scss';
-import Section from 'salix/components/section';
-
-class Controller extends Section {
- add() {
- this.$.model.insert({
- supplierFk: this.supplier.id
- });
- }
-
- onSubmit() {
- this.$.watcher.check();
- this.$.model.save().then(() => {
- this.$.watcher.notifySaved();
- this.$.watcher.updateOriginalData();
- });
- }
-}
-
-ngModule.vnComponent('vnSupplierContact', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- supplier: '<'
- }
-});
diff --git a/modules/supplier/front/contact/style.scss b/modules/supplier/front/contact/style.scss
deleted file mode 100644
index becc66dcf..000000000
--- a/modules/supplier/front/contact/style.scss
+++ /dev/null
@@ -1,10 +0,0 @@
-@import "variables";
-
-
-.contact {
- max-width: $width-lg;
- margin-bottom: 10px;
- padding-right: 10px;
- padding-left: 10px;
- border: 1px solid $color-spacer;
-}
diff --git a/modules/supplier/front/create/index.html b/modules/supplier/front/create/index.html
deleted file mode 100644
index 1e051f3a8..000000000
--- a/modules/supplier/front/create/index.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
diff --git a/modules/supplier/front/create/index.js b/modules/supplier/front/create/index.js
deleted file mode 100644
index c33367dac..000000000
--- a/modules/supplier/front/create/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-class Controller extends Section {
- constructor($element, $) {
- super($element, $);
- }
-
- onSubmit() {
- this.$.watcher.submit().then(
- json => {
- this.$state.go(`supplier.card.fiscalData`, {id: json.data.id});
- }
- );
- }
-}
-
-Controller.$inject = ['$element', '$scope'];
-
-ngModule.vnComponent('vnSupplierCreate', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/supplier/front/descriptor-popover/index.html b/modules/supplier/front/descriptor-popover/index.html
deleted file mode 100644
index 874ba6708..000000000
--- a/modules/supplier/front/descriptor-popover/index.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/modules/supplier/front/descriptor-popover/index.js b/modules/supplier/front/descriptor-popover/index.js
deleted file mode 100644
index a30aa4829..000000000
--- a/modules/supplier/front/descriptor-popover/index.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import ngModule from '../module';
-import DescriptorPopover from 'salix/components/descriptor-popover';
-
-class Controller extends DescriptorPopover {}
-
-ngModule.vnComponent('vnSupplierDescriptorPopover', {
- slotTemplate: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/supplier/front/descriptor/index.html b/modules/supplier/front/descriptor/index.html
deleted file mode 100644
index af5be2537..000000000
--- a/modules/supplier/front/descriptor/index.html
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/supplier/front/descriptor/index.js b/modules/supplier/front/descriptor/index.js
deleted file mode 100644
index f84b4ef92..000000000
--- a/modules/supplier/front/descriptor/index.js
+++ /dev/null
@@ -1,80 +0,0 @@
-import ngModule from '../module';
-import Descriptor from 'salix/components/descriptor';
-
-class Controller extends Descriptor {
- get supplier() {
- return this.entity;
- }
-
- set supplier(value) {
- this.entity = value;
- }
-
- get entryFilter() {
- if (!this.supplier) return null;
-
- const date = Date.vnNew();
- date.setHours(0, 0, 0, 0);
-
- const from = new Date(date.getTime());
- from.setDate(from.getDate() - 10);
-
- const to = new Date(date.getTime());
- to.setDate(to.getDate() + 10);
-
- return JSON.stringify({
- supplierFk: this.id,
- from,
- to
- });
- }
-
- loadData() {
- const filter = {
- fields: [
- 'id',
- 'name',
- 'nickname',
- 'nif',
- 'payMethodFk',
- 'payDemFk',
- 'payDay',
- 'isActive',
- 'isReal',
- 'isTrucker',
- 'account'
- ],
- include: [
- {
- relation: 'payMethod',
- scope: {
- fields: ['id', 'name']
- }
- },
- {
- relation: 'payDem',
- scope: {
- fields: ['id', 'payDem']
- }
- },
- {
- relation: 'client',
- scope: {
- fields: ['id', 'fi']
- }
- }
- ]
- };
-
- return this.getData(`Suppliers/${this.id}`, {filter})
- .then(res => this.supplier = res.data);
- }
-}
-
-ngModule.vnComponent('vnSupplierDescriptor', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- supplier: '<'
- }
-});
diff --git a/modules/supplier/front/descriptor/index.spec.js b/modules/supplier/front/descriptor/index.spec.js
deleted file mode 100644
index 12c3e43bc..000000000
--- a/modules/supplier/front/descriptor/index.spec.js
+++ /dev/null
@@ -1,65 +0,0 @@
-import './index.js';
-
-describe('Supplier Component vnSupplierDescriptor', () => {
- let $httpBackend;
- let controller;
- let $httpParamSerializer;
- const supplier = {id: 1};
-
- beforeEach(ngModule('supplier'));
-
- beforeEach(inject(($componentController, _$httpBackend_, _$httpParamSerializer_) => {
- $httpBackend = _$httpBackend_;
- $httpParamSerializer = _$httpParamSerializer_;
- controller = $componentController('vnSupplierDescriptor', {$element: null}, {supplier});
- }));
-
- describe('loadData()', () => {
- it('should perform ask for the supplier', () => {
- const filter = {
- fields: [
- 'id',
- 'name',
- 'nickname',
- 'nif',
- 'payMethodFk',
- 'payDemFk',
- 'payDay',
- 'isActive',
- 'isReal',
- 'isTrucker',
- 'account'
- ],
- include: [
- {
- relation: 'payMethod',
- scope: {
- fields: ['id', 'name']
- }
- },
- {
- relation: 'payDem',
- scope: {
- fields: ['id', 'payDem']
- }
- },
- {
- relation: 'client',
- scope: {
- fields: ['id', 'fi']
- }
- }
- ]
- };
- const serializedParams = $httpParamSerializer({filter});
- let query = `Suppliers/${controller.supplier.id}?${serializedParams}`;
- jest.spyOn(controller, 'getData');
-
- $httpBackend.expect('GET', query).respond({id: 1});
- controller.loadData();
- $httpBackend.flush();
-
- expect(controller.getData).toHaveBeenCalledTimes(1);
- });
- });
-});
diff --git a/modules/supplier/front/descriptor/locale/es.yml b/modules/supplier/front/descriptor/locale/es.yml
deleted file mode 100644
index cf4a52393..000000000
--- a/modules/supplier/front/descriptor/locale/es.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-Tax number: NIF / CIF
-All entries with current supplier: Todas las entradas con el proveedor actual
-Go to client: Ir al cliente
-Verified supplier: Proveedor verificado
-Unverified supplier: Proveedor no verificado
-Inactive supplier: Proveedor inactivo
-Create invoiceIn: Crear factura recibida
-Supplier name: Razón social
diff --git a/modules/supplier/front/fiscal-data/index.html b/modules/supplier/front/fiscal-data/index.html
deleted file mode 100644
index 6455bf3fd..000000000
--- a/modules/supplier/front/fiscal-data/index.html
+++ /dev/null
@@ -1,237 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/modules/supplier/front/fiscal-data/index.js b/modules/supplier/front/fiscal-data/index.js
deleted file mode 100644
index 8a6a51249..000000000
--- a/modules/supplier/front/fiscal-data/index.js
+++ /dev/null
@@ -1,86 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-export default class Controller extends Section {
- get province() {
- return this._province;
- }
-
- // Province auto complete
- set province(selection) {
- const oldValue = this._province;
- this._province = selection;
-
- if (!selection || !oldValue) return;
-
- const country = selection.country;
-
- if (!this.supplier.countryFk)
- this.supplier.countryFk = country.id;
- }
-
- get town() {
- return this._town;
- }
-
- // Town auto complete
- set town(selection) {
- const oldValue = this._town;
- this._town = selection;
-
- if (!selection || !oldValue) return;
-
- const province = selection.province;
- const country = province.country;
- const postcodes = selection.postcodes;
-
- if (!this.supplier.provinceFk)
- this.supplier.provinceFk = province.id;
-
- if (!this.supplier.countryFk)
- this.supplier.countryFk = country.id;
-
- if (!this.supplier.postCode && postcodes.length === 1)
- this.supplier.postCode = postcodes[0].code;
- }
-
- get postcode() {
- return this._postcode;
- }
-
- // Postcode auto complete
- set postcode(selection) {
- const oldValue = this._postcode;
- this._postcode = selection;
-
- if (!selection || !oldValue) return;
-
- const town = selection.town;
- const province = town.province;
- const country = province.country;
-
- if (!this.supplier.city)
- this.supplier.city = town.name;
-
- if (!this.supplier.provinceFk)
- this.supplier.provinceFk = province.id;
-
- if (!this.supplier.countryFk)
- this.supplier.countryFk = country.id;
- }
-
- onResponse(response) {
- this.supplier.postCode = response.code;
- this.supplier.city = response.city;
- this.supplier.provinceFk = response.provinceFk;
- this.supplier.countryFk = response.countryFk;
- }
-}
-
-ngModule.vnComponent('vnSupplierFiscalData', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- supplier: '<'
- }
-});
diff --git a/modules/supplier/front/fiscal-data/index.spec.js b/modules/supplier/front/fiscal-data/index.spec.js
deleted file mode 100644
index 6fb135c08..000000000
--- a/modules/supplier/front/fiscal-data/index.spec.js
+++ /dev/null
@@ -1,109 +0,0 @@
-import './index';
-import watcher from 'core/mocks/watcher';
-
-describe('Supplier', () => {
- describe('Component vnSupplierFiscalData', () => {
- let $scope;
- let $element;
- let controller;
-
- beforeEach(ngModule('supplier'));
-
- beforeEach(inject(($componentController, $rootScope) => {
- $scope = $rootScope.$new();
- $scope.watcher = watcher;
- $scope.watcher.orgData = {id: 1};
- $element = angular.element('');
- controller = $componentController('vnSupplierFiscalData', {$element, $scope});
- controller.card = {reload: () => {}};
- controller.supplier = {
- id: 1,
- name: 'Batman'
- };
-
- controller._province = {};
- controller._town = {};
- controller._postcode = {};
- }));
-
- describe('province() setter', () => {
- it(`should set countryFk property`, () => {
- controller.supplier.countryFk = null;
- controller.province = {
- id: 1,
- name: 'New york',
- country: {
- id: 2,
- name: 'USA'
- }
- };
-
- expect(controller.supplier.countryFk).toEqual(2);
- });
- });
-
- describe('town() setter', () => {
- it(`should set provinceFk property`, () => {
- controller.town = {
- provinceFk: 1,
- code: 46001,
- province: {
- id: 1,
- name: 'New york',
- country: {
- id: 2,
- name: 'USA'
- }
- },
- postcodes: []
- };
-
- expect(controller.supplier.provinceFk).toEqual(1);
- });
-
- it(`should set provinceFk property and fill the postalCode if there's just one`, () => {
- controller.town = {
- provinceFk: 1,
- code: 46001,
- province: {
- id: 1,
- name: 'New york',
- country: {
- id: 2,
- name: 'USA'
- }
- },
- postcodes: [{code: '46001'}]
- };
-
- expect(controller.supplier.provinceFk).toEqual(1);
- expect(controller.supplier.postCode).toEqual('46001');
- });
- });
-
- describe('postcode() setter', () => {
- it(`should set the town, provinceFk and contryFk properties`, () => {
- controller.postcode = {
- townFk: 1,
- code: 46001,
- town: {
- id: 1,
- name: 'New York',
- province: {
- id: 1,
- name: 'New york',
- country: {
- id: 2,
- name: 'USA'
- }
- }
- }
- };
-
- expect(controller.supplier.city).toEqual('New York');
- expect(controller.supplier.provinceFk).toEqual(1);
- expect(controller.supplier.countryFk).toEqual(2);
- });
- });
- });
-});
diff --git a/modules/supplier/front/fiscal-data/locale/es.yml b/modules/supplier/front/fiscal-data/locale/es.yml
deleted file mode 100644
index ee641231f..000000000
--- a/modules/supplier/front/fiscal-data/locale/es.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-Sage tax type: Tipo de impuesto Sage
-Sage transaction type: Tipo de transacción Sage
-Sage withholding: Retención Sage
-Supplier activity: Actividad proveedor
-Healt register: Pasaporte sanitario
-Trucker: Transportista
-When activating it, do not enter the country code in the ID field.: Al activarlo, no informar el código del país en el campo nif
-The first two values are letters.: Los dos primeros valores son letras
\ No newline at end of file
diff --git a/modules/supplier/front/index.js b/modules/supplier/front/index.js
index 9216d0781..a7209a0bd 100644
--- a/modules/supplier/front/index.js
+++ b/modules/supplier/front/index.js
@@ -1,23 +1,3 @@
export * from './module';
import './main';
-import './card';
-import './descriptor';
-import './descriptor-popover';
-import './index/';
-import './search-panel';
-import './summary';
-import './basic-data';
-import './fiscal-data';
-import './account';
-import './contact';
-import './log';
-import './consumption';
-import './consumption-search-panel';
-import './billing-data';
-import './address/index';
-import './address/create';
-import './address/edit';
-import './agency-term/index';
-import './agency-term/create';
-import './create/index';
diff --git a/modules/supplier/front/index/index.html b/modules/supplier/front/index/index.html
deleted file mode 100644
index 49f38cb1b..000000000
--- a/modules/supplier/front/index/index.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/supplier/front/index/index.js b/modules/supplier/front/index/index.js
deleted file mode 100644
index 77b2e8347..000000000
--- a/modules/supplier/front/index/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-export default class Controller extends Section {
- openSummary(supplier, event) {
- if (event.defaultPrevented) return;
- event.preventDefault();
- event.stopPropagation();
-
- this.supplierSelected = supplier;
- this.$.dialogSummarySupplier.show();
- }
-}
-
-ngModule.vnComponent('vnSupplierIndex', {
- template: require('./index.html'),
- controller: Controller
-});
diff --git a/modules/supplier/front/index/locale/es.yml b/modules/supplier/front/index/locale/es.yml
deleted file mode 100644
index ce06f462c..000000000
--- a/modules/supplier/front/index/locale/es.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-Payment deadline: Plazo de pago
-Pay day: Dia de pago
-Account: Cuenta
-Pay method: Metodo de pago
-Tax number: Nif
-New supplier: Nuevo proveedor
\ No newline at end of file
diff --git a/modules/supplier/front/log/index.html b/modules/supplier/front/log/index.html
deleted file mode 100644
index 7895b585e..000000000
--- a/modules/supplier/front/log/index.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/modules/supplier/front/log/index.js b/modules/supplier/front/log/index.js
deleted file mode 100644
index 52a491c70..000000000
--- a/modules/supplier/front/log/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import ngModule from '../module';
-import Section from 'salix/components/section';
-
-ngModule.vnComponent('vnSupplierLog', {
- template: require('./index.html'),
- controller: Section,
-});
diff --git a/modules/supplier/front/main/index.html b/modules/supplier/front/main/index.html
index 04d7aa0ad..e69de29bb 100644
--- a/modules/supplier/front/main/index.html
+++ b/modules/supplier/front/main/index.html
@@ -1,17 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/supplier/front/main/index.js b/modules/supplier/front/main/index.js
index 2fd870573..fd99cc0a2 100644
--- a/modules/supplier/front/main/index.js
+++ b/modules/supplier/front/main/index.js
@@ -1,7 +1,15 @@
import ngModule from '../module';
import ModuleMain from 'salix/components/module-main';
-export default class Supplier extends ModuleMain {}
+export default class Supplier extends ModuleMain {
+ constructor($element, $) {
+ super($element, $);
+ }
+ async $onInit() {
+ this.$state.go('home');
+ window.location.href = await this.vnApp.getUrl(`supplier/`);
+ }
+}
ngModule.vnComponent('vnSupplier', {
controller: Supplier,
diff --git a/modules/supplier/front/routes.json b/modules/supplier/front/routes.json
index 75b8213cb..ab0022ff9 100644
--- a/modules/supplier/front/routes.json
+++ b/modules/supplier/front/routes.json
@@ -36,146 +36,6 @@
"state": "supplier.index",
"component": "vn-supplier-index",
"description": "Suppliers"
- },
- {
- "url": "/:id",
- "state": "supplier.card",
- "abstract": true,
- "component": "vn-supplier-card"
- },
- {
- "url": "/summary",
- "state": "supplier.card.summary",
- "component": "vn-supplier-summary",
- "description": "Summary",
- "params": {
- "supplier": "$ctrl.supplier"
- }
- },
- {
- "url": "/create",
- "state": "supplier.create",
- "component": "vn-supplier-create",
- "acl": ["administrative"],
- "description": "New supplier"
- },
- {
- "url": "/basic-data",
- "state": "supplier.card.basicData",
- "component": "vn-supplier-basic-data",
- "description": "Basic data",
- "acl": ["administrative"],
- "params": {
- "supplier": "$ctrl.supplier"
- }
- },
- {
- "url": "/fiscal-data",
- "state": "supplier.card.fiscalData",
- "component": "vn-supplier-fiscal-data",
- "description": "Fiscal data",
- "params": {
- "supplier": "$ctrl.supplier"
- },
- "acl": ["administrative"]
- },
- {
- "url" : "/log",
- "state": "supplier.card.log",
- "component": "vn-supplier-log",
- "description": "Log"
- },
- {
- "url": "/contact",
- "state": "supplier.card.contact",
- "component": "vn-supplier-contact",
- "description": "Contacts",
- "params": {
- "supplier": "$ctrl.supplier"
- }
- },
- {
- "url": "/agency-term",
- "state": "supplier.card.agencyTerm",
- "component": "ui-view",
- "abstract": true
- },
- {
- "url": "/index",
- "state": "supplier.card.agencyTerm.index",
- "component": "vn-supplier-agency-term-index",
- "description": "Agency Agreement",
- "params": {
- "supplier": "$ctrl.supplier"
- }
- },
- {
- "url": "/create",
- "state": "supplier.card.agencyTerm.create",
- "component": "vn-supplier-agency-term-create",
- "description": "New autonomous",
- "params": {
- "supplier": "$ctrl.supplier"
- }
- },
- {
- "url": "/consumption?q",
- "state": "supplier.card.consumption",
- "component": "vn-supplier-consumption",
- "description": "Consumption",
- "params": {
- "supplier": "$ctrl.supplier"
- }
- },
- {
- "url": "/billing-data",
- "state": "supplier.card.billingData",
- "component": "vn-supplier-billing-data",
- "description": "Billing data",
- "params": {
- "supplier": "$ctrl.supplier"
- },
- "acl": ["administrative"]
- },
- {
- "url": "/account",
- "state": "supplier.card.account",
- "component": "vn-supplier-account",
- "description": "Accounts",
- "params": {
- "supplier": "$ctrl.supplier"
- },
- "acl": ["administrative"]
- },
- {
- "url": "/address",
- "state": "supplier.card.address",
- "component": "ui-view",
- "abstract": true
- },
- {
- "url": "/index?q",
- "state": "supplier.card.address.index",
- "component": "vn-supplier-address-index",
- "description": "Addresses",
- "params": {
- "supplier": "$ctrl.supplier"
- }
- },
- {
- "url": "/create",
- "state": "supplier.card.address.create",
- "component": "vn-supplier-address-create",
- "description": "New address",
- "params": {
- "supplier": "$ctrl.supplier"
- }
- },
- {
- "url": "/:addressId/edit",
- "state": "supplier.card.address.edit",
- "component": "vn-supplier-address-edit",
- "description": "Edit address"
}
]
-}
\ No newline at end of file
+}
diff --git a/modules/supplier/front/search-panel/index.html b/modules/supplier/front/search-panel/index.html
deleted file mode 100644
index e67fa9083..000000000
--- a/modules/supplier/front/search-panel/index.html
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/modules/supplier/front/search-panel/index.js b/modules/supplier/front/search-panel/index.js
deleted file mode 100644
index 6223b5670..000000000
--- a/modules/supplier/front/search-panel/index.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import ngModule from '../module';
-import SearchPanel from 'core/components/searchbar/search-panel';
-
-ngModule.vnComponent('vnSupplierSearchPanel', {
- template: require('./index.html'),
- controller: SearchPanel
-});
diff --git a/modules/supplier/front/search-panel/locale/es.yml b/modules/supplier/front/search-panel/locale/es.yml
deleted file mode 100644
index 77253a4ef..000000000
--- a/modules/supplier/front/search-panel/locale/es.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-Province: Provincia
-Country: País
-Tax number: NIF / CIF
-Search suppliers by id, name or alias: Busca proveedores por id, nombre o alias
\ No newline at end of file
diff --git a/modules/supplier/front/summary/index.html b/modules/supplier/front/summary/index.html
deleted file mode 100644
index 5ba713fcf..000000000
--- a/modules/supplier/front/summary/index.html
+++ /dev/null
@@ -1,172 +0,0 @@
-
-
-
-
-
- {{::$ctrl.summary.name}} - {{::$ctrl.summary.id}}
-
-
-
-
-
- Basic data
-
-
-
-
-
-
-
-
- {{$ctrl.summary.worker.user.nickname}}
-
-
-
-
-
-
-
-
-
-
-
-
-
- Billing data
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fiscal data
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Fiscal address
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/supplier/front/summary/index.js b/modules/supplier/front/summary/index.js
deleted file mode 100644
index a828379bc..000000000
--- a/modules/supplier/front/summary/index.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import ngModule from '../module';
-import Summary from 'salix/components/summary';
-import './style.scss';
-
-class Controller extends Summary {
- $onChanges() {
- if (!this.supplier)
- return;
-
- this.getSummary();
- }
-
- get isAdministrative() {
- return this.aclService.hasAny(['administrative']);
- }
-
- getSummary() {
- return this.$http.get(`Suppliers/${this.supplier.id}/getSummary`).then(response => {
- this.summary = response.data;
- });
- }
-}
-
-ngModule.vnComponent('vnSupplierSummary', {
- template: require('./index.html'),
- controller: Controller,
- bindings: {
- supplier: '<'
- }
-});
diff --git a/modules/supplier/front/summary/index.spec.js b/modules/supplier/front/summary/index.spec.js
deleted file mode 100644
index aa44cd14f..000000000
--- a/modules/supplier/front/summary/index.spec.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import './index';
-
-describe('Supplier', () => {
- describe('Component vnSupplierSummary', () => {
- let controller;
- let $httpBackend;
- let $scope;
-
- beforeEach(ngModule('supplier'));
-
- beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
- $httpBackend = _$httpBackend_;
- $scope = $rootScope.$new();
- const $element = angular.element('');
- controller = $componentController('vnSupplierSummary', {$element, $scope});
- }));
-
- describe('getSummary()', () => {
- it('should perform a get asking for the supplier data', () => {
- controller.supplier = {id: 1};
-
- const query = `Suppliers/${controller.supplier.id}/getSummary`;
-
- $httpBackend.expectGET(query).respond({id: 1});
- controller.getSummary();
- $httpBackend.flush();
-
- expect(controller.summary).toEqual({id: 1});
- });
- });
- });
-});
diff --git a/modules/supplier/front/summary/locale/es.yml b/modules/supplier/front/summary/locale/es.yml
deleted file mode 100644
index 35291e579..000000000
--- a/modules/supplier/front/summary/locale/es.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-Verified: Verificado
-Country: País
-Tax number: NIF / CIF
-Search suppliers by id, name or alias: Busca proveedores por id, nombre o alias
-Is Farmer: Es agrícola
-Sage tax type: Tipo de impuesto Sage
-Sage transaction type: Tipo de transacción Sage
-Sage withholding: Retencion Sage
-Go to the supplier: Ir al proveedor
-Responsible: Responsable
-Supplier activity: Actividad proveedor
-Healt register: Pasaporte sanitario
\ No newline at end of file
diff --git a/modules/supplier/front/summary/style.scss b/modules/supplier/front/summary/style.scss
deleted file mode 100644
index 1eb6b2323..000000000
--- a/modules/supplier/front/summary/style.scss
+++ /dev/null
@@ -1,7 +0,0 @@
-@import "variables";
-
-vn-client-summary {
- .alert span {
- color: $color-alert
- }
-}
\ No newline at end of file
diff --git a/modules/ticket/back/methods/ticket/closure.js b/modules/ticket/back/methods/ticket/closure.js
index 89343b193..4622ba271 100644
--- a/modules/ticket/back/methods/ticket/closure.js
+++ b/modules/ticket/back/methods/ticket/closure.js
@@ -171,16 +171,6 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) {
{userId},
);
- const oldInstance = `{"email": "${ticket.recipient}"}`;
- const newInstance = `{"email": ""}`;
- await Self.rawSql(
- `
- INSERT INTO clientLog (originFk, userFk, action, changedModel, oldInstance, newInstance)
- VALUES (?, NULL, 'UPDATE', 'Client', ?, ?)`,
- [ticket.clientFk, oldInstance, newInstance],
- {userId},
- );
-
const body = `No se ha podido enviar el albarán ${ticket.id}
al cliente ${ticket.clientFk} - ${ticket.clientName}
porque la dirección de email "${ticket.recipient}" no es correcta
diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js
index 2209c8df4..c98ddaab6 100644
--- a/modules/ticket/back/methods/ticket/filter.js
+++ b/modules/ticket/back/methods/ticket/filter.js
@@ -343,7 +343,7 @@ module.exports = Self => {
const problems = {[condition]: [
{'tp.isFreezed': hasProblem},
- {'tp.risk': hasProblem},
+ {'tp.hasRisk': hasProblem},
{'tp.hasTicketRequest': hasProblem},
{'tp.itemShortage': range},
{'tp.hasRounding': hasProblem}
diff --git a/modules/ticket/back/methods/ticket/getTicketsAdvance.js b/modules/ticket/back/methods/ticket/getTicketsAdvance.js
index ab40b9559..1bd5f83de 100644
--- a/modules/ticket/back/methods/ticket/getTicketsAdvance.js
+++ b/modules/ticket/back/methods/ticket/getTicketsAdvance.js
@@ -105,13 +105,12 @@ module.exports = Self => {
stmt = new ParameterizedSQL(
`CALL vn.ticket_canAdvance(?,?,?)`,
- [args.dateFuture, args.dateToAdvance, args.warehouseFk]);
+ [args.dateFuture, args.dateToAdvance, args.warehouseFk]
+ );
stmts.push(stmt);
- stmt = new ParameterizedSQL(`
- SELECT f.*
- FROM tmp.filter f`);
+ stmt = new ParameterizedSQL(`SELECT f.* FROM tmp.filter f`);
stmt.merge(conn.makeWhere(filter.where));
@@ -119,9 +118,7 @@ module.exports = Self => {
stmt.merge(conn.makeLimit(filter));
const ticketsIndex = stmts.push(stmt) - 1;
- stmts.push(
- `DROP TEMPORARY TABLE
- tmp.filter`);
+ stmts.push(`DROP TEMPORARY TABLE tmp.filter`);
const sql = ParameterizedSQL.join(stmts, ';');
const result = await conn.executeStmt(sql, myOptions);
diff --git a/modules/ticket/back/methods/ticket/getTicketsFuture.js b/modules/ticket/back/methods/ticket/getTicketsFuture.js
index 9f455ec03..247924591 100644
--- a/modules/ticket/back/methods/ticket/getTicketsFuture.js
+++ b/modules/ticket/back/methods/ticket/getTicketsFuture.js
@@ -9,13 +9,13 @@ module.exports = Self => {
accessType: 'READ',
accepts: [
{
- arg: 'originDated',
+ arg: 'originScopeDays',
type: 'date',
description: 'The date in question',
required: true
},
{
- arg: 'futureDated',
+ arg: 'futureScopeDays',
type: 'date',
description: 'The date to probe',
required: true
@@ -129,9 +129,9 @@ module.exports = Self => {
]
};
case 'state':
- return {'f.stateCode': {like: `%${value}%`}};
+ return {'f.alertLevel': value};
case 'futureState':
- return {'f.futureStateCode': {like: `%${value}%`}};
+ return {'f.futureAlertLevel': value};
}
});
@@ -141,7 +141,7 @@ module.exports = Self => {
stmt = new ParameterizedSQL(
`CALL vn.ticket_canbePostponed(?,?,?)`,
- [args.originDated, args.futureDated, args.warehouseFk]);
+ [args.originScopeDays, args.futureScopeDays, args.warehouseFk]);
stmts.push(stmt);
@@ -170,7 +170,7 @@ module.exports = Self => {
LEFT JOIN tmp.ticket_problems tp ON tp.ticketFk = f.id
`);
- if (args.problems != undefined && (!args.originDated && !args.futureDated))
+ if (args.problems != undefined && (!args.originScopeDays && !args.futureScopeDays))
throw new UserError('Choose a date range or days forward');
let condition;
@@ -196,7 +196,7 @@ module.exports = Self => {
const problems = {
[condition]: [
{'tp.isFreezed': hasProblem},
- {'tp.risk': hasProblem},
+ {'tp.hasRisk': hasProblem},
{'tp.hasTicketRequest': hasProblem},
{'tp.itemShortage': range},
{'tp.hasComponentLack': hasProblem},
diff --git a/modules/ticket/back/methods/ticket/setDeleted.js b/modules/ticket/back/methods/ticket/setDeleted.js
index 125827c5e..a684e1cbc 100644
--- a/modules/ticket/back/methods/ticket/setDeleted.js
+++ b/modules/ticket/back/methods/ticket/setDeleted.js
@@ -138,7 +138,7 @@ module.exports = Self => {
id: id,
url: `${url}ticket/${id}/summary`
});
- await models.Chat.send(ctx, `@${salesPersonUser.name}`, message);
+ await models.Chat.sendCheckingPresence(ctx, salesPersonUser.id, message);
}
const updatedTicket = await ticket.updateAttribute('isDeleted', true, myOptions);
diff --git a/modules/ticket/back/methods/ticket/setWeight.js b/modules/ticket/back/methods/ticket/setWeight.js
new file mode 100644
index 000000000..b3b505832
--- /dev/null
+++ b/modules/ticket/back/methods/ticket/setWeight.js
@@ -0,0 +1,86 @@
+const UserError = require('vn-loopback/util/user-error');
+
+module.exports = Self => {
+ Self.remoteMethodCtx('setWeight', {
+ description: 'Sets weight of a ticket',
+ accessType: 'WRITE',
+ accepts: [{
+ arg: 'id',
+ type: 'number',
+ required: true,
+ description: 'The ticket id',
+ http: {source: 'path'}
+ }, {
+ arg: 'weight',
+ type: 'number',
+ required: true,
+ description: 'The weight value',
+ }],
+ returns: {
+ type: 'Array',
+ root: true
+ },
+ http: {
+ path: `/:id/setWeight`,
+ verb: 'POST'
+ }
+ });
+
+ Self.setWeight = async(ctx, ticketId, weight, options) => {
+ const models = Self.app.models;
+ const userId = ctx.req.accessToken.userId;
+ const myOptions = {userId};
+ let tx;
+
+ if (typeof options == 'object') Object.assign(myOptions, options);
+
+ if (!myOptions.transaction) {
+ tx = await Self.beginTransaction({});
+ myOptions.transaction = tx;
+ }
+
+ try {
+ const ticket = await Self.findById(ticketId, null, myOptions);
+ if (ticket.weight) throw new UserError('Weight already set');
+
+ const canEdit = await models.ACL.checkAccessAcl(ctx, 'Ticket', 'updateAttributes');
+ const client = await models.Client.findById(ticket.clientFk, {
+ include: {relation: 'salesPersonUser'}},
+ myOptions);
+
+ if (!canEdit) {
+ const salesPersonUser = client.salesPersonUser();
+ const workerDepartments = await models.WorkerDepartment.find({
+ include: {relation: 'department'},
+ where: {workerFk: {inq: [userId, salesPersonUser.id]}}
+ }, myOptions);
+
+ if (
+ workerDepartments.length == 2 &&
+ workerDepartments[0].departmentFk != workerDepartments[1].departmentFk
+ )
+ throw new UserError('This ticket is not allocated to your department');
+ }
+
+ await ticket.updateAttribute('weight', weight, myOptions);
+
+ const packedState = await models.State.findOne({where: {code: 'PACKED'}}, myOptions);
+ const ticketState = await models.TicketState.findOne({where: {ticketFk: ticketId}}, myOptions);
+
+ const [{taxArea}] = await Self.rawSql('SELECT clientTaxArea(?,?) taxArea',
+ [ticket.clientFk, ticket.warehouseFk], myOptions);
+
+ const isInvoiceable = ticketState.alertLevel >= packedState.alertLevel &&
+ taxArea == 'WORLD' && client.hasDailyInvoice;
+
+ if (tx) await tx.commit();
+ let invoiceIds = [];
+ if (isInvoiceable) invoiceIds = [...await Self.invoiceTicketsAndPdf(ctx, [ticketId])];
+
+ return invoiceIds;
+ } catch (e) {
+ if (tx) await tx.rollback();
+ throw e;
+ }
+ };
+};
diff --git a/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js b/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js
index 4b28f34ea..e1e9a0ed2 100644
--- a/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js
+++ b/modules/ticket/back/methods/ticket/specs/getTicketsFuture.spec.js
@@ -12,8 +12,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
};
@@ -35,8 +35,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
problems: true
};
@@ -60,8 +60,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
problems: false
};
@@ -85,8 +85,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
problems: null
};
@@ -110,8 +110,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
state: 'OK'
};
@@ -135,8 +135,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
futureState: 'OK'
};
@@ -160,8 +160,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
ipt: null
};
@@ -185,8 +185,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
ipt: 'H'
};
@@ -210,8 +210,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
futureIpt: null
};
@@ -235,8 +235,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
futureIpt: 'H'
};
@@ -260,8 +260,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
id: 13
};
@@ -285,8 +285,8 @@ describe('ticket getTicketsFuture()', () => {
const options = {transaction: tx};
const args = {
- originDated: today,
- futureDated: today,
+ originScopeDays: today,
+ futureScopeDays: today,
warehouseFk: 1,
futureId: 12
};
diff --git a/modules/ticket/back/methods/ticket/specs/setWeight.spec.js b/modules/ticket/back/methods/ticket/specs/setWeight.spec.js
new file mode 100644
index 000000000..f6ef1f8e7
--- /dev/null
+++ b/modules/ticket/back/methods/ticket/specs/setWeight.spec.js
@@ -0,0 +1,70 @@
+const {models} = require('vn-loopback/server/server');
+
+describe('ticket setWeight()', () => {
+ const ctx = beforeAll.getCtx();
+ beforeAll.mockLoopBackContext();
+ let opts;
+ let tx;
+ const employeeId = 1;
+ const administrativeId = 5;
+
+ beforeEach(async() => {
+ opts = {transaction: tx};
+ tx = await models.Ticket.beginTransaction({});
+ opts.transaction = tx;
+ ctx.req.accessToken.userId = administrativeId;
+ });
+
+ afterEach(async() => await tx.rollback());
+
+ it('should throw an error if the weight is already set', async() => {
+ try {
+ const ticketId = 1;
+ const weight = 10;
+
+ await models.Ticket.setWeight(ctx, ticketId, weight, opts);
+ } catch (e) {
+ expect(e.message).toEqual('Weight already set');
+ }
+ });
+
+ it('should set the weight of a ticket', async() => {
+ const ticketId = 31;
+ const weight = 15;
+
+ await models.Ticket.setWeight(ctx, ticketId, weight, opts);
+
+ const ticket = await models.Ticket.findById(ticketId, null, opts);
+
+ expect(ticket.weight).toEqual(weight);
+ });
+
+ it('should throw an error if the user is not allocated to the same department', async() => {
+ ctx.req.accessToken.userId = employeeId;
+ try {
+ const ticketId = 10;
+ const weight = 20;
+
+ await models.Ticket.setWeight(ctx, ticketId, weight, opts);
+ } catch (e) {
+ expect(e.message).toEqual('This ticket is not allocated to your department');
+ }
+ });
+
+ it('should call invoiceTicketsAndPdf if the ticket is invoiceable', async() => {
+ const ticketId = 10;
+ const weight = 25;
+
+ spyOn(models.Client, 'findById').and.returnValue({
+ hasDailyInvoice: true,
+ salesPersonUser: () => ({id: 1})
+ });
+ spyOn(models.TicketState, 'findOne').and.returnValue({alertLevel: 3});
+ spyOn(models.Ticket, 'rawSql').and.returnValue([{taxArea: 'WORLD'}]);
+ spyOn(models.Ticket, 'invoiceTicketsAndPdf').and.returnValue([10]);
+
+ const invoiceIds = await models.Ticket.setWeight(ctx, ticketId, weight, opts);
+
+ expect(invoiceIds.length).toBeGreaterThan(0);
+ });
+});
diff --git a/modules/ticket/back/models/ticket-methods.js b/modules/ticket/back/models/ticket-methods.js
index 462862cb3..12161d5f5 100644
--- a/modules/ticket/back/models/ticket-methods.js
+++ b/modules/ticket/back/models/ticket-methods.js
@@ -46,4 +46,5 @@ module.exports = function(Self) {
require('../methods/ticket/invoiceTicketsAndPdf')(Self);
require('../methods/ticket/docuwareDownload')(Self);
require('../methods/ticket/myLastModified')(Self);
+ require('../methods/ticket/setWeight')(Self);
};
diff --git a/modules/ticket/front/advance/index.html b/modules/ticket/front/advance/index.html
index ca4d994d0..69db96bc1 100644
--- a/modules/ticket/front/advance/index.html
+++ b/modules/ticket/front/advance/index.html
@@ -39,14 +39,8 @@
|
-
- Destination
- {{model.userParams.dateToAdvance| date: 'dd/MM/yyyy'}}
- |
-
- Origin
- {{model.userParams.dateFuture | date: 'dd/MM/yyyy'}}
- |
+ Destination |
+ Origin |
@@ -56,14 +50,16 @@
check-field="checked">
|
-
- |
+ |
ID
|
IPT
|
+
+ Preparation
+ |
State
|
@@ -125,6 +121,7 @@
{{::ticket.ipt | dashIfEmpty}} |
+ {{::ticket.preparation | dashIfEmpty}} |
@@ -165,7 +162,6 @@
{{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}}
|
-
diff --git a/modules/ticket/front/future-search-panel/index.html b/modules/ticket/front/future-search-panel/index.html
index d873fbc37..bcf6e5fe3 100644
--- a/modules/ticket/front/future-search-panel/index.html
+++ b/modules/ticket/front/future-search-panel/index.html
@@ -1,7 +1,7 @@