diff --git a/client/client/src/address-edit/address-edit.html b/client/client/src/address-edit/address-edit.html
index 357f58897..42b73ecdb 100644
--- a/client/client/src/address-edit/address-edit.html
+++ b/client/client/src/address-edit/address-edit.html
@@ -58,7 +58,7 @@
show-field = "description"
label = "Observation type"
order = "description ASC"
- filter-search="{where: {description: {regexp: 'search'}} }">
+ filter-search="{where: {description: {regexp: 'search'}}}">
{{$parent.$parent.item.description}}
@@ -75,8 +75,8 @@
orange
icon="add_circle"
ng-if = "observation.showAddIcon && observationsTypes.model.length > $ctrl.observations.length"
- ng-click="$ctrl.addObservation()"
- >
+ ng-click="$ctrl.addObservation()">
+
diff --git a/client/core/src/components/autocomplete/autocomplete.html b/client/core/src/components/autocomplete/autocomplete.html
index df78db6d9..6dd9b3ab7 100644
--- a/client/core/src/components/autocomplete/autocomplete.html
+++ b/client/core/src/components/autocomplete/autocomplete.html
@@ -3,8 +3,7 @@
label="{{$ctrl.label}}"
model="$ctrl.displayValue"
readonly="$ctrl.readonly"
- tab-index="-1"
- >
+ tab-index="-1">
{{$parent.item[$ctrl.showField]}}
+ parent = "$ctrl.element">
+ {{$parent.item[$ctrl.showField]}}
+
\ No newline at end of file
diff --git a/client/item/src/barcode/item-barcode.html b/client/item/src/barcode/item-barcode.html
index 94b5e946a..985d3a02b 100644
--- a/client/item/src/barcode/item-barcode.html
+++ b/client/item/src/barcode/item-barcode.html
@@ -1,31 +1,31 @@
-
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index d8a99d574..68212c1bc 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -145,8 +145,16 @@ export default {
searchItemInput: `${components.vnTextfield}`,
searchButton: `${components.vnSearchBar} > vn-icon-button > button`
},
+ itemBasicData: {
+ basicDataButton: `${components.vnMenuItem}[ui-sref="item.card.data"]`
+ },
itemBarcodes: {
- barcodeButton: `${components.vnMenuItem}[ui-sref="item.card.itemBarcode"]`
+ barcodeButton: `${components.vnMenuItem}[ui-sref="item.card.itemBarcode"]`,
+ addBarcodeButton: `${components.vnIcon}[icon="add_circle"]`,
+ thirdCodeInput: `vn-horizontal:nth-child(5) > ${components.vnTextfield}`,
+ fourthCodeInput: `vn-horizontal:nth-child(6) > ${components.vnTextfield}`,
+ submitBarcodesButton: `${components.vnSubmit}`,
+ firstCodeRemoveButton: `vn-horizontal:nth-child(3) > vn-one > ${components.vnIcon}[icon="remove_circle_outline"]`
}
};
diff --git a/e2e/paths/client-module/01_create_client.spec.js b/e2e/paths/client-module/01_create_client.spec.js
index 78a521ece..a6c3f97e7 100644
--- a/e2e/paths/client-module/01_create_client.spec.js
+++ b/e2e/paths/client-module/01_create_client.spec.js
@@ -161,4 +161,12 @@ describe('create client path', () => {
expect(result).toEqual(1);
});
});
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/client-module/02_edit_basic_data.spec.js b/e2e/paths/client-module/02_edit_basic_data.spec.js
index 82bef943a..410efa4ac 100644
--- a/e2e/paths/client-module/02_edit_basic_data.spec.js
+++ b/e2e/paths/client-module/02_edit_basic_data.spec.js
@@ -206,4 +206,12 @@ describe('Edit basicData path', () => {
expect(result).toEqual('Metropolis newspaper');
});
});
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/client-module/03_edit_fiscal_data.spec.js b/e2e/paths/client-module/03_edit_fiscal_data.spec.js
index 47907a9ca..bc6a65714 100644
--- a/e2e/paths/client-module/03_edit_fiscal_data.spec.js
+++ b/e2e/paths/client-module/03_edit_fiscal_data.spec.js
@@ -439,4 +439,12 @@ describe('Edit fiscalData path', () => {
expect(value).toBeTruthy();
});
});
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/client-module/04_edit_pay_method.spec.js b/e2e/paths/client-module/04_edit_pay_method.spec.js
index 888050ed1..a40c5ac93 100644
--- a/e2e/paths/client-module/04_edit_pay_method.spec.js
+++ b/e2e/paths/client-module/04_edit_pay_method.spec.js
@@ -197,4 +197,12 @@ describe('Edit pay method path', () => {
expect(value).toBeFalsy();
});
});
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/client-module/05_add_address.spec.js b/e2e/paths/client-module/05_add_address.spec.js
index 02992d12b..0b2256989 100644
--- a/e2e/paths/client-module/05_add_address.spec.js
+++ b/e2e/paths/client-module/05_add_address.spec.js
@@ -201,4 +201,12 @@ describe('Add address path', () => {
expect(result).toContain('Error');
});
});
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/client-module/06_add_address_notes.spec.js b/e2e/paths/client-module/06_add_address_notes.spec.js
index 0fe8a8213..4a56ddb64 100644
--- a/e2e/paths/client-module/06_add_address_notes.spec.js
+++ b/e2e/paths/client-module/06_add_address_notes.spec.js
@@ -60,4 +60,12 @@ describe('Add address notes path', () => {
// expect(result).toContain('Some fields are invalid');
// })
// });
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/client-module/07_edit_web_access.spec.js b/e2e/paths/client-module/07_edit_web_access.spec.js
index 2457513e0..569d94dbb 100644
--- a/e2e/paths/client-module/07_edit_web_access.spec.js
+++ b/e2e/paths/client-module/07_edit_web_access.spec.js
@@ -88,4 +88,12 @@ describe('Edit web access path', () => {
expect(result).toEqual('Hulk');
});
});
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/client-module/08_add_notes.spec.js b/e2e/paths/client-module/08_add_notes.spec.js
index ca07ec054..4c598e1c4 100644
--- a/e2e/paths/client-module/08_add_notes.spec.js
+++ b/e2e/paths/client-module/08_add_notes.spec.js
@@ -68,4 +68,12 @@ describe('Add notes path', () => {
expect(value).toEqual('Meeting with Black Widow 21st 9am');
});
});
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/client-module/09_add_credit.spec.js b/e2e/paths/client-module/09_add_credit.spec.js
index 206adc0d4..c14757c0a 100644
--- a/e2e/paths/client-module/09_add_credit.spec.js
+++ b/e2e/paths/client-module/09_add_credit.spec.js
@@ -69,4 +69,12 @@ describe('Add credit path', () => {
expect(value).toContain(999);
});
});
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/client-module/10_add_greuge.spec.js b/e2e/paths/client-module/10_add_greuge.spec.js
index adf081ea2..af3f1278d 100644
--- a/e2e/paths/client-module/10_add_greuge.spec.js
+++ b/e2e/paths/client-module/10_add_greuge.spec.js
@@ -114,4 +114,12 @@ describe('Add greuge path', () => {
expect(value).toContain('Diff');
});
});
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/client-module/11_mandate.spec.js b/e2e/paths/client-module/11_mandate.spec.js
index 570f696b1..992fc7fa2 100644
--- a/e2e/paths/client-module/11_mandate.spec.js
+++ b/e2e/paths/client-module/11_mandate.spec.js
@@ -50,4 +50,12 @@ describe('mandate path', () => {
expect(value).toContain('CORE');
});
});
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/e2e/paths/item-module/06_create_item_barcode.spec.js b/e2e/paths/item-module/06_create_item_barcode.spec.js
index af0a2bce2..d0426f098 100644
--- a/e2e/paths/item-module/06_create_item_barcode.spec.js
+++ b/e2e/paths/item-module/06_create_item_barcode.spec.js
@@ -55,17 +55,55 @@ describe('create item barcodes path', () => {
.catch(catchErrors(done));
});
- // it(`should click on the search result to access to the item barcodes`, done => {
- // nightmare
- // .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
- // .waitToClick(selectors.itemsIndex.searchResult)
- // .waitToClick(selectors.itemBarcodes.barcodeButton)
- // .waitForURL('barcode')
- // .url()
- // .then(url => {
- // expect(url).toContain('barcode');
- // done();
- // })
- // .catch(catchErrors(done));
- // });
+ it(`should click on the search result to access to the item barcodes`, done => {
+ nightmare
+ .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
+ .waitToClick(selectors.itemsIndex.searchResult)
+ .waitToClick(selectors.itemBarcodes.barcodeButton)
+ .waitForURL('barcode')
+ .url()
+ .then(url => {
+ expect(url).toContain('barcode');
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ it(`should click create a new code and delete a former one`, done => {
+ nightmare
+ .waitToClick(selectors.itemBarcodes.addBarcodeButton)
+ .type(selectors.itemBarcodes.fourthCodeInput, '5')
+ .click(selectors.itemBarcodes.firstCodeRemoveButton)
+ .click(selectors.itemBarcodes.submitBarcodesButton)
+ .wait(selectors.globalItems.snackbarIsActive)
+ .getInnerText(selectors.globalItems.snackbarIsActive)
+ .then(result => {
+ expect(result).toContain('Data saved!');
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ it(`should confirm the barcode 5 is created and it is now the third barcode as the first was deleted`, done => {
+ nightmare
+ .waitForSnackbarReset()
+ .click(selectors.itemBasicData.basicDataButton)
+ .wait(selectors.itemBasicData.nameInput)
+ .click(selectors.itemBarcodes.barcodeButton)
+ .wait(200)
+ .getInputValue(selectors.itemBarcodes.thirdCodeInput)
+ .then(result => {
+ expect(result).toEqual('5');
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ describe('closing browser', () => {
+ it('should close the browser', done => {
+ nightmare
+ .end()
+ .then(done);
+ });
+ });
});
diff --git a/services/db/04-fixtures.sql b/services/db/04-fixtures.sql
index 920a1dff2..5ccd1b5e3 100644
--- a/services/db/04-fixtures.sql
+++ b/services/db/04-fixtures.sql
@@ -247,7 +247,6 @@ INSERT INTO `vn2008`.`empresa`(`id`, `abbreviation`, `registro`, `gerente_id`, `
VALUES
(442, 'WAY', 'Wayne Industries, Inc. operates as a warehouse for steel products.', '2', '1989-11-19', NULL, NULL, '1', '1', '00FF00', 'BruceWayne@verdnatura.es', NULL, '1989-08-11 12:31:22', '10', '1', NULL, '1', '1');
-
INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `clientFk`,`nickname`, `addressFk`)
VALUES
(1, 1, 1, NULL, CURDATE(), 1, 'Batman', 101),
@@ -330,7 +329,7 @@ INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk
(1, 'CRI', 'Crisantemo', 2, 15, 5),
(2, 'ITG', 'Anthurium', 1, 30, 5),
(3, 'WPN', 'Paniculata', 2, 30, 5);
-
+
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`)
VALUES
('YEL', 'Yellow', 1 , 1),
@@ -388,12 +387,32 @@ INSERT INTO `vn`.`itemBarcode`(`id`, `itemFk`, `code`)
(3, 1 ,3 ),
(4, 2 ,4 );
-INSERT INTO `vn`.`itemPlacement`(`itemFk`, `warehouseFk`, `code`)
+INSERT INTO `vn`.`itemPlacement`(`id`, `itemFk`, `warehouseFk`, `code`)
VALUES
- (1, 1, 'A1'),
- (1, 2, 'A2'),
- (1, 3, 'A3'),
- (2, 1, 'A4');
+ (1, 1, 1, 'A1'),
+ (2, 1, 2, 'A2'),
+ (3, 1, 3, 'A3'),
+ (4, 2, 1, 'A4');
+
+INSERT INTO `edi`.`genus`(`genus_id`, `latin_genus_name`, `entry_date`, `expiry_date`, `change_date_time`)
+ VALUES
+ ( 1, 'Abelia' , CURDATE(), NULL, CURDATE()),
+ ( 2, 'Abies', CURDATE(), NULL, CURDATE()),
+ ( 3, 'Abutilon', CURDATE(), NULL, CURDATE());
+
+INSERT INTO `edi`.`specie`(`specie_id`, `genus_id`, `latin_species_name`, `entry_date`, `expiry_date`, `change_date_time`)
+ VALUES
+ ( 1, 1, 'grandiflora', CURDATE(), NULL, CURDATE()),
+ ( 2, 2, 'procera', CURDATE(), NULL, CURDATE()),
+ ( 3, 3, 'decurrens', CURDATE(), NULL, CURDATE()),
+ ( 4, 3, 'dealbata', CURDATE(), NULL, CURDATE());
+
+INSERT INTO `vn`.`itemBotanical`(`itemFk`, `botanical`, `genusFk`, `specieFk`)
+ VALUES
+ ( 1, 'Hedera helix' , 1, 1),
+ ( 2, NULL, 2, 2),
+ ( 3, 'Cycas revoluta', 2, NULL),
+ ( 4, 'Polygonum', NULL, NULL);
INSERT INTO `salix`.`user`(`id`,`username`,`password`,`email`)
VALUES
diff --git a/services/db/changes/1.0.0/05-articles_nicho.sql b/services/db/changes/1.0.0/05-articles_nicho.sql
new file mode 100644
index 000000000..8609181ea
--- /dev/null
+++ b/services/db/changes/1.0.0/05-articles_nicho.sql
@@ -0,0 +1,16 @@
+ALTER TABLE `vn2008`.`Articles_nicho`
+DROP FOREIGN KEY `Articles_nichos_fk`;
+ALTER TABLE `vn2008`.`Articles_nicho`
+CHANGE COLUMN `Id_Article` `Id_Article` INT(11) NOT NULL ,
+ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT AFTER `modificationDate`,
+DROP PRIMARY KEY,
+ADD PRIMARY KEY (`id`);
+ALTER TABLE `vn2008`.`Articles_nicho`
+ADD CONSTRAINT `Articles_nichos_fk`
+ FOREIGN KEY (`Id_Article`)
+ REFERENCES `vn2008`.`Articles` (`Id_Article`)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE;
+
+
+
diff --git a/services/db/changes/1.0.0/06-itemPlacement.sql b/services/db/changes/1.0.0/06-itemPlacement.sql
new file mode 100644
index 000000000..ad24ab291
--- /dev/null
+++ b/services/db/changes/1.0.0/06-itemPlacement.sql
@@ -0,0 +1,12 @@
+CREATE
+ OR REPLACE ALGORITHM = UNDEFINED
+ DEFINER = `root`@`%`
+ SQL SECURITY DEFINER
+VIEW `vn`.`itemPlacement` AS
+ SELECT
+ `an`.`id` AS `id`,
+ `an`.`Id_Article` AS `itemFk`,
+ `an`.`warehouse_id` AS `warehouseFk`,
+ `an`.`nicho` AS `code`
+ FROM
+ `vn2008`.`Articles_nicho` `an`;
diff --git a/services/item/common/methods/item/specs/crudItemBarcodes.spec.js b/services/item/common/methods/item/specs/crudItemBarcodes.spec.js
index 72365229a..d560677d9 100644
--- a/services/item/common/methods/item/specs/crudItemBarcodes.spec.js
+++ b/services/item/common/methods/item/specs/crudItemBarcodes.spec.js
@@ -1,7 +1,19 @@
const crudItemBarcodes = require('../crudItemBarcodes');
const catchErrors = require('../../../../../../services/utils/jasmineHelpers').catchErrors;
+let mysql = require('mysql2');
describe('Item crudItemBarcodes()', () => {
+ let connection;
+ beforeAll(() => {
+ connection = mysql.createConnection({
+ multipleStatements: true,
+ host: 'localhost',
+ user: 'root',
+ password: '',
+ database: 'salix'
+ });
+ });
+
it('should call the destroyAll methodif there are ids in delete Array', done => {
let self = jasmine.createSpyObj('self', ['remoteMethod', 'crudItemBarcodes', 'destroyAll', 'create', 'upsert']);
@@ -48,4 +60,13 @@ describe('Item crudItemBarcodes()', () => {
})
.catch(catchErrors(done));
});
+
+ it('should return an error when attempting to save a duplicated barcode', done => {
+ let callback = (err, res) => {
+ expect(err.toString()).toBe("Error: Duplicate entry '4' for key 'PRIMARY'");
+ done();
+ };
+
+ connection.query('INSERT INTO `vn`.`itemBarcode` VALUES (4, 2 ,4 );', callback);
+ });
});
diff --git a/services/item/common/models/itemBarcode.json b/services/item/common/models/itemBarcode.json
index 9274cae98..8c089609f 100644
--- a/services/item/common/models/itemBarcode.json
+++ b/services/item/common/models/itemBarcode.json
@@ -1,28 +1,28 @@
{
- "name": "ItemBarcode",
- "base": "VnModel",
- "options": {
- "mysql": {
- "table": "itemBarcode",
- "database": "vn"
- }
- },
- "properties": {
- "id": {
- "type": "Number",
- "id": true,
- "description": "Identifier"
- },
- "code": {
- "type": "String",
- "required": true
+ "name": "ItemBarcode",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "itemBarcode",
+ "database": "vn"
}
+ },
+ "properties": {
+ "id": {
+ "type": "Number",
+ "id": true,
+ "description": "Identifier"
},
- "relations": {
- "item": {
- "type": "belongsTo",
- "model": "Item",
- "foreignKey": "itemFk"
- }
+ "code": {
+ "type": "String",
+ "required": true
}
+ },
+ "relations": {
+ "item": {
+ "type": "belongsTo",
+ "model": "Item",
+ "foreignKey": "itemFk"
+ }
}
+}
diff --git a/services/loopback/common/methods/client/specs/activeSalesperson.spec.js b/services/loopback/common/methods/client/specs/activeSalesperson.spec.js
index 085c0f3ce..80c47db24 100644
--- a/services/loopback/common/methods/client/specs/activeSalesperson.spec.js
+++ b/services/loopback/common/methods/client/specs/activeSalesperson.spec.js
@@ -17,14 +17,14 @@ describe('Client activeSalesPerson', () => {
app.models.Client.activeSalesPerson(filter, callback);
});
- it('should call the activeSalesPerson() method with no limit and receive all 3 salesPersons', done => {
+ it('should call the activeSalesPerson() method with no limit and receive all 6 salesPersons', done => {
let filter = {
};
let callback = (error, result) => {
if (error) return catchErrors(done)(error);
- expect(result.length).toEqual(3);
+ expect(result.length).toEqual(6);
done();
};