diff --git a/Dockerfile b/Dockerfile
index b42249099..9caaa30a1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,7 +7,7 @@ RUN apt-get update \
curl \
ca-certificates \
gnupg2 \
- libfontconfig \
+ libfontconfig lftp \
&& apt-get -y install xvfb gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \
libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 \
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
diff --git a/back/methods/chat/spec/notifyIssue.spec.js b/back/methods/chat/spec/notifyIssue.spec.js
index 96117c2c0..e20d43142 100644
--- a/back/methods/chat/spec/notifyIssue.spec.js
+++ b/back/methods/chat/spec/notifyIssue.spec.js
@@ -13,10 +13,9 @@ describe('Chat notifyIssue()', () => {
spyOn(chatModel, 'send').and.callThrough();
spyOn(osTicketModel, 'rawSql').and.returnValue([]);
- const response = await chatModel.notifyIssues(ctx);
+ await chatModel.notifyIssues(ctx);
expect(chatModel.send).not.toHaveBeenCalled();
- expect(response).toBeUndefined();
});
it(`should return a response calling the send() method`, async() => {
@@ -27,16 +26,15 @@ describe('Chat notifyIssue()', () => {
username: 'batman',
subject: 'Issue title'}
]);
+ // eslint-disable-next-line max-len
const expectedMessage = `@all ➔ There's a new urgent ticket:\r\n[ID: *00001* - Issue title (@batman)](https://cau.verdnatura.es/scp/tickets.php?id=1)`;
const department = await app.models.Department.findById(departmentId);
let orgChatName = department.chatName;
await department.updateAttribute('chatName', 'IT');
- const response = await chatModel.notifyIssues(ctx);
+ await chatModel.notifyIssues(ctx);
- expect(response.statusCode).toEqual(200);
- expect(response.message).toEqual('Fake notification sent');
expect(chatModel.send).toHaveBeenCalledWith(ctx, '#IT', expectedMessage);
// restores
diff --git a/back/methods/chat/spec/send.spec.js b/back/methods/chat/spec/send.spec.js
index 2c23bb591..634e1d420 100644
--- a/back/methods/chat/spec/send.spec.js
+++ b/back/methods/chat/spec/send.spec.js
@@ -5,14 +5,13 @@ describe('Chat send()', () => {
let ctx = {req: {accessToken: {userId: 1}}};
let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something');
- expect(response.statusCode).toEqual(200);
- expect(response.message).toEqual('Fake notification sent');
+ expect(response).toEqual(true);
});
it('should retrun false as response', async() => {
let ctx = {req: {accessToken: {userId: 18}}};
let response = await app.models.Chat.send(ctx, '@salesPerson', 'I changed something');
- expect(response).toBeFalsy();
+ expect(response).toEqual(false);
});
});
diff --git a/back/methods/chat/spec/sendCheckingPresence.spec.js b/back/methods/chat/spec/sendCheckingPresence.spec.js
index 2c48ef02c..712e7f947 100644
--- a/back/methods/chat/spec/sendCheckingPresence.spec.js
+++ b/back/methods/chat/spec/sendCheckingPresence.spec.js
@@ -20,10 +20,8 @@ describe('Chat sendCheckingPresence()', () => {
})
);
- const response = await chatModel.sendCheckingPresence(ctx, workerId, 'I changed something');
+ await chatModel.sendCheckingPresence(ctx, workerId, 'I changed something');
- expect(response.statusCode).toEqual(200);
- expect(response.message).toEqual('Fake notification sent');
expect(chatModel.send).toHaveBeenCalledWith(ctx, '@HankPym', 'I changed something');
});
@@ -47,10 +45,8 @@ describe('Chat sendCheckingPresence()', () => {
const department = await models.Department.findById(departmentId, null, options);
await department.updateAttribute('chatName', 'cooler');
- const response = await chatModel.sendCheckingPresence(ctx, workerId, 'I changed something');
+ await chatModel.sendCheckingPresence(ctx, workerId, 'I changed something');
- expect(response.statusCode).toEqual(200);
- expect(response.message).toEqual('Fake notification sent');
expect(chatModel.send).toHaveBeenCalledWith(ctx, '#cooler', '@HankPym ➔ I changed something');
await tx.rollback();
diff --git a/back/methods/edi/sql/bucket.sql b/back/methods/edi/sql/bucket.sql
new file mode 100644
index 000000000..92121386c
--- /dev/null
+++ b/back/methods/edi/sql/bucket.sql
@@ -0,0 +1,14 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE bucket
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9, @col10, @col11, @col12)
+ SET
+ bucket_id = @col2,
+ bucket_type_id = @col4,
+ description = @col5,
+ x_size = @col6,
+ y_size = @col7,
+ z_size = @col8,
+ entry_date = STR_TO_DATE(@col10, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col11, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col12, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/bucket_type.sql b/back/methods/edi/sql/bucket_type.sql
new file mode 100644
index 000000000..68498f183
--- /dev/null
+++ b/back/methods/edi/sql/bucket_type.sql
@@ -0,0 +1,10 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE bucket_type
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6)
+ SET
+ bucket_type_id = @col2,
+ description = @col3,
+ entry_date = STR_TO_DATE(@col4, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col5, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col6, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/feature.sql b/back/methods/edi/sql/feature.sql
new file mode 100644
index 000000000..081cfde7b
--- /dev/null
+++ b/back/methods/edi/sql/feature.sql
@@ -0,0 +1,11 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE `feature`
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7)
+ SET
+ item_id = @col2,
+ feature_type_id = @col3,
+ feature_value = @col4,
+ entry_date = STR_TO_DATE(@col5, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col6, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col7, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/genus.sql b/back/methods/edi/sql/genus.sql
new file mode 100644
index 000000000..dd882629c
--- /dev/null
+++ b/back/methods/edi/sql/genus.sql
@@ -0,0 +1,10 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE genus
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6)
+ SET
+ genus_id = @col2,
+ latin_genus_name = @col3,
+ entry_date = STR_TO_DATE(@col4, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col5, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col6, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/item.sql b/back/methods/edi/sql/item.sql
new file mode 100644
index 000000000..543c83381
--- /dev/null
+++ b/back/methods/edi/sql/item.sql
@@ -0,0 +1,13 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE item
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9, @col10, @col11, @col12)
+ SET
+ id = @col2,
+ product_name = @col4,
+ name = @col5,
+ plant_id = @col7,
+ group_id = @col9,
+ entry_date = STR_TO_DATE(@col10, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col11, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col12, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/item_feature.sql b/back/methods/edi/sql/item_feature.sql
new file mode 100644
index 000000000..23b0f3afa
--- /dev/null
+++ b/back/methods/edi/sql/item_feature.sql
@@ -0,0 +1,12 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE `item_feature`
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8)
+ SET
+ item_id = @col2,
+ feature = @col3,
+ regulation_type = @col4,
+ presentation_order = @col5,
+ entry_date = STR_TO_DATE(@col6, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col7, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col8, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/item_group.sql b/back/methods/edi/sql/item_group.sql
new file mode 100644
index 000000000..31da6c57f
--- /dev/null
+++ b/back/methods/edi/sql/item_group.sql
@@ -0,0 +1,10 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE item_group
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6)
+ SET
+ group_code = @col2,
+ dutch_group_description = @col3,
+ entry_date = STR_TO_DATE(@col4, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col5, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col6, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/plant.sql b/back/methods/edi/sql/plant.sql
new file mode 100644
index 000000000..50720fba5
--- /dev/null
+++ b/back/methods/edi/sql/plant.sql
@@ -0,0 +1,11 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE plant
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9)
+ SET
+ plant_id = @col3,
+ genus_id = @col4,
+ specie_id = @col5,
+ entry_date = STR_TO_DATE(@col7, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col8, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col9, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/specie.sql b/back/methods/edi/sql/specie.sql
new file mode 100644
index 000000000..e27478ae8
--- /dev/null
+++ b/back/methods/edi/sql/specie.sql
@@ -0,0 +1,11 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE specie
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7)
+ SET
+ specie_id = @col2,
+ genus_id = @col3,
+ latin_species_name = @col4,
+ entry_date = STR_TO_DATE(@col5, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col6, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col7, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/supplier.sql b/back/methods/edi/sql/supplier.sql
new file mode 100644
index 000000000..a1d3376d6
--- /dev/null
+++ b/back/methods/edi/sql/supplier.sql
@@ -0,0 +1,11 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE edi.supplier
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7, @col8, @col9, @col10, @col11, @col12, @col13, @col14, @col15, @col16, @col17, @col18, @col19, @col20)
+ SET
+ GLNAddressCode = @col2,
+ supplier_id = @col4,
+ company_name = @col3,
+ entry_date = STR_TO_DATE(@col9, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col10, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col11, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/type.sql b/back/methods/edi/sql/type.sql
new file mode 100644
index 000000000..88c4ac026
--- /dev/null
+++ b/back/methods/edi/sql/type.sql
@@ -0,0 +1,11 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE `type`
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7)
+ SET
+ type_id = @col2,
+ type_group_id = @col3,
+ description = @col4,
+ entry_date = STR_TO_DATE(@col5, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col6, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col7, '%Y%m%d%H%i')
diff --git a/back/methods/edi/sql/value.sql b/back/methods/edi/sql/value.sql
new file mode 100644
index 000000000..c8c4deef5
--- /dev/null
+++ b/back/methods/edi/sql/value.sql
@@ -0,0 +1,11 @@
+LOAD DATA LOCAL INFILE ?
+ INTO TABLE `value`
+ FIELDS TERMINATED BY ';'
+ LINES TERMINATED BY '\n' (@col1, @col2, @col3, @col4, @col5, @col6, @col7)
+ SET
+ type_id = @col2,
+ type_value = @col3,
+ type_description = @col4,
+ entry_date = STR_TO_DATE(@col5, '%Y%m%d'),
+ expiry_date = IFNULL(NULL,STR_TO_DATE(@col6, '%Y%m%d')),
+ change_date_time = STR_TO_DATE(@col7, '%Y%m%d%H%i')
diff --git a/back/methods/edi/updateData.js b/back/methods/edi/updateData.js
new file mode 100644
index 000000000..df77906da
--- /dev/null
+++ b/back/methods/edi/updateData.js
@@ -0,0 +1,155 @@
+/* eslint no-console: "off" */
+const path = require('path');
+const fs = require('fs-extra');
+
+module.exports = Self => {
+ Self.remoteMethodCtx('updateData', {
+ description: 'Updates schema data from external provider',
+ accessType: 'WRITE',
+ returns: {
+ type: 'object',
+ root: true
+ },
+ http: {
+ path: `/updateData`,
+ verb: 'GET'
+ }
+ });
+
+ Self.updateData = async() => {
+ const models = Self.app.models;
+
+ const container = await models.TempContainer.container('edi');
+ const tempPath = path.join(container.client.root, container.name);
+
+ const [ftpConfig] = await Self.rawSql('SELECT host, user, password FROM edi.ftpConfig');
+ console.debug(`Openning FTP connection to ${ftpConfig.host}...\n`);
+
+ const FtpClient = require('ftps');
+ const ftpClient = new FtpClient({
+ host: ftpConfig.host,
+ username: ftpConfig.user,
+ password: ftpConfig.password,
+ procotol: 'ftp'
+ });
+
+ const files = await Self.rawSql('SELECT fileName, toTable, file, updated FROM edi.fileConfig');
+
+ let remoteFile;
+ let tempDir;
+ let tempFile;
+ for (const file of files) {
+ try {
+ const fileName = file.file;
+
+ console.debug(`Downloading file ${fileName}...`);
+
+ remoteFile = `codes/${fileName}.ZIP`;
+ tempDir = `${tempPath}/${fileName}`;
+ tempFile = `${tempPath}/${fileName}.zip`;
+
+ await extractFile({
+ ftpClient: ftpClient,
+ file: file,
+ paths: {
+ remoteFile: remoteFile,
+ tempDir: tempDir,
+ tempFile: tempFile
+ }
+ });
+ } catch (error) {
+ if (fs.existsSync(tempFile))
+ await fs.unlink(tempFile);
+
+ await fs.rmdir(tempDir, {recursive: true});
+ console.error(error);
+ }
+ }
+
+ return true;
+ };
+
+ async function extractFile({ftpClient, file, paths}) {
+ // Download the zip file
+ ftpClient.get(paths.remoteFile, paths.tempFile);
+
+ // Execute download command
+ ftpClient.exec(async(err, response) => {
+ if (response.error) {
+ console.debug(`Error downloading file... ${response.error}`);
+ return;
+ }
+
+ const AdmZip = require('adm-zip');
+ const zip = new AdmZip(paths.tempFile);
+ const entries = zip.getEntries();
+
+ zip.extractAllTo(paths.tempDir, false);
+
+ if (fs.existsSync(paths.tempFile))
+ await fs.unlink(paths.tempFile);
+
+ await dumpData({file, entries, paths});
+
+ await fs.rmdir(paths.tempDir, {recursive: true});
+ });
+ }
+
+ async function dumpData({file, entries, paths}) {
+ const toTable = file.toTable;
+ const baseName = file.fileName;
+
+ for (const zipEntry of entries) {
+ const entryName = zipEntry.entryName;
+ console.log(`Reading file ${entryName}...`);
+
+ const startIndex = (entryName.length - 10);
+ const endIndex = (entryName.length - 4);
+ const dateString = entryName.substring(startIndex, endIndex);
+ const lastUpdated = new Date();
+
+ // Format string date to a date object
+ let updated = null;
+ if (file.updated) {
+ updated = new Date(file.updated);
+ updated.setHours(0, 0, 0, 0);
+ }
+
+ lastUpdated.setFullYear(`20${dateString.substring(4, 6)}`);
+ lastUpdated.setMonth(parseInt(dateString.substring(2, 4)) - 1);
+ lastUpdated.setDate(dateString.substring(0, 2));
+ lastUpdated.setHours(0, 0, 0, 0);
+
+ if (updated && lastUpdated <= updated) {
+ console.debug(`Table ${toTable} already updated, skipping...`);
+ continue;
+ }
+
+ console.log('Dumping data...');
+ const templatePath = path.join(__dirname, `./sql/${toTable}.sql`);
+ const sqlTemplate = fs.readFileSync(templatePath, 'utf8');
+
+ const rawPath = path.join(paths.tempDir, entryName);
+
+ try {
+ const tx = await Self.beginTransaction({});
+ const options = {transaction: tx};
+
+ await Self.rawSql(`DELETE FROM edi.${toTable}`, null, options);
+ await Self.rawSql(sqlTemplate, [rawPath], options);
+ await Self.rawSql(`
+ UPDATE edi.fileConfig
+ SET updated = ?
+ WHERE fileName = ?
+ `, [lastUpdated, baseName], options);
+
+ tx.commit();
+ } catch (error) {
+ tx.rollback();
+ throw error;
+ }
+
+ console.log(`Updated table ${toTable}\n`);
+ }
+ }
+};
diff --git a/back/model-config.json b/back/model-config.json
index 4c79d565b..4ce11b99d 100644
--- a/back/model-config.json
+++ b/back/model-config.json
@@ -109,6 +109,9 @@
},
"OsTicket": {
"dataSource": "osticket"
+ },
+ "Edi": {
+ "dataSource": "vn"
}
}
diff --git a/back/models/edi.js b/back/models/edi.js
new file mode 100644
index 000000000..bfddf2746
--- /dev/null
+++ b/back/models/edi.js
@@ -0,0 +1,3 @@
+module.exports = Self => {
+ require('../methods/edi/updateData')(Self);
+};
diff --git a/back/models/edi.json b/back/models/edi.json
new file mode 100644
index 000000000..d436e53ff
--- /dev/null
+++ b/back/models/edi.json
@@ -0,0 +1,5 @@
+{
+ "name": "Edi",
+ "base": "VnModel"
+}
+
\ No newline at end of file
diff --git a/db/changes/10440-fallas/00-ACL.sql b/db/changes/10440-fallas/00-ACL.sql
new file mode 100644
index 000000000..051a851f7
--- /dev/null
+++ b/db/changes/10440-fallas/00-ACL.sql
@@ -0,0 +1,2 @@
+INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
+VALUES ('Edi', 'updateData', 'WRITE', 'ALLOW', 'ROLE', 'employee');
diff --git a/db/changes/10440-fallas/00-aclEducationLevel.sql b/db/changes/10440-fallas/00-aclEducationLevel.sql
new file mode 100644
index 000000000..26bf9d16f
--- /dev/null
+++ b/db/changes/10440-fallas/00-aclEducationLevel.sql
@@ -0,0 +1,2 @@
+INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
+ VALUES('EducationLevel', '*', '*', 'ALLOW', 'ROLE', 'employee');
diff --git a/db/changes/10440-fallas/00-aclIntrastat.sql b/db/changes/10440-fallas/00-aclIntrastat.sql
new file mode 100644
index 000000000..16410814d
--- /dev/null
+++ b/db/changes/10440-fallas/00-aclIntrastat.sql
@@ -0,0 +1,3 @@
+INSERT INTO `salix`.`ACL`
+(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
+VALUES('InvoiceInIntrastat', '*', '*', 'ALLOW', 'ROLE', 'employee');
\ No newline at end of file
diff --git a/db/changes/10440-fallas/00-claim_packages.sql b/db/changes/10440-fallas/00-claim_packages.sql
index 54e8ff326..fa62fbec9 100644
--- a/db/changes/10440-fallas/00-claim_packages.sql
+++ b/db/changes/10440-fallas/00-claim_packages.sql
@@ -1 +1 @@
-ALTER TABLE vn.claim ADD packages smallint(10) unsigned DEFAULT 0 NULL COMMENT 'packages received by the client';
\ No newline at end of file
+ALTER TABLE `vn`.`claim` ADD packages smallint(10) unsigned DEFAULT 0 NULL COMMENT 'packages received by the client';
\ No newline at end of file
diff --git a/db/changes/10440-fallas/00-component.sql b/db/changes/10440-fallas/00-component.sql
new file mode 100644
index 000000000..8d2dd6517
--- /dev/null
+++ b/db/changes/10440-fallas/00-component.sql
@@ -0,0 +1,2 @@
+INSERT INTO `vn`.`component` (`name`,`typeFk`,`classRate`,`isRenewable`,`code`,`isRequired`)
+ VALUES ('maná reclamacion',7,4,0,'manaClaim',0);
\ No newline at end of file
diff --git a/db/changes/10440-fallas/00-country.sql b/db/changes/10440-fallas/00-country.sql
new file mode 100644
index 000000000..6cc4ce1f9
--- /dev/null
+++ b/db/changes/10440-fallas/00-country.sql
@@ -0,0 +1,90 @@
+ALTER TABLE `vn`.`country` ADD `a3Code` INT NULL COMMENT 'Código país para a3';
+
+UPDATE `vn`.`country` c
+JOIN `vn2008`.`payroll_pais` `p` ON `p`.`pais` = `c`.`country`
+SET `c`.`a3Code` = `p`.`codpais`;
+
+UPDATE `vn`.`country`
+SET `a3Code` = 710
+WHERE `country` = 'Sud-Africa'; -- ÁFRICA DEL SUR
+
+UPDATE `vn`.`country`
+SET `a3Code` = 643
+WHERE `country` = 'Rusia'; -- FEDERACIÓN DE RUSIA
+
+UPDATE `vn`.`country`
+SET `a3Code` = 28
+WHERE `country` = 'Antigua'; -- ANTIGUA Y BARBUDA
+
+UPDATE `vn`.`country`
+SET `a3Code` = 840
+WHERE `country` = 'USA'; -- ESTADOS UNIDOS
+
+UPDATE `vn`.`country`
+SET `a3Code` = 404
+WHERE `country` = 'Kenya'; -- KENIA
+
+UPDATE `vn`.`country`
+SET `a3Code` = 498
+WHERE `country` = 'Moldavia'; -- REPÚBLICA DE MOLDAVIA
+
+UPDATE `vn`.`country`
+SET `a3Code` = 826
+WHERE `country` = 'Gran Bretaña'; -- REINO UNIDO
+
+UPDATE `vn`.`country`
+SET `a3Code` = 484
+WHERE `country` = 'Mexico'; -- MÉJICO
+
+UPDATE `vn`.`country`
+SET `a3Code` = 716
+WHERE `country` = 'Zimbawe'; -- ZINBABWE
+
+UPDATE `vn`.`country`
+SET `a3Code` = 203
+WHERE `country` = 'Chequia'; -- REPÚBLICA CHECA
+
+UPDATE `vn`.`country`
+SET `a3Code` = 764
+WHERE `country` = 'Thailandia'; -- TAILANDIA
+
+UPDATE `vn`.`country`
+SET `a3Code` = 276
+WHERE `country` = 'Alemania'; -- REPÚBLICA FEDERAL DE ALEMANIA
+
+UPDATE `vn`.`country`
+SET `a3Code` = 112
+WHERE `country` = 'Bielorrusia'; -- BELARUS
+
+UPDATE `vn`.`country`
+SET `a3Code` = 528
+WHERE `country` = 'Holanda'; -- PAÍSES BAJOS
+
+UPDATE `vn`.`country`
+SET `a3Code` = 410
+WHERE `country` = 'Corea del Sur'; -- COREA (REPÚBLICA)
+
+UPDATE `vn`.`country`
+SET `a3Code` = 724
+WHERE `country` = 'España exento'; -- ESPAÑA
+
+-- Borrar registro USA de country:
+UPDATE `vn`.`supplier` `s`
+ SET `s`.`countryFk` = 62
+ WHERE `s`.`countryFk` = 12;
+
+UPDATE `vn`.`bankEntity`
+ SET `countryFk` = 62
+ WHERE `countryFk` = 12;
+
+DELETE FROM `vn`.`country`
+ WHERE `id`= 12;
+
+UPDATE `vn2008`.`payroll_pais`
+SET `pais`='COREA NORTE (REPÚBLICA DEM. POPULAR)'
+WHERE `codpais`=408;
+UPDATE `vn2008`.`payroll_pais`
+SET `pais`='COREA SUR (REPÚBLICA) '
+WHERE `codpais`=410;
+
+RENAME TABLE `vn2008`.`payroll_pais` TO `vn2008`.`payroll_pais__`;
\ No newline at end of file
diff --git a/db/changes/10440-fallas/00-invoiceInIntrastat.sql b/db/changes/10440-fallas/00-invoiceInIntrastat.sql
new file mode 100644
index 000000000..8f65fac29
--- /dev/null
+++ b/db/changes/10440-fallas/00-invoiceInIntrastat.sql
@@ -0,0 +1,2 @@
+INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`)
+ VALUES ('InvoiceInIntrastat','*','*','ALLOW','ROLE','employee');
\ No newline at end of file
diff --git a/db/changes/10440-fallas/00-manaCustomerUpdate.sql b/db/changes/10440-fallas/00-manaCustomerUpdate.sql
new file mode 100644
index 000000000..80838bca2
--- /dev/null
+++ b/db/changes/10440-fallas/00-manaCustomerUpdate.sql
@@ -0,0 +1,106 @@
+DROP PROCEDURE IF EXISTS `bs`.`manaCustomerUpdate`;
+
+DELIMITER $$
+$$
+CREATE DEFINER=`root`@`localhost` PROCEDURE `bs`.`manaCustomerUpdate`()
+BEGIN
+ DECLARE vToDated DATE;
+ DECLARE vFromDated DATE;
+ DECLARE vForDeleteDated DATE;
+ DECLARE vManaId INT;
+ DECLARE vManaAutoId INT;
+ DECLARE vClaimManaId INT;
+ DECLARE vManaBankId INT;
+ DECLARE vManaGreugeTypeId INT;
+
+ SELECT id INTO vManaId
+ FROM `component` WHERE code = 'mana';
+
+ SELECT id INTO vManaAutoId
+ FROM `component` WHERE code = 'autoMana';
+
+ SELECT id INTO vClaimManaId
+ FROM `component` WHERE code = 'manaClaim';
+
+ SELECT id INTO vManaBankId
+ FROM `bank` WHERE code = 'mana';
+
+ SELECT id INTO vManaGreugeTypeId
+ FROM `greugeType` WHERE code = 'mana';
+
+ SELECT IFNULL(max(dated), '2016-01-01')
+ INTO vFromDated
+ FROM bs.manaCustomer;
+
+ DELETE
+ FROM bs.manaCustomer
+ WHERE dated = vFromDated;
+
+ SELECT IFNULL(max(dated), '2016-01-01')
+ INTO vFromDated
+ FROM bs.manaCustomer;
+
+ WHILE timestampadd(DAY,30,vFromDated) < CURDATE() DO
+
+ SELECT
+ timestampadd(DAY,30,vFromDated),
+ timestampadd(DAY,-90,vFromDated)
+ INTO
+ vToDated,
+ vForDeleteDated;
+
+ DELETE FROM bs.manaCustomer
+ WHERE dated <= vForDeleteDated;
+
+
+ INSERT INTO bs.manaCustomer(Id_Cliente, Mana, dated)
+
+ SELECT
+ Id_Cliente,
+ cast(sum(mana) as decimal(10,2)) as mana,
+ vToDated as dated
+ FROM
+
+ (
+ SELECT cs.Id_Cliente, Cantidad * Valor as mana
+ FROM vn2008.Tickets t
+ JOIN vn2008.Consignatarios cs using(Id_Consigna)
+ JOIN vn2008.Movimientos m on m.Id_Ticket = t.Id_Ticket
+ JOIN vn2008.Movimientos_componentes mc on mc.Id_Movimiento = m.Id_Movimiento
+ WHERE Id_Componente IN (vManaAutoId, vManaId, vClaimManaId)
+ AND t.Fecha > vFromDated
+ AND date(t.Fecha) <= vToDated
+
+
+ UNION ALL
+
+ SELECT r.Id_Cliente, - Entregado
+ FROM vn2008.Recibos r
+ WHERE Id_Banco = vManaBankId
+ AND Fechacobro > vFromDated
+ AND Fechacobro <= vToDated
+
+ UNION ALL
+
+ SELECT g.Id_Cliente, g.Importe
+ FROM vn2008.Greuges g
+ WHERE Greuges_type_id = vManaGreugeTypeId
+ AND Fecha > vFromDated
+ AND Fecha <= vToDated
+
+ UNION ALL
+
+ SELECT Id_Cliente, mana
+ FROM bs.manaCustomer
+ WHERE dated = vFromDated
+ ) sub
+
+ GROUP BY Id_Cliente
+ HAVING Id_Cliente;
+
+ SET vFromDated = vToDated;
+
+ END WHILE;
+
+END$$
+DELIMITER ;
diff --git a/db/changes/10440-fallas/00-manaSpellersRequery.sql b/db/changes/10440-fallas/00-manaSpellersRequery.sql
new file mode 100644
index 000000000..9c1a10c6a
--- /dev/null
+++ b/db/changes/10440-fallas/00-manaSpellersRequery.sql
@@ -0,0 +1,75 @@
+DROP PROCEDURE IF EXISTS `vn`.`manaSpellersRequery`;
+
+DELIMITER $$
+$$
+CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`manaSpellersRequery`(vWorkerFk INTEGER)
+BEGIN
+/**
+ * Recalcula el mana consumido por un trabajador
+ *
+ * @param vWorkerFk Id Trabajador
+ */
+ DECLARE vWorkerIsExcluded BOOLEAN;
+ DECLARE vFromDated DATE;
+ DECLARE vToDated DATE DEFAULT TIMESTAMPADD(DAY,1,CURDATE());
+ DECLARE vMana INT;
+ DECLARE vAutoMana INT;
+ DECLARE vClaimMana INT;
+ DECLARE vManaBank INT;
+ DECLARE vManaGreugeType INT;
+
+ SELECT COUNT(*) INTO vWorkerIsExcluded
+ FROM workerManaExcluded
+ WHERE workerFk = vWorkerFk;
+
+ IF NOT vWorkerIsExcluded THEN
+ SELECT id INTO vMana
+ FROM `component` WHERE code = 'mana';
+
+ SELECT id INTO vAutoMana
+ FROM `component` WHERE code = 'autoMana';
+
+ SELECT id INTO vClaimMana
+ FROM `component` WHERE code = 'manaClaim';
+
+ SELECT id INTO vManaBank
+ FROM `bank` WHERE code = 'mana';
+
+ SELECT id INTO vManaGreugeType
+ FROM `greugeType` WHERE code = 'mana';
+
+ SELECT max(dated) INTO vFromDated
+ FROM clientManaCache;
+
+ REPLACE workerMana (workerFk, amount)
+ SELECT vWorkerFk, sum(mana) FROM
+ (
+ SELECT s.quantity * sc.value as mana
+ FROM ticket t
+ JOIN address a ON a.id = t.addressFk
+ JOIN client c ON c.id = a.clientFk
+ JOIN sale s ON s.ticketFk = t.id
+ JOIN saleComponent sc ON sc.saleFk = s.id
+ WHERE c.salesPersonFk = vWorkerFk AND sc.componentFk IN (vMana, vAutoMana, vClaimMana)
+ AND t.shipped > vFromDated AND t.shipped < vToDated
+ UNION ALL
+ SELECT - r.amountPaid
+ FROM receipt r
+ JOIN client c ON c.id = r.clientFk
+ WHERE c.salesPersonFk = vWorkerFk AND bankFk = vManaBank
+ AND payed > vFromDated
+ UNION ALL
+ SELECT g.amount
+ FROM greuge g
+ JOIN client c ON c.id = g.clientFk
+ WHERE c.salesPersonFk = vWorkerFk AND g.greugeTypeFk = vManaGreugeType
+ AND g.shipped > vFromDated and g.shipped < CURDATE()
+ UNION ALL
+ SELECT cc.mana
+ FROM clientManaCache cc
+ JOIN client c ON c.id = cc.clientFk
+ WHERE c.salesPersonFk = vWorkerFk AND cc.dated = vFromDated
+ ) sub;
+ END IF;
+END$$
+DELIMITER ;
diff --git a/db/changes/10440-fallas/00-worker.sql b/db/changes/10440-fallas/00-worker.sql
new file mode 100644
index 000000000..0e0def841
--- /dev/null
+++ b/db/changes/10440-fallas/00-worker.sql
@@ -0,0 +1,51 @@
+
+ALTER TABLE `vn`.`worker` MODIFY COLUMN `maritalStatus__` varchar(10) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
+UPDATE `vn`.`worker` `w`
+ SET `w`.`maritalStatus__` = NULL;
+
+UPDATE `vn`.`worker` `w`
+ JOIN `vn`.`person` `p` ON `p`.`workerFk` = `w`.`id`
+ JOIN `postgresql`.`profile` `pr` ON `pr`.`person_id` = `p`.`id`
+ JOIN `vn2008`.`profile_labour_payroll` `pl` ON `pl`.`profile_id` = `pr`.`profile_id`
+ SET `w`.`maritalStatus__` = `pl`.`estadocivil`;
+
+ALTER TABLE `vn`.`worker` ADD `originCountryFk` mediumint(8) unsigned NULL COMMENT 'País de origen';
+ALTER TABLE `vn`.`worker` ADD `educationLevelFk` SMALLINT NULL;
+ALTER TABLE `vn`.`worker` ADD `SSN` varchar(15) NULL;
+ALTER TABLE `vn`.`worker` CHANGE `maritalStatus__` `maritalStatus` enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
+ALTER TABLE `vn`.`worker` MODIFY COLUMN `maritalStatus` enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
+ALTER TABLE `vn`.`worker` CHANGE `maritalStatus` maritalStatus enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL AFTER sectorFk;
+ALTER TABLE `vn`.`worker` ADD CONSTRAINT `worker_FK_2` FOREIGN KEY (`educationLevelFk`) REFERENCES `vn`.`educationLevel`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
+ALTER TABLE `vn`.`worker` ADD CONSTRAINT `worker_FK_1` FOREIGN KEY (`originCountryFk`) REFERENCES `vn`.`country`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
+
+INSERT INTO `vn`.`country` (`country`, `CEE`, `code`, `politicalCountryFk`, `isUeeMember`, `a3Code`)
+ VALUES
+ ('Argentina',2,'AR',80,0,32),
+ ('Cuba',2,'CU',81,0,192),
+ ('Guinea Ecuatorial',2,'GQ',82,0,226),
+ ('Guinea',2,'GN',83,0,324),
+ ('Honduras',2,'HN',84,0,340),
+ ('Mali',2,'ML',85,0,466),
+ ('Nicaragua',2,'NI',86,0,558),
+ ('Pakistán',2,'PK',87,0,586),
+ ('Paraguay',2,'PY',88,0,600),
+ ('Senegal',2,'SN',89,0,686),
+ ('Uruguay',2,'UY',90,0,858),
+ ('Venezuela',2,'VE',91,0,862),
+ ('Bulgaria',2,'BG',92,1,100),
+ ('Georgia',2,'GE',93,0,268);
+
+UPDATE `vn`.`worker` `w`
+ JOIN `vn`.`person` `p` ON `p`.`workerFk` = `w`.`id`
+ JOIN `postgresql`.`profile` `pr` ON `pr`.`person_id` = `p`.`id`
+ JOIN `vn2008`.`profile_labour_payroll` `pl` ON `pl`.`profile_id` = `pr`.`profile_id`
+ JOIN `vn`.`country` `co` ON `co`.`a3Code` = `pl`.`codpais`
+ SET `w`.`originCountryFk` = `co`.`id`;
+
+UPDATE `vn`.`worker` `w`
+ JOIN `vn`.`person` `p` ON `p`.`workerFk` = `w`.`id`
+ JOIN `postgresql`.`profile` `pr` ON `pr`.`person_id` = `p`.`id`
+ JOIN `vn2008`.`profile_labour_payroll` pl ON `pl`.`profile_id` = `pr`.`profile_id`
+ SET `w`.`SSN` = CONCAT(`pl`.`NSSProvincia`, `pl`.`NssNumero`, `pl`.`NssDC`);
+
+RENAME TABLE `vn2008`.`profile_labour_payroll` TO `vn2008`.`profile_labour_payroll__`;
diff --git a/db/changes/10450-april/delete.keep b/db/changes/10451-april/delete-me.keep
similarity index 100%
rename from db/changes/10450-april/delete.keep
rename to db/changes/10451-april/delete-me.keep
diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index 5bd89ebd2..0849e6708 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -47,10 +47,36 @@ INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`
INSERT INTO `account`.`account`(`id`)
SELECT id FROM `account`.`user`;
+INSERT INTO `vn`.`educationLevel` (`id`, `name`)
+ VALUES
+ (1, 'ESTUDIOS PRIMARIOS COMPLETOS'),
+ (2, 'ENSEÑANZAS DE BACHILLERATO');
+
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`)
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9
FROM `vn`.`user`;
+ALTER TABLE `vn`.`worker` ADD `originCountryFk` mediumint(8) unsigned NULL COMMENT 'País de origen';
+ALTER TABLE `vn`.`worker` ADD `educationLevelFk` SMALLINT NULL;
+ALTER TABLE `vn`.`worker` ADD `SSN` varchar(15) NULL;
+ALTER TABLE `vn`.`worker` CHANGE `maritalStatus__` `maritalStatus` enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
+ALTER TABLE `vn`.`worker` MODIFY COLUMN `maritalStatus` enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL;
+ALTER TABLE `vn`.`worker` CHANGE `maritalStatus` maritalStatus enum('S','M') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL AFTER sectorFk;
+ALTER TABLE `vn`.`worker` ADD CONSTRAINT `worker_FK_2` FOREIGN KEY (`educationLevelFk`) REFERENCES `vn`.`educationLevel`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
+ALTER TABLE `vn`.`worker` ADD CONSTRAINT `worker_FK_1` FOREIGN KEY (`originCountryFk`) REFERENCES `vn`.`country`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
+
+UPDATE `vn`.`worker` `w`
+ SET `maritalStatus` = 'S';
+
+UPDATE `vn`.`worker` `w`
+ SET `originCountryFk` = '1';
+
+UPDATE `vn`.`worker` `w`
+ SET `educationLevelFk` = '2';
+
+UPDATE `vn`.`worker` `w`
+ SET `SSN` = '123456789123';
+
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9;
UPDATE `vn`.`worker` SET bossFk = 19 WHERE id = 18;
@@ -2428,6 +2454,13 @@ INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `for
(6, 29.95, '7001000000', NULL, 7, 20),
(7, 58.64, '6210000567', NULL, 8, 20);
+INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amount`, `stems`, `countryFk`)
+ VALUES
+ (1, 30.50, 5080000, 10.00, 162, 5),
+ (1, 10, 6021010, 20.00, 205, 5),
+ (2, 13.20, 5080000, 15.00, 580, 5),
+ (2, 16.10, 6021010, 25.00, 80, 5);
+
INSERT INTO `vn`.`ticketRecalc`(`ticketFk`)
SELECT `id`
FROM `vn`.`ticket` t
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index 266b2a1c1..f1a4ecce3 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -585,6 +585,7 @@ export default {
firstSalePriceInput: '.vn-popover.shown input[ng-model="$ctrl.field"]',
firstSaleDiscount: 'vn-ticket-sale vn-table vn-tr:nth-child(1) > vn-td:nth-child(10) > span',
firstSaleDiscountInput: '.vn-popover.shown [ng-model="$ctrl.field"]',
+ saveSaleDiscountButton: '.vn-popover.shown vn-button[label="Save"]',
firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(11)',
firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)',
firstSaleColour: 'vn-ticket-sale vn-tr:nth-child(1) vn-fetched-tags section',
diff --git a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
index 5078d5b91..972684708 100644
--- a/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
+++ b/e2e/paths/05-ticket/01-sale/02_edit_sale.spec.js
@@ -175,7 +175,8 @@ describe('Ticket Edit sale path', () => {
it('should update the discount', async() => {
await page.waitToClick(selectors.ticketSales.firstSaleDiscount);
await page.waitForSelector(selectors.ticketSales.firstSaleDiscountInput);
- await page.type(selectors.ticketSales.firstSaleDiscountInput, '50\u000d');
+ await page.type(selectors.ticketSales.firstSaleDiscountInput, '50');
+ await page.waitToClick(selectors.ticketSales.saveSaleDiscountButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
diff --git a/loopback/server/datasources.json b/loopback/server/datasources.json
index 0df03882c..8b741ec97 100644
--- a/loopback/server/datasources.json
+++ b/loopback/server/datasources.json
@@ -15,7 +15,8 @@
"legacyUtcDateProcessing": false,
"timezone": "local",
"connectTimeout": 40000,
- "acquireTimeout": 20000
+ "acquireTimeout": 20000,
+ "waitForConnections": true
},
"osticket": {
"connector": "memory",
diff --git a/modules/invoiceIn/back/methods/invoice-in/summary.js b/modules/invoiceIn/back/methods/invoice-in/summary.js
index acabe29d9..0e55eeaac 100644
--- a/modules/invoiceIn/back/methods/invoice-in/summary.js
+++ b/modules/invoiceIn/back/methods/invoice-in/summary.js
@@ -64,6 +64,34 @@ module.exports = Self => {
}]
}
},
+ {
+ relation: 'invoiceInIntrastat',
+ scope: {
+ fields: [
+ 'id',
+ 'invoiceInFk',
+ 'net',
+ 'intrastatFk',
+ 'amount',
+ 'stems',
+ 'countryFk',
+ 'statisticalValue'],
+ include: [{
+ relation: 'intrastat',
+ scope: {
+ fields: [
+ 'id',
+ 'description']
+ }
+ },
+ {
+ relation: 'country',
+ scope: {
+ fields: ['code']
+ }
+ }]
+ }
+ },
{
relation: 'invoiceInTax',
scope: {
diff --git a/modules/invoiceIn/back/model-config.json b/modules/invoiceIn/back/model-config.json
index f0745f53b..6765ae81c 100644
--- a/modules/invoiceIn/back/model-config.json
+++ b/modules/invoiceIn/back/model-config.json
@@ -8,6 +8,9 @@
"InvoiceInDueDay": {
"dataSource": "vn"
},
+ "InvoiceInIntrastat": {
+ "dataSource": "vn"
+ },
"InvoiceInLog": {
"dataSource": "vn"
}
diff --git a/modules/invoiceIn/back/models/invoice-in-intrastat.json b/modules/invoiceIn/back/models/invoice-in-intrastat.json
new file mode 100644
index 000000000..65ab1f36a
--- /dev/null
+++ b/modules/invoiceIn/back/models/invoice-in-intrastat.json
@@ -0,0 +1,50 @@
+{
+ "name": "InvoiceInIntrastat",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "invoiceInIntrastat"
+ }
+ },
+ "properties": {
+ "id": {
+ "id": true,
+ "type": "number",
+ "description": "Identifier"
+ },
+ "invoiceInFk": {
+ "type": "number"
+ },
+ "net": {
+ "type": "number"
+ },
+ "intrastatFk": {
+ "type": "number"
+ },
+ "amount": {
+ "type": "number"
+ },
+ "stems": {
+ "type": "number"
+ },
+ "countryFk": {
+ "type": "number"
+ },
+ "statisticalValue": {
+ "type": "number"
+ }
+ },
+ "relations": {
+ "intrastat": {
+ "type": "belongsTo",
+ "model": "Intrastat",
+ "foreignKey": "intrastatFk"
+ },
+ "country": {
+ "type": "belongsTo",
+ "model": "Country",
+ "foreignKey": "countryFk"
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/modules/invoiceIn/back/models/invoice-in.json b/modules/invoiceIn/back/models/invoice-in.json
index feb2d9aec..c6a736b06 100644
--- a/modules/invoiceIn/back/models/invoice-in.json
+++ b/modules/invoiceIn/back/models/invoice-in.json
@@ -64,6 +64,11 @@
"model": "InvoiceInDueDay",
"foreignKey": "invoiceInFk"
},
+ "invoiceInIntrastat": {
+ "type": "hasMany",
+ "model": "InvoiceInIntrastat",
+ "foreignKey": "invoiceInFk"
+ },
"invoiceInTax": {
"type": "hasMany",
"model": "InvoiceInTax",
diff --git a/modules/invoiceIn/front/index.js b/modules/invoiceIn/front/index.js
index 18e9d73c2..7b6d6a77c 100644
--- a/modules/invoiceIn/front/index.js
+++ b/modules/invoiceIn/front/index.js
@@ -10,5 +10,6 @@ import './summary';
import './basic-data';
import './tax';
import './dueDay';
+import './intrastat';
import './create';
import './log';
diff --git a/modules/invoiceIn/front/intrastat/index.html b/modules/invoiceIn/front/intrastat/index.html
new file mode 100644
index 000000000..cb447132d
--- /dev/null
+++ b/modules/invoiceIn/front/intrastat/index.html
@@ -0,0 +1,100 @@
+
New price
@@ -297,6 +308,16 @@