Merge branch 'dev' into 2612-create-supplier
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Pau 2022-10-17 07:32:50 +00:00
commit dc53aac163
8 changed files with 28 additions and 21 deletions

View File

@ -17,14 +17,16 @@ module.exports = Self => {
}); });
Self.deleteTrashFiles = async options => { Self.deleteTrashFiles = async options => {
const tx = await Self.beginTransaction({}); let tx;
const myOptions = {}; const myOptions = {};
if (typeof options == 'object') if (typeof options == 'object')
Object.assign(myOptions, options); Object.assign(myOptions, options);
if (!myOptions.transaction) if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx; myOptions.transaction = tx;
}
try { try {
if (process.env.NODE_ENV == 'test') if (process.env.NODE_ENV == 'test')
@ -61,10 +63,9 @@ module.exports = Self => {
const dstFolder = path.join(dmsContainer.client.root, pathHash); const dstFolder = path.join(dmsContainer.client.root, pathHash);
try { try {
await fs.rmdir(dstFolder); await fs.rmdir(dstFolder);
} catch (err) {}
await dms.destroy(myOptions); await dms.destroy(myOptions);
} catch (err) {
await dms.destroy(myOptions);
}
} }
if (tx) await tx.commit(); if (tx) await tx.commit();
} catch (e) { } catch (e) {

View File

@ -1022,8 +1022,8 @@ export default {
}, },
travelExtraCommunity: { travelExtraCommunity: {
anySearchResult: 'vn-travel-extra-community > vn-card div > tbody > tr[ng-attr-id="{{::travel.id}}"]', anySearchResult: 'vn-travel-extra-community > vn-card div > tbody > tr[ng-attr-id="{{::travel.id}}"]',
firstTravelReference: 'vn-travel-extra-community tbody:nth-child(2) vn-textfield[ng-model="travel.ref"]', firstTravelReference: 'vn-travel-extra-community tbody:nth-child(2) vn-td-editable[name="reference"]',
firstTravelLockedKg: 'vn-travel-extra-community tbody:nth-child(2) vn-input-number[ng-model="travel.kg"]', firstTravelLockedKg: 'vn-travel-extra-community tbody:nth-child(2) vn-td-editable[name="lockedKg"]',
removeContinentFilter: 'vn-searchbar > form > vn-textfield > div.container > div.prepend > prepend > div > span:nth-child(3) > vn-icon > i' removeContinentFilter: 'vn-searchbar > form > vn-textfield > div.container > div.prepend > prepend > div > span:nth-child(3) > vn-icon > i'
}, },
travelBasicData: { travelBasicData: {

View File

@ -19,10 +19,10 @@ describe('Travel extra community path', () => {
it('should edit the travel reference and the locked kilograms', async() => { it('should edit the travel reference and the locked kilograms', async() => {
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter); await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
await page.waitForSpinnerLoad(); await page.waitForSpinnerLoad();
await page.clearInput(selectors.travelExtraCommunity.firstTravelReference); await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
await page.write(selectors.travelExtraCommunity.firstTravelReference, 'edited reference'); await page.waitForSpinnerLoad();
await page.clearInput(selectors.travelExtraCommunity.firstTravelLockedKg); await page.writeOnEditableTD(selectors.travelExtraCommunity.firstTravelLockedKg, '1500');
await page.write(selectors.travelExtraCommunity.firstTravelLockedKg, '1500');
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!'); expect(message.text).toContain('Data saved!');
@ -32,9 +32,9 @@ describe('Travel extra community path', () => {
await page.accessToSection('travel.index'); await page.accessToSection('travel.index');
await page.accessToSection('travel.extraCommunity'); await page.accessToSection('travel.extraCommunity');
await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter); await page.waitToClick(selectors.travelExtraCommunity.removeContinentFilter);
await page.waitForTextInElement(selectors.travelExtraCommunity.firstTravelReference, 'edited reference');
const reference = await page.waitToGetProperty(selectors.travelExtraCommunity.firstTravelReference, 'value'); const reference = await page.getProperty(selectors.travelExtraCommunity.firstTravelReference, 'innerText');
const lockedKg = await page.waitToGetProperty(selectors.travelExtraCommunity.firstTravelLockedKg, 'value'); const lockedKg = await page.getProperty(selectors.travelExtraCommunity.firstTravelLockedKg, 'innerText');
expect(reference).toContain('edited reference'); expect(reference).toContain('edited reference');
expect(lockedKg).toContain(1500); expect(lockedKg).toContain(1500);

View File

@ -40,6 +40,7 @@
"image/png", "image/png",
"image/jpeg", "image/jpeg",
"image/jpg", "image/jpg",
"image/webp",
"video/mp4" "video/mp4"
] ]
}, },
@ -60,7 +61,8 @@
"multipart/x-zip", "multipart/x-zip",
"image/png", "image/png",
"image/jpeg", "image/jpeg",
"image/jpg" "image/jpg",
"image/webp"
] ]
}, },
"imageStorage": { "imageStorage": {
@ -72,7 +74,8 @@
"allowedContentTypes": [ "allowedContentTypes": [
"image/png", "image/png",
"image/jpeg", "image/jpeg",
"image/jpg" "image/jpg",
"image/webp"
] ]
}, },
"invoiceStorage": { "invoiceStorage": {
@ -96,6 +99,7 @@
"image/png", "image/png",
"image/jpeg", "image/jpeg",
"image/jpg", "image/jpg",
"image/webp",
"video/mp4" "video/mp4"
] ]
}, },

