Merge pull request '3472-supplier_summary isFarmer' (#833) from 3472-supplier_summary into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #833 Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
commit
baea601156
|
@ -1292,11 +1292,11 @@ INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `pr
|
|||
(5, 442, 'GCR building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'),
|
||||
(6, 442, 'The Gotham Tonight building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222');
|
||||
|
||||
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`,`isFarmer`,`commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`)
|
||||
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`)
|
||||
VALUES
|
||||
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1),
|
||||
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 1, 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1),
|
||||
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'flowerPlants', 1);
|
||||
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1),
|
||||
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1),
|
||||
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'flowerPlants', 1);
|
||||
|
||||
INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`)
|
||||
VALUES
|
||||
|
|
|
@ -38,7 +38,6 @@ module.exports = Self => {
|
|||
'payDemFk',
|
||||
'payDay',
|
||||
'account',
|
||||
'isFarmer',
|
||||
'sageTaxTypeFk',
|
||||
'sageTransactionTypeFk',
|
||||
'sageWithholdingFk',
|
||||
|
@ -102,6 +101,11 @@ module.exports = Self => {
|
|||
]
|
||||
};
|
||||
let supplier = await Self.app.models.Supplier.findOne(filter);
|
||||
|
||||
const farmerCode = 2;
|
||||
if (supplier.sageWithholdingFk == farmerCode)
|
||||
supplier.isFarmer = true;
|
||||
|
||||
return supplier;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -25,4 +25,12 @@ describe('Supplier getSummary()', () => {
|
|||
|
||||
expect(payMethod.name).toEqual('PayMethod one');
|
||||
});
|
||||
|
||||
it(`should get if supplier is farmer by sageWithholdingFk`, async() => {
|
||||
const supplier = await app.models.Supplier.findById(2);
|
||||
const supplierSummary = await app.models.Supplier.getSummary(2);
|
||||
|
||||
expect(supplier.isFarmer).toBeUndefined();
|
||||
expect(supplierSummary.isFarmer).toEqual(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
"nif": {
|
||||
"type": "string"
|
||||
},
|
||||
"isFarmer": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"phone": {
|
||||
"type": "number"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue