Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5472-user_passExpired
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2023-05-03 11:37:07 +02:00
commit bf3aac70f3
30 changed files with 81 additions and 103 deletions

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`entry` DROP COLUMN `notes`;

View File

@ -0,0 +1,5 @@
UPDATE vn.supplier s
JOIN vn.country c ON c.id = s.countryFk
SET s.nif = MID(REPLACE(s.nif, ' ', ''), 3, LENGTH(REPLACE(s.nif, ' ', '')) - 1)
WHERE s.isVies = TRUE
AND c.code = LEFT(REPLACE(s.nif, ' ', ''), 2);

View File

@ -0,0 +1,5 @@
UPDATE IGNORE vn.client c
JOIN vn.country co ON co.id = c.countryFk
SET c.fi = MID(REPLACE(c.fi, ' ', ''), 3, LENGTH(REPLACE(c.fi, ' ', '')) - 1)
WHERE c.isVies = TRUE
AND co.code = LEFT(REPLACE(c.fi, ' ', ''), 2);

View File

@ -1409,16 +1409,16 @@ INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseO
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1), (7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1),
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2); (8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2);
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `notes`, `evaNotes`) INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
VALUES VALUES
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, '', ''), (1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, ''),
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'this is the note two', 'observation two'), (2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'observation two'),
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'this is the note three', 'observation three'), (3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'observation three'),
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'this is the note four', 'observation four'), (4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'observation four'),
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'this is the note five', 'observation five'), (5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'),
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'this is the note six', 'observation six'), (6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'),
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'), (7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'),
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, '', ''); (8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, '');
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`) INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`)
VALUES VALUES

View File