View File

@ -27,7 +27,7 @@ class Controller extends Section {
if (this.$params.warehouseFk) if (this.$params.warehouseFk)
this.warehouseFk = this.$params.warehouseFk; this.warehouseFk = this.$params.warehouseFk;
else if (value) else if (value)
this.warehouseFk = value.itemType.warehouseFk; this.warehouseFk = this.vnConfig.warehouseFk;
if (this.$params.lineFk) if (this.$params.lineFk)
this.lineFk = this.$params.lineFk; this.lineFk = this.$params.lineFk;

View File

@ -19,7 +19,8 @@ describe('Item', () => {
describe('set item()', () => { describe('set item()', () => {
it('should set warehouseFk property based on itemType warehouseFk', () => { it('should set warehouseFk property based on itemType warehouseFk', () => {
jest.spyOn(controller.$, '$applyAsync'); jest.spyOn(controller.$, '$applyAsync');
controller.item = {id: 1, itemType: {warehouseFk: 1}}; controller.vnConfig = {warehouseFk: 1};
controller.item = {id: 1};
expect(controller.$.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function)); expect(controller.$.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function));
$scope.$apply(); $scope.$apply();

View File

@ -211,7 +211,7 @@ module.exports = Self => {
LEFT JOIN province p ON p.id = a.provinceFk LEFT JOIN province p ON p.id = a.provinceFk
LEFT JOIN warehouse w ON w.id = t.warehouseFk LEFT JOIN warehouse w ON w.id = t.warehouseFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
STRAIGHT_JOIN ticketState ts ON ts.ticketFk = t.id LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk

View File

@ -101,6 +101,7 @@ module.exports = async function(Self, tickets, reqArgs = {}) {
if (firstOrder == 1) { if (firstOrder == 1) {
const args = { const args = {
id: ticket.clientFk, id: ticket.clientFk,
companyId: ticket.companyFk,
recipientId: ticket.clientFk, recipientId: ticket.clientFk,
recipient: ticket.recipient, recipient: ticket.recipient,
replyTo: ticket.salesPersonEmail replyTo: ticket.salesPersonEmail
@ -109,7 +110,7 @@ module.exports = async function(Self, tickets, reqArgs = {}) {
const email = new Email('incoterms-authorization', args); const email = new Email('incoterms-authorization', args);
await email.send(); await email.send();
const sample = await Self.rawSql( const [sample] = await Self.rawSql(
`SELECT id `SELECT id
FROM sample FROM sample
WHERE code = 'incoterms-authorization' WHERE code = 'incoterms-authorization'