diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 060ca7ee9..cb9ee0fe6 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -387,7 +387,7 @@ INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city (1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'); INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) - SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 + SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1 FROM `account`.`role` `r` WHERE `r`.`hasLogin` = 1; diff --git a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql index fbdc7ed58..bc0a40f11 100644 --- a/db/versions/10908-blueAsparagus/00-createSupplierDms.sql +++ b/db/versions/10908-blueAsparagus/00-createSupplierDms.sql @@ -1,9 +1,25 @@ +DELETE FROM vn.supplierDms + WHERE dmsFk IN ( + SELECT sd.dmsFk + FROM vn.supplierDms sd + LEFT JOIN vn.dms d ON d.id = sd.dmsFk + WHERE d.id IS NULL + ); + +DELETE FROM vn.supplierDms + WHERE supplierFk IN ( + SELECT sd.supplierFk + FROM vn.supplierDms sd + LEFT JOIN vn.supplier s ON s.id = sd.supplierFk + WHERE s.id IS NULL + ); + ALTER TABLE `vn`.`supplierDms` MODIFY COLUMN supplierFk int(10) unsigned NOT NULL, ADD editorFk INT UNSIGNED NULL, ADD CONSTRAINT user_Fk FOREIGN KEY (editorFk) REFERENCES account.`user`(id), - ADD CONSTRAINT dms_FK FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT dms_Fk FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT supplier_Fk FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id) ON UPDATE CASCADE; -ALTER TABLE `supplierLog` +ALTER TABLE `vn`.`supplierLog` MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier'; \ No newline at end of file diff --git a/db/versions/10912-brownCataractarum/00-firstScript.sql b/db/versions/10912-brownCataractarum/00-firstScript.sql new file mode 100644 index 000000000..51aea42a1 --- /dev/null +++ b/db/versions/10912-brownCataractarum/00-firstScript.sql @@ -0,0 +1,12 @@ +ALTER TABLE vn.country + MODIFY COLUMN code varchar(2) NOT NULL; + +ALTER TABLE vn.country + ADD CONSTRAINT country_unique UNIQUE KEY (code); + +ALTER TABLE vn.transitoryDuaUnified + ADD countryCodeFk varchar(2) DEFAULT 'EC' NOT NULL; + +ALTER TABLE vn.transitoryDuaUnified + ADD CONSTRAINT transitoryDuaUnified_country_FK FOREIGN KEY (countryCodeFk) + REFERENCES vn.country(code); diff --git a/modules/ticket/back/methods/ticket/saveCmr.js b/modules/ticket/back/methods/ticket/saveCmr.js index 691af796c..f8d0af8ef 100644 --- a/modules/ticket/back/methods/ticket/saveCmr.js +++ b/modules/ticket/back/methods/ticket/saveCmr.js @@ -63,7 +63,7 @@ module.exports = Self => { warehouseFk: ticket.warehouseFk, reference: ticket.id, contentType: 'application/pdf', - hasFile: true + hasFile: false }; const dms = await models.Dms.createFromStream(data, 'pdf', pdfStream, myOptions); diff --git a/modules/ticket/back/methods/ticket/saveSign.js b/modules/ticket/back/methods/ticket/saveSign.js index aa970237f..490b05320 100644 --- a/modules/ticket/back/methods/ticket/saveSign.js +++ b/modules/ticket/back/methods/ticket/saveSign.js @@ -80,7 +80,7 @@ module.exports = Self => { dmsTypeId: dmsTypeTicket.id, reference: ticket.id, description: `Firma del cliente - Ruta ${ticket.route().id}`, - hasFile: true + hasFile: false }; dms = await models.Dms.uploadFile(ctxUploadFile, myOptions); // Si se ha subido ya la firma, no se vuelve a subir, ya que si no