Merge pull request 'feat: refs #7039 country' (!2361) from 7039-country-country into dev
gitea/salix/pipeline/head There was a failure building this commit Details

Reviewed-on: #2361
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
This commit is contained in:
Robert Ferrús 2024-05-14 08:12:13 +00:00
commit 6ae48790f3
41 changed files with 74 additions and 67 deletions

View File

@ -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

View File

@ -13,7 +13,7 @@
"id": true,
"description": "Identifier"
},
"country": {
"name": {
"type": "string",
"required": true
},

View File

@ -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),

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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$$

View File

@ -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$$

View File

@ -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 ;

View File

@ -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 (
(

View File

@ -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`,

View File

@ -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;

View File

@ -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">
</vn-autocomplete>

View File

@ -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,

View File

@ -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

View File

@ -61,7 +61,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -83,7 +83,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
<vn-autocomplete vn-id="province" vn-one
@ -94,7 +94,7 @@
show-field="name"
value-field="id"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>

View File

@ -74,7 +74,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -96,7 +96,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
<vn-autocomplete vn-id="province" vn-one
@ -107,7 +107,7 @@
show-field="name"
value-field="id"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>

View File

@ -50,7 +50,7 @@
<span ng-show="::address.postalCode">{{::address.postalCode}} -</span>
<span ng-show="::address.city">{{::address.city}},</span>
<span ng-show="::address.province.name">{{::address.province.name}},</span>
{{::address.province.country.country}}
{{::address.province.country.name}}
</div>
<div class="ellipsize">
{{::address.phone}}<span ng-if="::address.mobile">, </span>

View File

@ -66,7 +66,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -88,7 +88,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
</vn-horizontal>
@ -101,14 +101,14 @@
url="Provinces/location"
fields="['id', 'name', 'countryFk']"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
<vn-autocomplete
vn-id="country"
label="Country"
ng-model="$ctrl.client.countryFk"
url="Countries"
show-field="country">
show-field="name">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>

View File

@ -16,7 +16,7 @@
auto-load="true"
url="Countries"
data="countries"
order="country">
order="name">
</vn-crud-model>
<vn-crud-model
auto-load="true"
@ -87,7 +87,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -110,7 +110,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
</vn-horizontal>
@ -126,14 +126,14 @@
show-field="name"
value-field="id"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
<vn-autocomplete
vn-one
vn-id="country"
ng-model="$ctrl.client.countryFk"
data="countries"
show-field="country"
show-field="name"
value-field="id"
label="Country"
rule>

View File

@ -104,7 +104,7 @@
value="{{$ctrl.summary.province.name}}">
</vn-label-value>
<vn-label-value label="Country"
value="{{$ctrl.summary.country.country}}">
value="{{$ctrl.summary.country.name}}">
</vn-label-value>
<vn-label-value label="Street" no-ellipsize
value="{{$ctrl.summary.street}}">

View File

@ -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,

View File

@ -181,7 +181,7 @@
ng-show="!$ctrl.isBuyer && !$ctrl.isAdministrative">
Tax
</h4>
<vn-label-value label="{{tax.country.country}}"
<vn-label-value label="{{tax.country.name}}"
ng-repeat="tax in $ctrl.summary.item.taxes"
value="{{tax.taxClass.description}}">
</vn-label-value>

View File

@ -15,7 +15,7 @@
<vn-textfield
vn-one
label="Country"
ng-model="tax.country.country"
ng-model="tax.country.name"
disabled="true">
</vn-textfield>
<vn-autocomplete

View File

@ -103,7 +103,7 @@ module.exports = Self => {
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

View File

@ -43,7 +43,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -65,7 +65,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
<vn-autocomplete vn-id="province" vn-one
@ -76,7 +76,7 @@
show-field="name"
value-field="id"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>

View File

@ -41,7 +41,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -63,7 +63,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
<vn-autocomplete vn-id="province" vn-one
@ -74,7 +74,7 @@
show-field="name"
value-field="id"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>

View File

@ -16,7 +16,7 @@
auto-load="true"
url="Countries"
data="countries"
order="country">
order="name">
</vn-crud-model>
<vn-crud-model
auto-load="true"
@ -143,7 +143,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -172,7 +172,7 @@
rule>
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
<vn-autocomplete
@ -187,7 +187,7 @@
show-field="name"
value-field="id"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
@ -198,7 +198,7 @@
vn-name="country"
ng-model="$ctrl.supplier.countryFk"
data="countries"
show-field="country"
show-field="name"
value-field="id"
rule>
</vn-autocomplete>

View File

@ -162,7 +162,7 @@
</vn-label-value>
<vn-label-value
label="Country"
value="{{::$ctrl.summary.country.country}}">
value="{{::$ctrl.summary.country.name}}">
</vn-label-value>
</vn-one>
</vn-horizontal>

View File

@ -65,7 +65,7 @@
rule>
<tpl-item>
{{code}} - {{town.name}} ({{town.province.name}},
{{town.province.country.country}})
{{town.province.country.name}})
</tpl-item>
<append>
<vn-icon-button
@ -85,7 +85,7 @@
url="Provinces/location"
fields="['id', 'name', 'countryFk']"
rule>
<tpl-item>{{name}} ({{country.country}})</tpl-item>
<tpl-item>{{name}} ({{country.name}})</tpl-item>
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
@ -99,7 +99,7 @@
value-field="name">
<tpl-item>
{{name}}, {{province.name}}
({{province.country.country}})
({{province.country.name}})
</tpl-item>
</vn-datalist>
<vn-textfield

View File

@ -37,7 +37,7 @@
{{code}} {{town.name}}
</div>
<div class="text-caption text-secondary">
{{town.province.name}}, {{town.province.country.country}}
{{town.province.name}}, {{town.province.country.name}}
</div>
</tpl-item>
</vn-autocomplete>

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 = ?

View File

@ -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

View File

@ -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

View File

@ -2,7 +2,7 @@ SELECT
m.code mandateCode,
s.name,
s.street,
sc.country,
sc.name country,
s.postCode,
s.city,
sp.name province,

View File

@ -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