diff --git a/back/methods/osticket/sendToSupport.js b/back/methods/osticket/sendToSupport.js
index 5b9ebb4e3..135774919 100644
--- a/back/methods/osticket/sendToSupport.js
+++ b/back/methods/osticket/sendToSupport.js
@@ -35,10 +35,17 @@ module.exports = Self => {
let html = `Motivo:
${reason}
`;
html += `Usuario:
${ctx.req.accessToken.userId} ${emailUser.email}
`;
+ delete additionalData.backError.config.headers.Authorization;
+ const httpRequest = JSON.parse(additionalData?.httpRequest);
+
+ if (httpRequest)
+ delete httpRequest.config.headers.Authorization;
+ additionalData.httpRequest = httpRequest;
+
for (const data in additionalData)
html += `${data}:
${tryParse(additionalData[data])}
`;
- const subjectReason = JSON.parse(additionalData?.httpRequest)?.data?.error;
+ const subjectReason = httpRequest?.data?.error;
smtp.send({
to: `${config.app.reportEmail}, ${emailUser.email}`,
subject:
diff --git a/back/methods/viaexpress-config/internationalExpedition.js b/back/methods/viaexpress-config/internationalExpedition.js
index 698bb1dac..df50b21e5 100644
--- a/back/methods/viaexpress-config/internationalExpedition.js
+++ b/back/methods/viaexpress-config/internationalExpedition.js
@@ -20,7 +20,7 @@ module.exports = Self => {
}
});
- Self.internationalExpedition = async expeditionFk => {
+ Self.internationalExpedition = async (expeditionFk) => {
const models = Self.app.models;
const viaexpressConfig = await models.ViaexpressConfig.findOne({
diff --git a/back/methods/viaexpress-config/renderer.js b/back/methods/viaexpress-config/renderer.js
index e9abce5ca..c8533ea6b 100644
--- a/back/methods/viaexpress-config/renderer.js
+++ b/back/methods/viaexpress-config/renderer.js
@@ -20,11 +20,11 @@ module.exports = Self => {
}
});
- Self.renderer = async expeditionFk => {
+ Self.renderer = async (expeditionFk) => {
const models = Self.app.models;
const viaexpressConfig = await models.ViaexpressConfig.findOne({
- fields: ['client', 'user', 'password', 'defaultWeight', 'deliveryType']
+ fields: ['client', 'user', 'password', 'defaultWeight', 'deliveryType', 'agencyModeFk']
});
const expedition = await models.Expedition.findOne({
@@ -34,7 +34,7 @@ module.exports = Self => {
{
relation: 'ticket',
scope: {
- fields: ['shipped', 'addressFk', 'clientFk', 'companyFk'],
+ fields: ['shipped', 'addressFk', 'clientFk', 'companyFk', 'agencyModeFk'],
include: [
{
relation: 'client',
@@ -102,7 +102,6 @@ module.exports = Self => {
}
]
}
-
}
]
});
@@ -110,13 +109,15 @@ module.exports = Self => {
const ticket = expedition.ticket();
const sender = ticket.company().client();
const shipped = ticket.shipped.toISOString();
+ const isInterdia = (ticket.agencyModeFk === viaexpressConfig.agencyModeFk)
const data = {
viaexpressConfig,
sender,
senderAddress: sender.defaultAddress(),
client: ticket.client(),
address: ticket.address(),
- shipped
+ shipped,
+ isInterdia
};
const template = fs.readFileSync(__dirname + '/template.ejs', 'utf-8');
diff --git a/back/methods/viaexpress-config/template.ejs b/back/methods/viaexpress-config/template.ejs
index 0b6eb468c..f9acfe316 100644
--- a/back/methods/viaexpress-config/template.ejs
+++ b/back/methods/viaexpress-config/template.ejs
@@ -13,7 +13,7 @@
0
0
0
- 0
+ <%= isInterdia %>
0
diff --git a/back/models/viaexpress-config.json b/back/models/viaexpress-config.json
index 8df24201b..acab1f7e6 100644
--- a/back/models/viaexpress-config.json
+++ b/back/models/viaexpress-config.json
@@ -29,6 +29,9 @@
},
"deliveryType": {
"type": "string"
+ },
+ "agencyModeFk": {
+ "type": "number"
}
}
}
diff --git a/db/changes/240203/.gitkeep b/db/changes/240203/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/db/changes/240203/00-viaExpressConfig.sql b/db/changes/240203/00-viaExpressConfig.sql
new file mode 100644
index 000000000..57832e7cd
--- /dev/null
+++ b/db/changes/240203/00-viaExpressConfig.sql
@@ -0,0 +1,2 @@
+ALTER TABLE `vn`.`viaexpressConfig` ADD agencyModeFk int DEFAULT NULL NULL COMMENT 'Indica el agencyMode que es interdia';
+ALTER TABLE `vn`.`viaexpressConfig` ADD CONSTRAINT viaexpressConfig_agencyMode_Fk FOREIGN KEY (agencyModeFK) REFERENCES vn.agencyMode(id) ON DELETE RESTRICT ON UPDATE RESTRICT;
diff --git a/db/changes/240401/00-revokeItem.sql b/db/changes/240401/00-revokeItem.sql
new file mode 100644
index 000000000..2b75d67cf
--- /dev/null
+++ b/db/changes/240401/00-revokeItem.sql
@@ -0,0 +1,4 @@
+REVOKE UPDATE ON TABLE `vn`.`item` FROM `employee`;
+
+
+GRANT UPDATE(id, equivalent, stems, minPrice, isToPrint, family, box, category, doPhoto, image, inkFk, intrastatFk, hasMinPrice, created, comment, typeFk, generic, producerFk, description, density, relevancy, expenseFk, isActive, subName, tag5, value5, tag6, value6, tag7, value7, tag8, value8, tag9, value9, tag10, value10, minimum, upToDown, supplyResponseFk, hasKgPrice, isFloramondo, isFragile, numberOfItemsPerCask, embalageCode, quality, stemMultiplier, itemPackingTypeFk, packingOut, genericFk, packingShelve, isLaid, lastUsed, weightByPiece, weightByPiece, editorFk, recycledPlastic, nonRecycledPlastic, minQuantity) ON TABLE vn.item TO employee;
diff --git a/db/changes/240401/00-supplier.sql b/db/changes/240401/00-supplier.sql
new file mode 100644
index 000000000..e60707eca
--- /dev/null
+++ b/db/changes/240401/00-supplier.sql
@@ -0,0 +1,12 @@
+ALTER TABLE `vn`.`company` MODIFY COLUMN `supplierAccountFk` mediumint(8) unsigned DEFAULT NULL NULL COMMENT 'Cuenta por defecto para ingresos desde este pais';
+
+
+ALTER TABLE `vn`.`supplierAccount`
+ADD COLUMN `countryFk` mediumint(8) unsigned DEFAULT NULL,
+ADD CONSTRAINT `fk_supplierAccount_country`
+ FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE;
+
+ALTER TABLE `vn`.`supplierAccount`
+ADD UNIQUE KEY `uk_supplier_country` (`supplierFk`, `countryFk`);
+
+
diff --git a/db/changes/240401/01-saleGroupDetailDefaultSize.sql b/db/changes/240401/01-saleGroupDetailDefaultSize.sql
new file mode 100644
index 000000000..12f17c5e7
--- /dev/null
+++ b/db/changes/240401/01-saleGroupDetailDefaultSize.sql
@@ -0,0 +1,2 @@
+ALTER TABLE vn.productionConfig ADD itemPreviousDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa';
+UPDATE IGNORE vn.productionConfig SET itemPreviousDefaultSize = 40 WHERE id = 1;
diff --git a/db/changes/240401/01-supplierAccount.sql b/db/changes/240401/01-supplierAccount.sql
new file mode 100644
index 000000000..1c0f1ef43
--- /dev/null
+++ b/db/changes/240401/01-supplierAccount.sql
@@ -0,0 +1,9 @@
+UPDATE vn.supplierAccount sa
+ JOIN vn.country c ON sa.countryFk = c.id AND c.code = 'FR'
+ SET countryFk = c.id
+ WHERE iban = 'FR7630003012690002801121597';
+
+UPDATE vn.supplierAccount sa
+ JOIN vn.country c ON sa.countryFk = c.id AND c.code = 'PT'
+ SET countryFk = c.id
+ WHERE iban = 'PT50001000005813059150168';
diff --git a/db/changes/240401/02-invoiceOutConfig_refLen.sql b/db/changes/240401/02-invoiceOutConfig_refLen.sql
new file mode 100644
index 000000000..8b91889f2
--- /dev/null
+++ b/db/changes/240401/02-invoiceOutConfig_refLen.sql
@@ -0,0 +1,2 @@
+ALTER TABLE vn.invoiceOutConfig
+ ADD IF NOT EXISTS refLen TINYINT UNSIGNED DEFAULT 5 NOT NULL COMMENT 'Invoice reference identifier length';
diff --git a/db/changes/240401/00-fixInvoiceOutBeforeInsert.sql b/db/changes/240401/03-fixInvoiceOutBeforeInsert.sql
similarity index 51%
rename from db/changes/240401/00-fixInvoiceOutBeforeInsert.sql
rename to db/changes/240401/03-fixInvoiceOutBeforeInsert.sql
index 10e8d6356..0081c8803 100644
--- a/db/changes/240401/00-fixInvoiceOutBeforeInsert.sql
+++ b/db/changes/240401/03-fixInvoiceOutBeforeInsert.sql
@@ -4,17 +4,20 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceOut_beforeInse
FOR EACH ROW
BEGIN
/**
+ * Generates the next reference for the invoice serial. There cannot be gaps
+ * between identifiers of the same serial!
+ *
* Reference format:
- * - 0: Serial [A-Z]
- * - 1: Sage company id
- * - 2-3: Last two digits of issued year
- * - 4-8: Autoincrement identifier
- **/
- DECLARE vNewRef INT DEFAULT 0;
- DECLARE vCompanyCode INT;
+ * {0} Invoice serial
+ * {1} The company code
+ * {2-3} Last two digits of issue year
+ * {4-$} Autoincrement identifier
+ */
+ DECLARE vRef INT DEFAULT 0;
+ DECLARE vRefLen INT;
+ DECLARE vRefPrefix VARCHAR(255);
DECLARE vLastRef VARCHAR(255);
- DECLARE vRefStr VARCHAR(255);
- DECLARE vRefLen INT DEFAULT 5;
+ DECLARE vCompanyCode INT;
DECLARE vYearLen INT DEFAULT 2;
DECLARE vPrefixLen INT;
@@ -23,36 +26,34 @@ BEGIN
WHERE id = NEW.companyFk;
IF vCompanyCode IS NULL THEN
- CALL util.throw('sageCompanyNotDefined');
+ CALL util.throw('companyCodeNotDefined');
END IF;
SELECT MAX(i.ref) INTO vLastRef
FROM invoiceOut i
WHERE i.serial = NEW.serial
- AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.dayEnd(util.lastDayOfYear(NEW.issued))
+ AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.lastDayOfYear(NEW.issued)
AND i.companyFk = NEW.companyFk;
IF vLastRef IS NOT NULL THEN
SET vPrefixLen = LENGTH(NEW.serial) + LENGTH(vCompanyCode) + vYearLen;
SET vRefLen = LENGTH(vLastRef) - vPrefixLen;
- SET vRefStr = SUBSTRING(vLastRef, vPrefixLen + 1);
- SET vNewRef = vRefStr + 1;
-
- IF LENGTH(vNewRef) > vRefLen THEN
- CALL util.throw('refLenExceeded');
- END IF;
-
- SET NEW.ref = CONCAT(
- SUBSTRING(vLastRef, 1, vPrefixLen),
- LPAD(vNewRef, LENGTH(vRefStr), '0')
- );
+ SET vRefPrefix = LEFT(vLastRef, vPrefixLen);
+ SET vRef = RIGHT(vLastRef, vRefLen);
ELSE
- SET NEW.ref = CONCAT(
+ SELECT refLen INTO vRefLen FROM invoiceOutConfig;
+ SET vRefPrefix = CONCAT(
NEW.serial,
vCompanyCode,
- RIGHT(YEAR(NEW.issued), vYearLen),
- LPAD(1, vRefLen, '0')
+ RIGHT(YEAR(NEW.issued), vYearLen)
);
END IF;
+
+ SET vRef = vRef + 1;
+ IF LENGTH(vRef) > vRefLen THEN
+ CALL util.throw('refIdLenExceeded');
+ END IF;
+
+ SET NEW.ref = CONCAT(vRefPrefix, LPAD(vRef, vRefLen, '0'));
END$$
DELIMITER ;
diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index 923872f8c..b243692bb 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -600,6 +600,9 @@ INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`
('NATIONAL', 0, 1),
('WORLD', 2, 15);
+INSERT INTO vn.invoiceOutConfig
+ SET parallelism = 8;
+
INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
VALUES
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
@@ -623,9 +626,6 @@ UPDATE `vn`.`invoiceOut` SET ref = 'T3333333' WHERE id = 3;
UPDATE `vn`.`invoiceOut` SET ref = 'T4444444' WHERE id = 4;
UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5;
-INSERT INTO vn.invoiceOutConfig
- SET parallelism = 8;
-
INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`)
VALUES
(1, 895.76, 89.58, 4722000010),
diff --git a/e2e/paths/04-item/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js
index f177a98df..3bad18303 100644
--- a/e2e/paths/04-item/02_basic_data.spec.js
+++ b/e2e/paths/04-item/02_basic_data.spec.js
@@ -27,11 +27,8 @@ describe('Item Edit basic data path', () => {
it(`should edit the item basic data and confirm the item data was edited`, async() => {
const values = {
- name: 'Rose of Purity',
- longName: 'RS Rose of Purity',
type: 'Anthurium',
intrastat: 'Coral y materiales similares',
- origin: 'Spain',
relevancy: 1,
generic: 'Pallet',
isActive: false,
diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
index 9095eee0a..8be307269 100644
--- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
+++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
@@ -225,7 +225,7 @@ describe('Ticket Edit sale path', () => {
});
it('should show error trying to delete a ticket with a refund', async() => {
- await page.accessToSearchResult('6');
+ await page.accessToSearchResult('7');
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
await page.waitToClick(selectors.globalItems.acceptButton);
diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html
index 3e47faa5f..bcb78c48e 100644
--- a/modules/item/front/basic-data/index.html
+++ b/modules/item/front/basic-data/index.html
@@ -18,22 +18,6 @@