7691-testToMaster #2703

Merged
alexm merged 268 commits from 7691-testToMaster into master 2024-07-09 05:38:28 +00:00
27 changed files with 277 additions and 106 deletions
Showing only changes of commit 2b0df02f20 - Show all commits

View File

@ -3889,6 +3889,20 @@ INSERT INTO `vn`.`calendarHolidays` (calendarHolidaysTypeFk, dated, calendarHoli
(1, '2001-05-17', 1, 5),
(1, '2001-05-18', 1, 5);
INSERT INTO vn.payrollComponent
(id, name, isSalaryAgreed, isVariable, isException)
VALUES
(1, 'Salario1', 1, 0, 0),
(2, 'Salario2', 1, 1, 0),
(3, 'Salario3', 1, 0, 1);
INSERT INTO vn.workerIncome
(debit, credit, incomeTypeFk, paymentDate, workerFk, concept)
VALUES
(1000.00, 900.00, 2, '2000-01-01', 1106, NULL),
(1001.00, 800.00, 2, '2000-01-01', 1106, NULL);
INSERT INTO dipole.printer (id, description)
VALUES(1, '');

View File

@ -1,16 +1,15 @@
DROP PROCEDURE IF EXISTS floranet.catalogue_get;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE floranet.catalogue_get(vLanded DATE, vPostalCode VARCHAR(15))
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE floranet.catalogue_get(vLanded DATE, vPostalCode VARCHAR(15))
READS SQL DATA
proc:BEGIN
/**
* Returns list, price and all the stuff regarding the floranet items.
* Returns list, price and all the stuff regarding the floranet items, for the designed shop
*
* @param vLanded Delivery date
* @param vPostalCode Delivery address postal code
*/
DECLARE vAddressFk INT;
DECLARE vLastCatalogueFk INT;
DECLARE vLockName VARCHAR(20);
DECLARE vLockTime INT;
@ -32,6 +31,15 @@ proc:BEGIN
SELECT MAX(id) INTO vLastCatalogueFk
FROM catalogue;
SELECT addressFk
INTO vAddressFk
FROM addressPostCode apc
WHERE apc.dayOfWeek = dayOfWeek(vLanded)
AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR
AND apc.postCode = vPostalCode
-- Aquí hay que incluir los criterios de selección de tienda
LIMIT 1;
INSERT INTO catalogue(
name,
price,
@ -51,17 +59,14 @@ proc:BEGIN
it.name,
CONCAT('https://cdn.verdnatura.es/image/catalog/1600x900/', i.image),
i.description,
apc.addressFk
vAddressFk
FROM vn.item i
JOIN (SELECT itemFk, SUM(quantity * cost) price
FROM recipe
GROUP BY itemFk) r ON r.itemFk = i.id
JOIN vn.itemType it ON it.id = i.typeFk
JOIN addressPostCode apc
ON apc.dayOfWeek = dayOfWeek(vLanded)
AND NOW() < vLanded - INTERVAL apc.hoursInAdvance HOUR
AND apc.postCode = vPostalCode
JOIN vn.address a ON a.id = apc.addressFk;
JOIN addressPostCode apc ON addressFk = vAddressFk
JOIN vn.address a ON a.id = vAddressFk;
SELECT *
FROM catalogue

View File

@ -1,8 +1,6 @@
DROP PROCEDURE IF EXISTS floranet.deliveryDate_get;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `floranet`.`deliveryDate_get`(vPostalCode VARCHAR(15))
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `floranet`.`deliveryDate_get`(vPostalCode VARCHAR(15))
READS SQL DATA
BEGIN
/**

View File

@ -101,7 +101,7 @@ proc:BEGIN
vNewTicketFk,
c.itemFk,
CONCAT('Entrega: ',c.name),
- c.price,
- apc.deliveryCost,
1
FROM catalogue c
JOIN addressPostCode apc
@ -119,7 +119,7 @@ proc:BEGIN
vNewTicketFk,
r.elementFk,
i.longName,
r.cost,
0,
r.quantity
FROM catalogue c
JOIN recipe r ON r.itemFk = c.itemFk

View File

@ -26,6 +26,7 @@ BEGIN
JOIN province p ON p.id = c.provinceFk
LEFT JOIN autonomy a ON a.id = p.autonomyFk
JOIN country co ON co.id = p.countryFk
JOIN bs.clientDiedPeriod cdp ON cdp.countryFk = co.id
WHERE cd.warning = 'third'
AND cp.clientFk IS NULL
AND sp.salesPersonFk IS NULL

View File

@ -1,5 +1,7 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(vTicketFk INT)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(
vTicketFk INT
)
BEGIN
/**
* Splita las lineas de ticket que no estan ubicadas
@ -50,7 +52,7 @@ BEGIN
SET s.ticketFk = vNewTicketFk;
END IF;
CALL ticketStateUpdate(vNewTicketFk, 'FIXING');
CALL ticket_setState(vNewTicketFk, 'FIXING');
DROP TEMPORARY TABLE tmp.SalesToSplit;
END$$

View File

@ -1,5 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(vDateFrom DATE, vDateTo DATE)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_cloneWeekly`(
vDateFrom DATE,
vDateTo DATE
)
BEGIN
DECLARE vIsDone BOOL;
DECLARE vLanding DATE;
@ -41,7 +44,14 @@ BEGIN
DECLARE vMessage TEXT;
SET vIsDone = FALSE;
FETCH rsTicket INTO vTicketFk,vClientFk, vWarehouseFk, vCompanyFk, vAddressFk, vAgencyModeFk,vShipment;
FETCH rsTicket INTO
vTicketFk,
vClientFk,
vWarehouseFk,
vCompanyFk,
vAddressFk,
vAgencyModeFk,
vShipment;
IF vIsDone THEN
LEAVE myLoop;
@ -88,8 +98,14 @@ BEGIN
SET clonedFrom = vTicketFk
WHERE id = vNewTicket;
INSERT INTO sale (ticketFk, itemFk, concept, quantity, price,
discount, priceFixed, isPriceFixed)
INSERT INTO sale (ticketFk,
itemFk,
concept,
quantity,
price,
discount,
priceFixed,
isPriceFixed)
SELECT vNewTicket,
saleOrig.itemFk,
saleOrig.concept,
@ -189,7 +205,7 @@ BEGIN
IF NOT vIsDuplicateMail THEN
CALL mail_insert(vSalesPersonEmail, NULL, vSubject, vMessage);
END IF;
CALL ticketStateUpdate (vNewTicket, 'FIXING');
CALL ticket_setState(vNewTicket, 'FIXING');
ELSE
CALL ticketCalculateClon(vNewTicket, vTicketFk);
END IF;

View File

@ -1,5 +1,9 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(vTicketFk INT, vTicketFutureFk INT, vDated DATE)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_split`(
vTicketFk INT,
vTicketFutureFk INT,
vDated DATE
)
proc:BEGIN
/**
* Mueve las lineas con problemas a otro ticket existente o a uno nuevo.
@ -17,45 +21,41 @@ proc:BEGIN
FROM tmp.salesToSplit
WHERE ticketFk = vTicketFk;
SELECT count(*) INTO vTotalLines
FROM vn.sale s
SELECT COUNT(*) INTO vTotalLines
FROM sale s
WHERE s.ticketFk = vTicketFk;
SET vHasFullProblem = (vTotalLines = vProblemLines);
-- Ticket completo
IF vHasFullProblem THEN
UPDATE vn.ticket
UPDATE ticket
SET landed = vDated + INTERVAL 1 DAY,
shipped = vDated,
nickname = CONCAT('(',DAY(util.VN_CURDATE()),') ', nickname)
WHERE id = vTicketFk;
SELECT "moved" message, NULL ticketFuture;
SELECT 'moved' message, NULL ticketFuture;
LEAVE proc;
END IF;
-- Ticket a futuro existe
IF vTicketFutureFk THEN
UPDATE vn.sale s
UPDATE sale s
JOIN tmp.salesToSplit ss ON s.id = ss.saleFk
SET s.ticketFk = vTicketFutureFk,
s.concept = CONCAT('(s) ', s.concept)
WHERE ss.ticketFk = vTicketFk;
SELECT "future" message, NULL ticketFuture;
SELECT 'future' message, NULL ticketFuture;
LEAVE proc;
END IF;
-- Ticket nuevo
CALL vn.ticket_Clone(vTicketFk, vTicketFutureFk);
CALL ticket_Clone(vTicketFk, vTicketFutureFk);
UPDATE vn.ticket t
JOIN vn.productionConfig pc
UPDATE ticket t
JOIN productionConfig pc
SET t.routeFk = IF(t.shipped = vDated , t.routeFk, NULL),
t.landed = vDated + INTERVAL 1 DAY,
t.shipped = vDated,
@ -63,14 +63,14 @@ proc:BEGIN
t.zoneFk = pc.defaultZone
WHERE t.id = vTicketFutureFk;
UPDATE vn.sale s
UPDATE sale s
JOIN tmp.salesToSplit sts ON sts.saleFk = s.id
SET s.ticketFk = vTicketFutureFk,
s.concept = CONCAT('(s) ', s.concept)
WHERE sts.ticketFk = vTicketFk;
CALL vn.ticketStateUpdate(vTicketFutureFk, 'FIXING');
CALL ticket_setState(vTicketFutureFk, 'FIXING');
SELECT "new" message,vTicketFutureFk ticketFuture;
SELECT 'new' message, vTicketFutureFk ticketFuture;
END$$
DELIMITER ;

View File

@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS vn.travelKgPercentage (
className VARCHAR(50)
);
INSERT INTO vn.travelKgPercentage (value, className)
INSERT IGNORE INTO vn.travelKgPercentage (value, className)
VALUES
(80, 'primary'),
(100, 'alert');

View File

@ -0,0 +1,6 @@
-- Place your SQL code here
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES
('WorkerIncome', '*', '*', 'ALLOW', 'ROLE', 'hr'),
('PayrollComponent', '*', '*', 'ALLOW', 'ROLE', 'hr'),
('Worker', '__get__incomes', '*', 'ALLOW', 'ROLE', 'hr');

View File

@ -1,18 +0,0 @@
-- Place your SQL code here
CREATE TABLE IF NOT EXISTS vn.travelKgPercentage (
value INT(3) PRIMARY KEY,
className VARCHAR(50)
);
INSERT IGNORE INTO vn.travelKgPercentage (value, className)
VALUES
(80, 'primary'),
(100, 'alert');
INSERT IGNORE INTO salix.ACL
SET model = 'TravelKgPercentage',
property = '*',
accessType = 'READ',
permission = 'ALLOW',
principalType = 'ROLE',
principalId = 'employee';

View File

@ -0,0 +1,8 @@
-- Place your SQL code here
USE vn;
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('ItemShelvingLog', '*', 'READ', 'ALLOW', 'ROLE', 'production');
-- redmine regularitzar parking per a que no tinguen espais
ALTER TABLE parking DROP CONSTRAINT chkParkingCodeFormat;
ALTER TABLE parking
ADD CONSTRAINT chkParkingCodeFormat CHECK (CHAR_LENGTH(code) > 4 AND code REGEXP ('^[^ ]+-[^ ]+$'));

View File

@ -27,7 +27,7 @@
vn-id="country"
ng-model="$ctrl.data.countryFk"
url="Countries"
fields="['id', 'country', 'code']"
fields="['id', 'name', 'code']"
show-field="name"
value-field="id"
label="Country">

View File

@ -366,5 +366,6 @@
"It has been invoiced but the PDF could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
"It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono",
"Payment method is required": "El método de pago es obligatorio",
"Cannot send mail": "Não é possível enviar o email"
"Cannot send mail": "Não é possível enviar o email",
"CONSTRAINT `supplierAccountTooShort` failed for `vn`.`supplier`": "La cuenta debe tener exactamente 10 dígitos"
}

View File

@ -22,7 +22,7 @@ module.exports = function() {
}
// MySQL user-defined exceptions
if (err.sqlState == '45000')
if (err.sqlState == '45000' || err?.errno == 4025)
return next(new UserError(req.__(err.sqlMessage)));
// Logs error to console

View File

@ -50,7 +50,7 @@ module.exports = function(Self) {
{
relation: 'country',
scope: {
fields: ['id', 'country']
fields: ['id', 'name']
}
},
{

View File

@ -54,7 +54,7 @@ module.exports = Self => {
{
relation: 'country',
scope: {
fields: ['country']
fields: ['name']
}
},
{

View File

@ -37,7 +37,7 @@ class Controller extends Section {
include: {
relation: 'country',
scope: {
fields: ['id', 'country']
fields: ['id', 'name']
}
}
}

View File

@ -28,7 +28,7 @@ class Controller extends Section {
field: 'countryFk',
autocomplete: {
url: 'Countries',
showField: 'country',
showField: 'name',
}
},
{

View File

@ -59,7 +59,7 @@ module.exports = Self => {
include: [{
relation: 'country',
scope: {
fields: ['id', 'country']
fields: ['id', 'name']
}
}, {
relation: 'taxClass',

View File

@ -50,6 +50,9 @@
"ItemShelving": {
"dataSource": "vn"
},
"ItemShelvingLog": {
"dataSource": "vn"
},
"ItemShelvingSale": {
"dataSource": "vn"
},

View File

@ -0,0 +1,52 @@
{
"name": "ItemShelvingLog",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "itemShelvingLog"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"created": {
"type": "date"
},
"shelvingFk": {
"type": "string"
},
"itemFk": {
"type": "number"
},
"visible": {
"type": "number"
},
"accion": {
"type": "string"
}
},
"relations": {
"item": {
"type": "belongsTo",
"model": "Item",
"foreignKey": "itemFk"
},
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"shelving": {
"type": "belongsTo",
"model": "Shelving",
"foreignKey": "shelvingFk",
"primaryKey": "code"
}
}
}

View File

@ -55,7 +55,7 @@ module.exports = Self => {
{
relation: 'country',
scope: {
fields: ['id', 'country', 'code']
fields: ['id', 'name', 'code']
}
},
{

View File

@ -125,6 +125,12 @@
"Locker": {
"dataSource": "vn"
},
"PayrollComponent": {
"dataSource": "vn"
},
"WorkerIncome": {
"dataSource": "vn"
},
"TrainingCourse": {
"dataSource": "vn"
},

View File

@ -0,0 +1,27 @@
{
"name": "PayrollComponent",
"base": "VnModel",
"options": {
"mysql": {
"table": "payrollComponent"
}
},
"properties": {
"id": {
"id": true,
"type": "number"
},
"name": {
"type": "string"
},
"isSalaryAgreed": {
"type": "number"
},
"isVariable": {
"type": "number"
},
"isException": {
"type": "number"
}
}
}

View File

@ -0,0 +1,45 @@
{
"name": "WorkerIncome",
"base": "VnModel",
"options": {
"mysql": {
"table": "workerIncome"
}
},
"properties": {
"id": {
"id": true,
"type": "number"
},
"debit": {
"type": "number"
},
"credit": {
"type": "number"
},
"incomeTypeFk": {
"type": "number"
},
"paymentDate": {
"type": "date"
},
"workerFk": {
"type": "number"
},
"concept": {
"type": "string"
}
},
"relations": {
"payrollComponent": {
"type": "belongsTo",
"model": "PayrollComponent",
"foreignKey": "id"
},
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
}
}
}

View File

@ -116,6 +116,11 @@
"model": "Locker",
"foreignKey": "workerFk"
},
"incomes": {
"type": "hasMany",
"model": "WorkerIncome",
"foreignKey": "workerFk"
},
"trainingCourse": {
"type": "hasMany",
"model": "TrainingCourse",