Merge branch 'dev' into 7764-createClienteAsSupplier
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2025-02-21 12:17:20 +00:00
commit a410432365
11 changed files with 423 additions and 450 deletions

View File

@ -1,5 +1,5 @@
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION util.mockTime() CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION util.mockTime()
RETURNS DATETIME RETURNS DATETIME
DETERMINISTIC DETERMINISTIC
BEGIN BEGIN
@ -8,7 +8,7 @@ END$$
DELIMITER ; DELIMITER ;
DELIMITER $$ DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION util.mockUtcTime() CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION util.mockUtcTime()
RETURNS DATETIME RETURNS DATETIME
DETERMINISTIC DETERMINISTIC
BEGIN BEGIN

View File

@ -1,26 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `util`.`mockTimeBase`(vIsUtc BOOL)
RETURNS datetime
DETERMINISTIC
BEGIN
/**
* Returns the date formatted to utc if vIsUtc or config.mocTz if not
*
* @param vIsUtc If date must be returned as UTC format
* @return The formatted mock time
*/
DECLARE vMockUtcTime DATETIME;
DECLARE vMockTz VARCHAR(255);
SELECT mockUtcTime, mockTz
INTO vMockUtcTime, vMockTz
FROM config
LIMIT 1;
IF vIsUtc OR vMockTz IS NULL THEN
RETURN vMockUtcTime;
ELSE
RETURN CONVERT_TZ(vMockUtcTime, '+00:00', vMockTz);
END IF;
END$$
DELIMITER ;

View File

@ -4,22 +4,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `util`.`mockUtcTime`()
DETERMINISTIC DETERMINISTIC
BEGIN BEGIN
/** /**
* Returns the UTC datetime in mockTime format or timeStamp depending on config table * Returns current UTC dateTime
* *
* @return The UTC datetime format * @return The UTC datetime format
*/ */
-- FIXME: #5041 Commented because there is slowness when querying a table
/*
DECLARE vMockEnabled BOOL;
SELECT mockEnabled INTO vMockEnabled FROM config LIMIT 1;
IF vMockEnabled THEN
RETURN mockTimeBase(TRUE);
ELSE
RETURN UTC_TIMESTAMP();
END IF;
*/
RETURN UTC_TIMESTAMP(); RETURN UTC_TIMESTAMP();
END$$ END$$
DELIMITER ; DELIMITER ;

View File

@ -258,5 +258,6 @@
"clonedFromTicketWeekly": ", that is a cloned sale from ticket {{ ticketWeekly }}", "clonedFromTicketWeekly": ", that is a cloned sale from ticket {{ ticketWeekly }}",
"negativeReplaced": "Replaced item [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} with [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} from ticket [{{ticketId}}]({{{ticketUrl}}})", "negativeReplaced": "Replaced item [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} with [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} from ticket [{{ticketId}}]({{{ticketUrl}}})",
"The tag and priority can't be repeated": "The tag and priority can't be repeated", "The tag and priority can't be repeated": "The tag and priority can't be repeated",
"duplicateWarehouse": "The introduced warehouse already exists" "The introduced warehouse already exists": "The introduced warehouse already exists",
"The code already exists": "The code already exists"
} }

View File

@ -399,5 +399,6 @@
"Price cannot be blank": "El precio no puede estar en blanco", "Price cannot be blank": "El precio no puede estar en blanco",
"clonedFromTicketWeekly": ", que es una linea clonada del ticket {{ticketWeekly}}", "clonedFromTicketWeekly": ", que es una linea clonada del ticket {{ticketWeekly}}",
"negativeReplaced": "Sustituido el articulo [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} por [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} del ticket [{{ticketId}}]({{{ticketUrl}}})", "negativeReplaced": "Sustituido el articulo [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} por [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} del ticket [{{ticketId}}]({{{ticketUrl}}})",
"duplicateWarehouse": "El almacén seleccionado ya existe en la zona" "The introduced warehouse already exists": "El almacén seleccionado ya existe en la zona",
"The code already exists": "El código ya existe"
} }

View File

@ -0,0 +1,5 @@
module.exports = Self => {
Self.validatesUniquenessOf('code', {
message: `The code already exists`
});
};

View File

@ -1,4 +1,8 @@
module.exports = Self => { module.exports = Self => {
require('../methods/shelving/getSummary')(Self); require('../methods/shelving/getSummary')(Self);
require('../methods/shelving/addLog')(Self); require('../methods/shelving/addLog')(Self);
Self.validatesUniquenessOf('code', {
message: `The code already exists`
});
}; };

View File

@ -3,7 +3,7 @@ let UserError = require('vn-loopback/util/user-error');
module.exports = Self => { module.exports = Self => {
Self.rewriteDbError(function(err) { Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY') if (err.code === 'ER_DUP_ENTRY')
return new UserError(`duplicateWarehouse`); return new UserError(`The introduced warehouse already exists`);
return err; return err;
}); });
}; };

View File

@ -60,7 +60,7 @@
"@babel/register": "^7.7.7", "@babel/register": "^7.7.7",
"@commitlint/cli": "^19.2.1", "@commitlint/cli": "^19.2.1",
"@commitlint/config-conventional": "^19.1.0", "@commitlint/config-conventional": "^19.1.0",
"@verdnatura/myt": "^1.6.12", "@verdnatura/myt": "^1.6.13",
"angular-mocks": "^1.7.9", "angular-mocks": "^1.7.9",
"babel-jest": "^26.0.1", "babel-jest": "^26.0.1",
"babel-loader": "^8.2.4", "babel-loader": "^8.2.4",

View File

@ -143,8 +143,8 @@ devDependencies:
specifier: ^19.1.0 specifier: ^19.1.0
version: 19.1.0 version: 19.1.0
'@verdnatura/myt': '@verdnatura/myt':
specifier: ^1.6.12 specifier: ^1.6.13
version: 1.6.12 version: 1.6.13
angular-mocks: angular-mocks:
specifier: ^1.7.9 specifier: ^1.7.9
version: 1.8.3 version: 1.8.3
@ -2846,8 +2846,8 @@ packages:
dev: false dev: false
optional: true optional: true
/@verdnatura/myt@1.6.12: /@verdnatura/myt@1.6.13:
resolution: {integrity: sha512-t/SiDuQW9KJkcjhwQ9AkrcoTwghxQ7IyQ56e+88eYdoMi24l6bQGF0wHzMaIPRfQAoR8hqgfMOief4OAqW4Iqw==} resolution: {integrity: sha512-Qw5cfXa2FnjrMBbzP3InYc3vIjbNhyHhmle12Y7FaYFeYE+CXlerryuMqtcoe4+9PsCqwDCKlW37YKmipy2cnQ==}
hasBin: true hasBin: true
dependencies: dependencies:
'@sqltools/formatter': 1.2.5 '@sqltools/formatter': 1.2.5