feat: refs #7758 Add code mandateType and accountDetailType #2876

Merged
ivanm merged 5 commits from 7758-Add_code_mandateType_accountDetailType into dev 2024-08-23 10:16:27 +00:00
9 changed files with 28 additions and 13 deletions

View File

@ -412,7 +412,7 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`)
(1103, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
(1104, -30, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH));
INSERT INTO `vn`.`mandateType`(`id`, `name`)
INSERT INTO `vn`.`mandateType`(`id`, `code`)
VALUES
(1, 'B2B'),
(2, 'CORE'),
@ -3945,11 +3945,11 @@ VALUES
(35, 'ES12346B12345679', 3, 241);
INSERT INTO vn.accountDetailType
(id, description)
(id, description, code)
VALUES
(1, 'IBAN'),
(2, 'SWIFT'),
(3, 'Referencia Remesas'),
(4, 'Referencia Transferencias'),
(5, 'Referencia Nominas'),
(6, 'ABA');
(1, 'IBAN', 'iban'),
(2, 'SWIFT', 'swift'),
(3, 'Referencia Remesas', 'remRef'),
ivanm marked this conversation as resolved Outdated

codigos en ingles, pregunta a chatgpt,
el code
Se llamará code si es un identificador alfanumérico en lowerCamelCase[1], se añadirá como PRIMARY o UNIQUE, y siempre NOT NULL.

codigos en ingles, pregunta a chatgpt, el code `Se llamará code si es un identificador alfanumérico en lowerCamelCase[1], se añadirá como PRIMARY o UNIQUE, y siempre NOT NULL.`
Outdated
Review

M'ha proposat 'remRef' com a Remittance Reference, 'trnRef' com a Transfer Reference i 'payRef' com a Payroll Reference.

Les fique en lowerCamelCase i com a UNIQUE ja que tenen 'id' que es el PRIMARY

M'ha proposat 'remRef' com a Remittance Reference, 'trnRef' com a Transfer Reference i 'payRef' com a Payroll Reference. Les fique en lowerCamelCase i com a UNIQUE ja que tenen 'id' que es el PRIMARY
(4, 'Referencia Transferencias', 'trnRef'),
(5, 'Referencia Nominas', 'payRef'),
(6, 'ABA', 'aba');

View File

@ -2,5 +2,5 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`mandato_tipo`
AS SELECT `m`.`id` AS `idmandato_tipo`,
`m`.`name` AS `Nombre`
`m`.`code` AS `Nombre`
FROM `vn`.`mandateType` `m`

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.mandateType
CHANGE name code VARCHAR(45) NOT NULL,
ADD UNIQUE (code);

View File

@ -0,0 +1,3 @@
ALTER TABLE vn.accountDetailType
ADD COLUMN code VARCHAR(45) NOT NULL,
ADD UNIQUE (code);

View File

@ -0,0 +1,9 @@
UPDATE vn.accountDetailType
SET code = CASE description
ivanm marked this conversation as resolved Outdated

gasta el camp description, no es pot cambiar gastant id

gasta el camp description, no es pot cambiar gastant id
WHEN 'IBAN' THEN 'iban'
WHEN 'SWIFT' THEN 'swift'
WHEN 'Referencia Remesas' THEN 'remRef'
WHEN 'Referencia Transferencias' THEN 'trnRef'
WHEN 'Referencia Nominas' THEN 'payRef'
WHEN 'ABA' THEN 'aba'
END;

View File

@ -27,7 +27,7 @@ module.exports = Self => {
// Renew mandate
if (mandate) {
const mandateType = await models.MandateType.findOne({
where: {name: mandate.type}
where: {code: mandate.type}
});
const oldMandate = await models.Mandate.findOne({

View File

@ -12,7 +12,7 @@
"type": "number",
"description": "Identifier"
},
"name": {
"code": {
"type": "string"
}
}

View File

@ -26,7 +26,7 @@
<vn-tr ng-repeat="mandate in mandates">
<vn-td number>{{::mandate.id}}</vn-td>
<vn-td>{{::mandate.company.code}}</vn-td>
<vn-td>{{::mandate.mandateType.name}}</vn-td>
<vn-td>{{::mandate.mandateType.code}}</vn-td>
<vn-td shrink-datetime>{{::mandate.created | date:'dd/MM/yyyy HH:mm' | dashIfEmpty}}</vn-td>
<vn-td shrink-datetime>{{::mandate.finished | date:'dd/MM/yyyy HH:mm' | dashIfEmpty}}</vn-td>
</vn-tr>

View File

@ -9,7 +9,7 @@ class Controller extends Section {
{
relation: 'mandateType',
scope: {
fields: ['id', 'name']
fields: ['id', 'code']
}
}, {
relation: 'company',