diff --git a/back/methods/postcode/filter.js b/back/methods/postcode/filter.js index 4c3fc0cd3..8b0f64d97 100644 --- a/back/methods/postcode/filter.js +++ b/back/methods/postcode/filter.js @@ -45,7 +45,7 @@ module.exports = Self => { {'pc.code': {like: `%${value}%`}}, {'t.name': {like: `%${value}%`}}, {'p.name': {like: `%${value}%`}}, - {'c.country': {like: `%${value}%`}} + {'c.name': {like: `%${value}%`}} ] }; } @@ -62,7 +62,7 @@ module.exports = Self => { pc.code, t.name as town, p.name as province, - c.country + c.name country FROM postCode pc JOIN town t on t.id = pc.townFk diff --git a/back/models/country.json b/back/models/country.json index fd540d819..a4c74d330 100644 --- a/back/models/country.json +++ b/back/models/country.json @@ -13,7 +13,7 @@ "id": true, "description": "Identifier" }, - "country": { + "name": { "type": "string", "required": true }, diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 895046e3d..3e6edf07d 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -162,7 +162,7 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`) (4, 'JPY', 'Yen Japones', 1), (5, 'CNY', 'Yuan Chino', 1.2); -INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`) +INSERT INTO `vn`.`country`(`id`, `name`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`) VALUES (1, 'España', 1, 'ES', 1, 24, 4, 0, 1), (2, 'Italia', 1, 'IT', 1, 27, 4, 0, 1), diff --git a/db/routines/vn/procedures/agencyVolume.sql b/db/routines/vn/procedures/agencyVolume.sql index 176b77726..ef47834ba 100644 --- a/db/routines/vn/procedures/agencyVolume.sql +++ b/db/routines/vn/procedures/agencyVolume.sql @@ -9,7 +9,7 @@ BEGIN DECLARE vEnded DATETIME DEFAULT util.dayEnd(util.VN_CURDATE()); SELECT ag.id agency_id, - CONCAT(RPAD(c.country, 16,' _') ,' ',ag.name) Agencia, + CONCAT(RPAD(c.name, 16,' _') ,' ',ag.name) Agencia, COUNT(*) expediciones, SUM(t.packages) Bultos, SUM(tpe.boxes) Faltan diff --git a/db/routines/vn/procedures/client_getRisk.sql b/db/routines/vn/procedures/client_getRisk.sql index 7fbade303..106284c2f 100644 --- a/db/routines/vn/procedures/client_getRisk.sql +++ b/db/routines/vn/procedures/client_getRisk.sql @@ -22,7 +22,7 @@ BEGIN c.credit, CAST(r.risk AS DECIMAL (10,2)) risk, CAST(c.credit - r.risk AS DECIMAL (10,2)) difference, - co.country + co.name country FROM client c JOIN tmp.risk r ON r.clientFk = c.id JOIN country co ON co.id = c.countryFk diff --git a/db/routines/vn/procedures/creditInsurance_getRisk.sql b/db/routines/vn/procedures/creditInsurance_getRisk.sql index 8ddb9d721..eccc37ca1 100644 --- a/db/routines/vn/procedures/creditInsurance_getRisk.sql +++ b/db/routines/vn/procedures/creditInsurance_getRisk.sql @@ -27,7 +27,7 @@ BEGIN cac.invoiced billedAnnually, c.dueDay, cgd.grade, - c2.country + c2.name country FROM tmp.clientGetDebt cgd LEFT JOIN tmp.risk r ON r.clientFk = cgd.clientFk JOIN client c ON c.id = cgd.clientFk diff --git a/db/routines/vn/procedures/stockBuyed_add.sql b/db/routines/vn/procedures/stockBuyed_add.sql index bddb720a5..1fff1484c 100644 --- a/db/routines/vn/procedures/stockBuyed_add.sql +++ b/db/routines/vn/procedures/stockBuyed_add.sql @@ -43,7 +43,7 @@ BEGIN INSERT INTO stockBuyed(buyed, dated, description) SELECT SUM(ic.cm3 * ito.quantity / vc.palletM3 / 1000000), vDated, - IF(c.code = 'ES', p.name, c.country) destiny + IF(c.code = 'ES', p.name, c.name) destiny FROM itemTicketOut ito JOIN ticket t ON t.id = ito.ticketFk JOIN `address` a ON a.id = t.addressFk diff --git a/db/routines/vn/triggers/country_afterInsert.sql b/db/routines/vn/triggers/country_afterInsert.sql index 0a7e5dc00..69294a9d5 100644 --- a/db/routines/vn/triggers/country_afterInsert.sql +++ b/db/routines/vn/triggers/country_afterInsert.sql @@ -5,14 +5,17 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_afterInsert` BEGIN UPDATE sage.Naciones SET countryFk = NEW.id - WHERE Nacion = NEW.country; + WHERE Nacion = NEW.name; IF ROW_COUNT() = 0 THEN CALL mail_insert( 'cau@verdnatura.es', NULL, 'Actualizar tabla sage.Naciones', - CONCAT('Se ha insertado un nuevo país en la tabla vn.conuntry. Para el correcto funcionamiento del sistema \n\t\t\t\tde contabilidad es necesario actualizar la columna sage.Naciones.countryFk con el valor del nuevo país. \n\t\t\t Hay que buscar el nuevo país: ', NEW.country, ' en la tabla sage.Naciones y actualizar el campo sage.Naciones.countryFk con el valor ', NEW.id) + CONCAT('Se ha insertado un nuevo país en la tabla vn.conuntry. + Para el correcto funcionamiento del sistema \n\t\t\t\tde contabilidad es necesario actualizar la columna + sage.Naciones.countryFk con el valor del nuevo país. \n\t\t\t Hay que buscar el nuevo país: ', NEW.name, + ' en la tabla sage.Naciones y actualizar el campo sage.Naciones.countryFk con el valor ', NEW.id) ); END IF; END$$ diff --git a/db/routines/vn/triggers/country_afterUpdate.sql b/db/routines/vn/triggers/country_afterUpdate.sql index 6afa2fd48..a38994735 100644 --- a/db/routines/vn/triggers/country_afterUpdate.sql +++ b/db/routines/vn/triggers/country_afterUpdate.sql @@ -3,8 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_afterUpdate` AFTER UPDATE ON `country` FOR EACH ROW BEGIN - IF !(OLD.country <=> NEW.country) THEN - UPDATE zoneGeo SET `name` = NEW.country + IF !(OLD.name <=> NEW.name) THEN + UPDATE zoneGeo SET `name` = NEW.name WHERE id = NEW.geoFk; END IF; END$$ diff --git a/db/routines/vn/triggers/country_beforeInsert.sql b/db/routines/vn/triggers/country_beforeInsert.sql index 26e0235ce..5ba5b832d 100644 --- a/db/routines/vn/triggers/country_beforeInsert.sql +++ b/db/routines/vn/triggers/country_beforeInsert.sql @@ -3,6 +3,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`country_beforeInsert` BEFORE INSERT ON `country` FOR EACH ROW BEGIN - SET NEW.geoFk = zoneGeo_new('country', NEW.country, NULL); + SET NEW.geoFk = zoneGeo_new('country', NEW.name, NULL); END$$ DELIMITER ; diff --git a/db/routines/vn/views/saleVolume_Today_VNH.sql b/db/routines/vn/views/saleVolume_Today_VNH.sql index 29b921bcb..c36779146 100644 --- a/db/routines/vn/views/saleVolume_Today_VNH.sql +++ b/db/routines/vn/views/saleVolume_Today_VNH.sql @@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` VIEW `vn`.`saleVolume_Today_VNH` AS SELECT `t`.`nickname` AS `Cliente`, `p`.`name` AS `Provincia`, - `c`.`country` AS `Pais`, + `c`.`name` AS `Pais`, cast(sum(`sv`.`volume`) AS decimal(5, 1)) AS `volume` FROM ( ( diff --git a/db/routines/vn2008/views/Paises.sql b/db/routines/vn2008/views/Paises.sql index ea7172dff..99d2835f0 100644 --- a/db/routines/vn2008/views/Paises.sql +++ b/db/routines/vn2008/views/Paises.sql @@ -2,7 +2,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn2008`.`Paises` AS SELECT `c`.`id` AS `Id`, - `c`.`country` AS `Pais`, + `c`.`name` AS `Pais`, `c`.`CEE` AS `CEE`, `c`.`isUeeMember` AS `isUeeMember`, `c`.`code` AS `Codigo`, diff --git a/db/versions/11013-orangeGerbera/00-firstScript.sql b/db/versions/11013-orangeGerbera/00-firstScript.sql new file mode 100644 index 000000000..2e8be531f --- /dev/null +++ b/db/versions/11013-orangeGerbera/00-firstScript.sql @@ -0,0 +1,4 @@ +-- Place your SQL code here +ALTER TABLE vn.country CHANGE country name varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL; + +ALTER TABLE vn.country ADD COLUMN country VARCHAR(25) AS (name) VIRTUAL; diff --git a/front/salix/components/bank-entity/index.html b/front/salix/components/bank-entity/index.html index 211b77317..6ce073f1a 100644 --- a/front/salix/components/bank-entity/index.html +++ b/front/salix/components/bank-entity/index.html @@ -28,7 +28,7 @@ ng-model="$ctrl.data.countryFk" url="Countries" fields="['id', 'country', 'code']" - show-field="country" + show-field="name" value-field="id" label="Country"> diff --git a/modules/client/back/methods/client/extendedListFilter.js b/modules/client/back/methods/client/extendedListFilter.js index 27bbe2a35..174970a2f 100644 --- a/modules/client/back/methods/client/extendedListFilter.js +++ b/modules/client/back/methods/client/extendedListFilter.js @@ -123,7 +123,7 @@ module.exports = Self => { c.hasLcr, c.hasCoreVnl, ct.id AS countryFk, - ct.country, + ct.name country, p.id AS provinceFk, p.name AS province, u.id AS salesPersonFk, diff --git a/modules/client/back/methods/defaulter/filter.js b/modules/client/back/methods/defaulter/filter.js index 220cb957b..ac9504ec2 100644 --- a/modules/client/back/methods/defaulter/filter.js +++ b/modules/client/back/methods/defaulter/filter.js @@ -69,7 +69,7 @@ module.exports = Self => { uw.name workerName, c.creditInsurance, d.defaulterSinced, - cn.country, + cn.name country, c.countryFk, pm.name payMethod FROM vn.defaulter d diff --git a/modules/client/front/address/create/index.html b/modules/client/front/address/create/index.html index 20e7b38e1..cd2be39c9 100644 --- a/modules/client/front/address/create/index.html +++ b/modules/client/front/address/create/index.html @@ -61,7 +61,7 @@ rule> {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.country}}) + {{town.province.country.name}}) {{name}}, {{province.name}} - ({{province.country.country}}) + ({{province.country.name}}) - {{name}} ({{country.country}}) + {{name}} ({{country.name}}) diff --git a/modules/client/front/address/edit/index.html b/modules/client/front/address/edit/index.html index e6b1dc71e..4bab3aeae 100644 --- a/modules/client/front/address/edit/index.html +++ b/modules/client/front/address/edit/index.html @@ -74,7 +74,7 @@ rule> {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.country}}) + {{town.province.country.name}}) {{name}}, {{province.name}} - ({{province.country.country}}) + ({{province.country.name}}) - {{name}} ({{country.country}}) + {{name}} ({{country.name}}) diff --git a/modules/client/front/address/index/index.html b/modules/client/front/address/index/index.html index ef3da4051..8ef423213 100644 --- a/modules/client/front/address/index/index.html +++ b/modules/client/front/address/index/index.html @@ -50,7 +50,7 @@ {{::address.postalCode}} - {{::address.city}}, {{::address.province.name}}, - {{::address.province.country.country}} + {{::address.province.country.name}}
{{::address.phone}}, diff --git a/modules/client/front/create/index.html b/modules/client/front/create/index.html index b5c23ecff..abd974cbf 100644 --- a/modules/client/front/create/index.html +++ b/modules/client/front/create/index.html @@ -66,7 +66,7 @@ rule> {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.country}}) + {{town.province.country.name}}) {{name}}, {{province.name}} - ({{province.country.country}}) + ({{province.country.name}}) @@ -101,14 +101,14 @@ url="Provinces/location" fields="['id', 'name', 'countryFk']" rule> - {{name}} ({{country.country}}) + {{name}} ({{country.name}}) + show-field="name"> diff --git a/modules/client/front/fiscal-data/index.html b/modules/client/front/fiscal-data/index.html index c2bf86f70..c366c8ca3 100644 --- a/modules/client/front/fiscal-data/index.html +++ b/modules/client/front/fiscal-data/index.html @@ -16,7 +16,7 @@ auto-load="true" url="Countries" data="countries" - order="country"> + order="name"> {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.country}}) + {{town.province.country.name}}) {{name}}, {{province.name}} - ({{province.country.country}}) + ({{province.country.name}}) @@ -126,14 +126,14 @@ show-field="name" value-field="id" rule> - {{name}} ({{country.country}}) + {{name}} ({{country.name}}) diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html index a42e192d0..3a46a4959 100644 --- a/modules/client/front/summary/index.html +++ b/modules/client/front/summary/index.html @@ -104,7 +104,7 @@ value="{{$ctrl.summary.province.name}}"> + value="{{$ctrl.summary.country.name}}"> diff --git a/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js b/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js index fc8830885..76ef29604 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js +++ b/modules/invoiceOut/back/methods/invoiceOut/negativeBases.js @@ -59,7 +59,7 @@ module.exports = Self => { `CREATE OR REPLACE TEMPORARY TABLE tmp.filter ENGINE = MEMORY SELECT co.code company, - cou.country, + cou.name country, c.id clientId, c.socialName clientSocialName, u.nickname workerSocialName, diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html index 5fe84591f..13c671d29 100644 --- a/modules/item/front/summary/index.html +++ b/modules/item/front/summary/index.html @@ -181,7 +181,7 @@ ng-show="!$ctrl.isBuyer && !$ctrl.isAdministrative"> Tax - diff --git a/modules/item/front/tax/index.html b/modules/item/front/tax/index.html index e993f974f..78858704f 100644 --- a/modules/item/front/tax/index.html +++ b/modules/item/front/tax/index.html @@ -15,7 +15,7 @@ { SELECT t.cmrFk, t.id ticketFk, t.routeFk, - co.country, + co.name country, t.clientFk, IF(sub.id, TRUE, FALSE) hasCmrDms, DATE(t.shipped) shipped diff --git a/modules/supplier/front/address/create/index.html b/modules/supplier/front/address/create/index.html index e45539445..e3f883641 100644 --- a/modules/supplier/front/address/create/index.html +++ b/modules/supplier/front/address/create/index.html @@ -43,7 +43,7 @@ rule> {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.country}}) + {{town.province.country.name}}) {{name}}, {{province.name}} - ({{province.country.country}}) + ({{province.country.name}}) - {{name}} ({{country.country}}) + {{name}} ({{country.name}}) diff --git a/modules/supplier/front/address/edit/index.html b/modules/supplier/front/address/edit/index.html index b6f90134b..b966023da 100644 --- a/modules/supplier/front/address/edit/index.html +++ b/modules/supplier/front/address/edit/index.html @@ -41,7 +41,7 @@ rule> {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.country}}) + {{town.province.country.name}}) {{name}}, {{province.name}} - ({{province.country.country}}) + ({{province.country.name}}) - {{name}} ({{country.country}}) + {{name}} ({{country.name}}) diff --git a/modules/supplier/front/fiscal-data/index.html b/modules/supplier/front/fiscal-data/index.html index 3fe67762f..6455bf3fd 100644 --- a/modules/supplier/front/fiscal-data/index.html +++ b/modules/supplier/front/fiscal-data/index.html @@ -16,7 +16,7 @@ auto-load="true" url="Countries" data="countries" - order="country"> + order="name"> {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.country}}) + {{town.province.country.name}}) {{name}}, {{province.name}} - ({{province.country.country}}) + ({{province.country.name}}) - {{name}} ({{country.country}}) + {{name}} ({{country.name}}) @@ -198,7 +198,7 @@ vn-name="country" ng-model="$ctrl.supplier.countryFk" data="countries" - show-field="country" + show-field="name" value-field="id" rule> diff --git a/modules/supplier/front/summary/index.html b/modules/supplier/front/summary/index.html index d1b3ee20a..5ba713fcf 100644 --- a/modules/supplier/front/summary/index.html +++ b/modules/supplier/front/summary/index.html @@ -162,7 +162,7 @@ + value="{{::$ctrl.summary.country.name}}"> diff --git a/modules/worker/front/create/index.html b/modules/worker/front/create/index.html index 39b2dbf47..3030ffecd 100644 --- a/modules/worker/front/create/index.html +++ b/modules/worker/front/create/index.html @@ -65,7 +65,7 @@ rule> {{code}} - {{town.name}} ({{town.province.name}}, - {{town.province.country.country}}) + {{town.province.country.name}}) - {{name}} ({{country.country}}) + {{name}} ({{country.name}}) @@ -99,7 +99,7 @@ value-field="name"> {{name}}, {{province.name}} - ({{province.country.country}}) + ({{province.country.name}})
- {{town.province.name}}, {{town.province.country.country}} + {{town.province.name}}, {{town.province.country.name}}
diff --git a/print/templates/reports/campaign-metrics/sql/client.sql b/print/templates/reports/campaign-metrics/sql/client.sql index 9f392c97e..38f9fffc6 100644 --- a/print/templates/reports/campaign-metrics/sql/client.sql +++ b/print/templates/reports/campaign-metrics/sql/client.sql @@ -6,7 +6,7 @@ SELECT c.id, c.name AS clientName, p.name AS province, - co.country + co.name country FROM client c JOIN province p ON c.provinceFk = p.id JOIN country co ON c.countryFk = co.id diff --git a/print/templates/reports/claim-pickup-order/sql/client.sql b/print/templates/reports/claim-pickup-order/sql/client.sql index 640b0c8a7..47e89cf1b 100644 --- a/print/templates/reports/claim-pickup-order/sql/client.sql +++ b/print/templates/reports/claim-pickup-order/sql/client.sql @@ -8,7 +8,7 @@ SELECT a.street, a.nickname, p.name AS province, - ct.country, + ct.name country, IFNULL(c.phone, cc.phone) AS phone FROM claim cl JOIN client c ON c.id = cl.clientFk diff --git a/print/templates/reports/client-debt-statement/sql/client.sql b/print/templates/reports/client-debt-statement/sql/client.sql index d675cf168..acc616131 100644 --- a/print/templates/reports/client-debt-statement/sql/client.sql +++ b/print/templates/reports/client-debt-statement/sql/client.sql @@ -6,7 +6,7 @@ SELECT c.city, c.fi, p.name AS province, - ct.country + ct.name country FROM client c JOIN country ct ON ct.id = c.countryFk LEFT JOIN province p ON p.id = c.provinceFk diff --git a/print/templates/reports/cmr/sql/data.sql b/print/templates/reports/cmr/sql/data.sql index e9500cc4b..42231709a 100644 --- a/print/templates/reports/cmr/sql/data.sql +++ b/print/templates/reports/cmr/sql/data.sql @@ -14,12 +14,12 @@ SELECT c.id cmrFk, s.street carrierStreet, s.postCode carrierPostCode, s.city carrierCity, - cou.country carrierCountry, + cou.name carrierCountry, s2.name senderName, s2.street senderStreet, s2.postCode senderPostCode, s2.city senderCity, - cou2.country senderCountry, + cou2.name senderCountry, a.street deliveryStreet, a.id deliveryAddressFk, a.postalCode deliveryPostalCode, @@ -27,12 +27,12 @@ SELECT c.id cmrFk, a.nickname deliveryName, a.phone deliveryPhone, a.mobile deliveryMobile, - cou3.country deliveryCountry, + cou3.name deliveryCountry, cl.phone clientPhone, a2.street loadStreet, a2.postalCode loadPostalCode, a2.city loadCity, - cou4.country loadCountry, + cou4.name loadCountry, co.stamp senderStamp, s.stamp deliveryStamp FROM cmr c diff --git a/print/templates/reports/incoterms-authorization/sql/client.sql b/print/templates/reports/incoterms-authorization/sql/client.sql index bb17afd1d..9eff1379c 100644 --- a/print/templates/reports/incoterms-authorization/sql/client.sql +++ b/print/templates/reports/incoterms-authorization/sql/client.sql @@ -4,7 +4,7 @@ SELECT c.name, c.fi, c.street, - cty.country + cty.name country FROM client c JOIN country cty ON cty.id = c.countryFk WHERE c.id = ? \ No newline at end of file diff --git a/print/templates/reports/letter-debtor/sql/client.sql b/print/templates/reports/letter-debtor/sql/client.sql index d675cf168..87fffb8b7 100644 --- a/print/templates/reports/letter-debtor/sql/client.sql +++ b/print/templates/reports/letter-debtor/sql/client.sql @@ -6,7 +6,7 @@ SELECT c.city, c.fi, p.name AS province, - ct.country + ct.name country FROM client c JOIN country ct ON ct.id = c.countryFk LEFT JOIN province p ON p.id = c.provinceFk diff --git a/print/templates/reports/sepa-core/sql/client.sql b/print/templates/reports/sepa-core/sql/client.sql index c22e7f114..b3ba180b3 100644 --- a/print/templates/reports/sepa-core/sql/client.sql +++ b/print/templates/reports/sepa-core/sql/client.sql @@ -7,7 +7,7 @@ SELECT c.city, c.fi, p.name AS province, - ct.country, + ct.name country, ct.code AS countryCode, ct.ibanLength AS ibanLength FROM client c diff --git a/print/templates/reports/sepa-core/sql/supplier.sql b/print/templates/reports/sepa-core/sql/supplier.sql index 80635ecf5..156fc71c0 100644 --- a/print/templates/reports/sepa-core/sql/supplier.sql +++ b/print/templates/reports/sepa-core/sql/supplier.sql @@ -2,7 +2,7 @@ SELECT m.code mandateCode, s.name, s.street, - sc.country, + sc.name country, s.postCode, s.city, sp.name province, diff --git a/print/templates/reports/supplier-campaign-metrics/sql/supplier.sql b/print/templates/reports/supplier-campaign-metrics/sql/supplier.sql index 0c2fa12ed..d446ba6e6 100644 --- a/print/templates/reports/supplier-campaign-metrics/sql/supplier.sql +++ b/print/templates/reports/supplier-campaign-metrics/sql/supplier.sql @@ -5,7 +5,7 @@ SELECT s.id, s.name AS supplierName, p.name AS province, - co.country + co.name country FROM supplier s JOIN province p ON s.provinceFk = p.id JOIN country co ON s.countryFk = co.id