@ -20,7 +20,6 @@ describe('Entry basic data path', () => {
it('should edit the basic data', async() => { it('should edit the basic data', async() => {
await page.write(selectors.entryBasicData.reference, 'new movement 8'); await page.write(selectors.entryBasicData.reference, 'new movement 8');
await page.write(selectors.entryBasicData.invoiceNumber, 'new movement 8'); await page.write(selectors.entryBasicData.invoiceNumber, 'new movement 8');
await page.write(selectors.entryBasicData.notes, 'new notes');
await page.write(selectors.entryBasicData.observations, ' edited'); await page.write(selectors.entryBasicData.observations, ' edited');
await page.autocompleteSearch(selectors.entryBasicData.supplier, 'Plants nick'); await page.autocompleteSearch(selectors.entryBasicData.supplier, 'Plants nick');
await page.autocompleteSearch(selectors.entryBasicData.currency, 'eur'); await page.autocompleteSearch(selectors.entryBasicData.currency, 'eur');
@ -53,12 +52,6 @@ describe('Entry basic data path', () => {
expect(result).toEqual('new movement 8'); expect(result).toEqual('new movement 8');
}); });
it('should confirm the note was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.notes, 'value');
expect(result).toEqual('new notes');
});
it('should confirm the observation was edited', async() => { it('should confirm the observation was edited', async() => {
const result = await page.waitToGetProperty(selectors.entryBasicData.observations, 'value'); const result = await page.waitToGetProperty(selectors.entryBasicData.observations, 'value');

View File

@ -15,7 +15,7 @@ const $inputs = {
sageTaxType: 'vn-supplier-fiscal-data [ng-model="$ctrl.supplier.sageTaxTypeFk"]' sageTaxType: 'vn-supplier-fiscal-data [ng-model="$ctrl.supplier.sageTaxTypeFk"]'
}; };
fdescribe('Supplier fiscal data path', () => { describe('Supplier fiscal data path', () => {
let browser; let browser;
let page; let page;

View File

@ -19,19 +19,17 @@
<div class="user-wrapper"> <div class="user-wrapper">
<div <div
class="user vn-mt-xs" class="user vn-mt-xs"
ng-class="::{system: !log.user}"
ng-style="::$ctrl.userBgColor(log.user)"
title="{{::log.user.nickname || 'System'}}"> title="{{::log.user.nickname || 'System'}}">
<img <div class="user-letter">
ng-if="::log.user.worker"
src="/api/Images/user/160x160/{{::log.user.worker.id}}/download?access_token={{::$ctrl.vnToken.token}}"
ng-click="$ctrl.showWorkerDescriptor($event, log.user.worker.id)">
</img>
<div
ng-if="::!log.user.worker"
ng-class="::{system: !log.user}"
ng-style="::$ctrl.userBgColor(log.user)"
class="user-icon">
{{::log.user ? log.user.name.charAt(0).toUpperCase() : 'S'}} {{::log.user ? log.user.name.charAt(0).toUpperCase() : 'S'}}
</div> </div>
<img
ng-if="::log.user.image"
ng-src="/api/Images/user/160x160/{{::log.userFk}}/download?access_token={{::$ctrl.vnToken.token}}"
ng-click="$ctrl.showWorkerDescriptor($event, log)">
</img>
</div> </div>
<div class="arrow bg-panel"></div> <div class="arrow bg-panel"></div>
<div class="line"></div> <div class="line"></div>
@ -116,12 +114,6 @@
<form vn-vertical <form vn-vertical
ng-model-options="{updateOn: 'change blur'}" ng-model-options="{updateOn: 'change blur'}"
class="vn-pa-md filter"> class="vn-pa-md filter">
<h6
class="text-secondary vn-mb-md"
style="font-weight: normal;"
translate>
Filter
</h6>
<vn-textfield <vn-textfield
label="Name" label="Name"
ng-model="filter.changedModelValue"> ng-model="filter.changedModelValue">

View File

@ -23,7 +23,7 @@ export default class Controller extends Section {
include: [{ include: [{
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'], fields: ['nickname', 'name', 'image'],
include: { include: {
relation: 'worker', relation: 'worker',
scope: { scope: {
@ -120,11 +120,6 @@ export default class Controller extends Section {
return this.dateFilter(date, `${format} HH:mm`); return this.dateFilter(date, `${format} HH:mm`);
} }
showWorkerDescriptor(event, workerId) {
if (!workerId) return;
this.$.workerDescriptor.show(event.target, workerId);
}
resetFilter() { resetFilter() {
this.$.filter = {who: 'all'}; this.$.filter = {who: 'all'};
} }
@ -201,6 +196,11 @@ export default class Controller extends Section {
backgroundColor: '#'+ colors[hash % colors.length] backgroundColor: '#'+ colors[hash % colors.length]
}; };
} }
showWorkerDescriptor(event, log) {
if (log.user?.worker)
this.$.workerDescriptor.show(event.target, log.userFk);
}
} }
ngModule.vnComponent('vnLog', { ngModule.vnComponent('vnLog', {
@ -229,7 +229,7 @@ const colors = [
'DC143C', // Red crimson 'DC143C', // Red crimson
'5681cf', // Blue steel '5681cf', // Blue steel
'FF1493', // Ping intense 'FF1493', // Ping intense
'00d700', // Green lime '02ba02', // Green lime
'1E90FF', // Blue sky '1E90FF', // Blue sky
'8B008B', // Purple dark '8B008B', // Purple dark
'cc7000', // Orange bright 'cc7000', // Orange bright

View File

@ -9,6 +9,7 @@ vn-log {
padding-right: 10px; padding-right: 10px;
& > .user { & > .user {
position: relative;
border-radius: 50%; border-radius: 50%;
height: 36px; height: 36px;
width: 36px; width: 36px;
@ -21,19 +22,20 @@ vn-log {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
img { &.system {
display: block; background-color: $color-main;
cursor: pointer;
} }
.user-icon { .user-letter {
font-size: 22px; font-size: 22px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
}
&.system { img {
background-color: $color-main; cursor: pointer;
} position: absolute;
top: 0;
left: 0;
} }
} }
& > .arrow { & > .arrow {

View File

@ -289,5 +289,6 @@
"isTaxDataChecked": "Datos comprobados", "isTaxDataChecked": "Datos comprobados",
"comercialId": "Id comercial", "comercialId": "Id comercial",
"comercialName": "Comercial", "comercialName": "Comercial",
"Pass expired": "La contraseña ha caducado, cambiela desde Salix" "Pass expired": "La contraseña ha caducado, cambiela desde Salix",
"Invalid NIF for VIES": "NIF invalido para VIES"
} }

View File

@ -89,8 +89,9 @@ module.exports = Self => {
}; };
const country = await Self.app.models.Country.findOne(filter); const country = await Self.app.models.Country.findOne(filter);
const code = country ? country.code.toLowerCase() : null; const code = country ? country.code.toLowerCase() : null;
const countryCode = this.fi.toLowerCase().substring(0, 2);
if (!this.fi || !validateTin(this.fi, code)) if (!this.fi || !validateTin(this.fi, code) || (this.isVies && countryCode == code))
err(); err();
done(); done();
} }

View File

@ -72,7 +72,9 @@
<vn-horizontal> <vn-horizontal>
<vn-check vn-one label="Has to invoice" ng-model="$ctrl.client.hasToInvoice"> <vn-check vn-one label="Has to invoice" ng-model="$ctrl.client.hasToInvoice">
</vn-check> </vn-check>
<vn-check vn-one label="Vies" ng-model="$ctrl.client.isVies"> <vn-check vn-one label="Vies"
info="When activating it, do not enter the country code in the ID field."
ng-model="$ctrl.client.isVies">
</vn-check> </vn-check>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>

View File

@ -12,3 +12,5 @@ Previous client: Cliente anterior
In case of a company succession, specify the grantor company: En el caso de que haya habido una sucesión de empresa, indicar la empresa cedente In case of a company succession, specify the grantor company: En el caso de que haya habido una sucesión de empresa, indicar la empresa cedente
Incoterms authorization: Autorización incoterms Incoterms authorization: Autorización incoterms
Electronic invoice: Factura electrónica Electronic invoice: Factura electrónica
When activating it, do not enter the country code in the IF.: Al activarlo, no informar el código del país en el campo IF
The first two values are letters: Los dos primeros valores son letras

View File

@ -158,7 +158,6 @@ module.exports = Self => {
e.invoiceNumber, e.invoiceNumber,
e.isBooked, e.isBooked,
e.isExcludedFromAvailable, e.isExcludedFromAvailable,
e.notes,
e.evaNotes AS observation, e.evaNotes AS observation,
e.isConfirmed, e.isConfirmed,
e.isOrdered, e.isOrdered,

View File

@ -27,9 +27,6 @@
"isExcludedFromAvailable": { "isExcludedFromAvailable": {
"type": "boolean" "type": "boolean"
}, },
"notes": {
"type": "string"
},
"isConfirmed": { "isConfirmed": {
"type": "boolean" "type": "boolean"
}, },

View File

@ -52,13 +52,6 @@
rule rule
vn-focus> vn-focus>
</vn-textfield> </vn-textfield>
<vn-textfield
vn-one
label="Notes"
ng-model="$ctrl.entry.notes"
rule
vn-focus>
</vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield

View File

@ -12,7 +12,6 @@ Reference: Referencia
Created: Creado Created: Creado
Booked: Contabilizada Booked: Contabilizada
Is inventory: Inventario Is inventory: Inventario
Notes: Notas
Status: Estado Status: Estado
Selection: Selección Selection: Selección
Invoice number: Núm. factura Invoice number: Núm. factura

View File

@ -32,9 +32,6 @@
<vn-label-value label="Invoice number" <vn-label-value label="Invoice number"
value="{{$ctrl.entryData.invoiceNumber}}"> value="{{$ctrl.entryData.invoiceNumber}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Notes"
value="{{$ctrl.entryData.notes}}">
</vn-label-value>
</vn-one> </vn-one>
<vn-one> <vn-one>
<vn-label-value label="Reference"> <vn-label-value label="Reference">

View File

@ -19,13 +19,14 @@ describe('Supplier newSupplier()', () => {
}); });
}); });
it('should create a new supplier containing only the name', async() => { it('should create a new supplier containing only the name and the nif', async() => {
const tx = await models.Supplier.beginTransaction({}); const tx = await models.Supplier.beginTransaction({});
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
ctx.args = { ctx.args = {
name: 'newSupplier' name: 'newSupplier',
nif: '12345678Z'
}; };
const result = await models.Supplier.newSupplier(ctx, options); const result = await models.Supplier.newSupplier(ctx, options);

View File

@ -67,8 +67,9 @@ module.exports = Self => {
}; };
const country = await Self.app.models.Country.findOne(filter); const country = await Self.app.models.Country.findOne(filter);
const code = country ? country.code.toLowerCase() : null; const code = country ? country.code.toLowerCase() : null;
const countryCode = this.nif.toLowerCase().substring(0, 2);
if (!this.nif || !validateTin(this.nif, code)) if (!this.nif || !validateTin(this.nif, code) || (this.isVies && countryCode == code))
err(); err();
done(); done();
} }

View File

@ -54,7 +54,8 @@
name="taxNumber" name="taxNumber"
ng-model="$ctrl.supplier.nif" ng-model="$ctrl.supplier.nif"
required="true" required="true"
rule> rule
>
</vn-textfield> </vn-textfield>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
@ -210,7 +211,9 @@
<vn-check <vn-check
class="vn-ml-lg" class="vn-ml-lg"
label="Vies" label="Vies"
ng-model="$ctrl.supplier.isVies"> info="When activating it, do not enter the country code in the ID field."
ng-model="$ctrl.supplier.isVies"
>
</vn-check> </vn-check>
</vn-two> </vn-two>
</vn-horizontal> </vn-horizontal>

View File

@ -4,3 +4,5 @@ Sage withholding: Retención Sage
Supplier activity: Actividad proveedor Supplier activity: Actividad proveedor
Healt register: Pasaporte sanitario Healt register: Pasaporte sanitario
Trucker: Transportista Trucker: Transportista
When activating it, do not enter the country code in the ID field.: Al activarlo, no informar el código del país en el campo nif
The first two values are letters.: Los dos primeros valores son letras

View File

@ -1 +1,2 @@
Accounts: Cuentas Accounts: Cuentas
Invalid NIF for VIES: NIF no valido por VIES

View File

@ -167,7 +167,6 @@ module.exports = Self => {
s.name AS supplierName, s.name AS supplierName,
SUM(b.stickers) AS stickers, SUM(b.stickers) AS stickers,
e.evaNotes, e.evaNotes,
e.notes,
e.invoiceAmount, e.invoiceAmount,
CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg, CAST(SUM(b.weight * b.stickers) AS DECIMAL(10,0)) as loadedkg,
CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) AS DECIMAL(10,0)) as volumeKg CAST(SUM(vc.aerealVolumetricDensity * b.stickers * IF(pkg.volume, pkg.volume, pkg.width * pkg.depth * pkg.height) / 1000000) AS DECIMAL(10,0)) as volumeKg

View File

@ -31,7 +31,6 @@ module.exports = Self => {
e.isConfirmed, e.isConfirmed,
e.invoiceNumber, e.invoiceNumber,
e.reference, e.reference,
e.notes,
e.evaNotes AS observation, e.evaNotes AS observation,
s.name AS supplierName, s.name AS supplierName,
CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap)) CAST((SUM(IF(p.volume > 0,p.volume,p.width * p.depth * IF(p.height, p.height, i.size + pconfig.upperGap))

View File

@ -100,12 +100,6 @@
<vn-td shrink>{{entry.pallet}}</vn-td> <vn-td shrink>{{entry.pallet}}</vn-td>
<vn-td shrink>{{entry.m3}}</vn-td> <vn-td shrink>{{entry.m3}}</vn-td>
<vn-td shrink> <vn-td shrink>
<vn-icon
ng-if="entry.notes.length"
vn-tooltip="{{entry.notes}}"
icon="insert_drive_file"
class="bright">
</vn-icon>
<vn-icon <vn-icon
ng-if="entry.observation.length" ng-if="entry.observation.length"
vn-tooltip="{{entry.observation}}" vn-tooltip="{{entry.observation}}"

View File

@ -196,7 +196,7 @@ module.exports = Self => {
client = await models.Client.findById( client = await models.Client.findById(
user.id, user.id,
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk']}, {fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk', 'fi']},
myOptions myOptions
); );

View File

@ -77,16 +77,6 @@
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
<div class="columns">
<div class="size50">
<div id="notes" class="panel no-page-break" v-if="entry.notes">
<div class="body">
<h3>{{$t('notes')}}</h3>
<div>{{entry.notes}}</div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
<template v-slot:footer> <template v-slot:footer>

View File

@ -1,7 +1,6 @@
SELECT SELECT
e.id, e.id,
e.invoiceNumber, e.invoiceNumber,
e.notes,
c.code companyCode, c.code companyCode,
t.landed t.landed
FROM entry e FROM entry e