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

View File

@ -1022,8 +1022,8 @@ export default {
},
travelExtraCommunity: {
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"]',
firstTravelLockedKg: 'vn-travel-extra-community tbody:nth-child(2) vn-input-number[ng-model="travel.kg"]',
firstTravelReference: 'vn-travel-extra-community tbody:nth-child(2) vn-td-editable[name="reference"]',
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'
},
travelBasicData: {

View File

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

View File

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

View File

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

View File

@ -19,7 +19,8 @@ describe('Item', () => {
describe('set item()', () => {
it('should set warehouseFk property based on itemType warehouseFk', () => {
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));
$scope.$apply();

View File

@ -211,7 +211,7 @@ module.exports = Self => {
LEFT JOIN province p ON p.id = a.provinceFk
LEFT JOIN warehouse w ON w.id = t.warehouseFk
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 client c ON c.id = t.clientFk
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) {
const args = {
id: ticket.clientFk,
companyId: ticket.companyFk,
recipientId: ticket.clientFk,
recipient: ticket.recipient,
replyTo: ticket.salesPersonEmail
@ -109,7 +110,7 @@ module.exports = async function(Self, tickets, reqArgs = {}) {
const email = new Email('incoterms-authorization', args);
await email.send();
const sample = await Self.rawSql(
const [sample] = await Self.rawSql(
`SELECT id
FROM sample
WHERE code = 'incoterms-authorization'