#7709 -supplierPackaging_ReportSource_2 #3107

Open
robert wants to merge 19 commits from 7709-supplierPackaging_ReportSource_2 into dev
4 changed files with 33 additions and 48 deletions
Showing only changes of commit 620cf1c26e - Show all commits

View File

@ -6,9 +6,10 @@ BEGIN
*
* @param tmp.buysToCheck(id as INT).
*/
DECLARE hasVolumetricAgency INT;
DECLARE vHasVolumetricAgency INT;
DECLARE vItemFk INT;
SELECT a.hasWeightVolumetric INTO hasVolumetricAgency
SELECT a.hasWeightVolumetric, i.id INTO vHasVolumetricAgency, vItemFk
FROM entry e
JOIN travel t ON t.id = e.travelFk
JOIN agencyMode a ON a.id = t.agencyModeFk
@ -21,8 +22,8 @@ BEGIN
DROP TEMPORARY TABLE tmp.buysToCheck;
IF hasVolumetricAgency THEN
CALL util.throw('Item lacks size/weight in purchase line at agency');
IF vHasVolumetricAgency THEN
CALL util.throw(CONCAT('Missing size/weight in buy line at agency, item: ', vItemFk));
END IF;
END$$
DELIMITER ;

View File

@ -143,6 +143,10 @@
],
"scopes": {
"descriptor": {
"fields": [
"id",
"phone"
],
"include": [
{
"relation": "user",
@ -164,15 +168,29 @@
{
"relation": "department",
"scope": {
"fields": [
"departmentFk"
],
"include": [
{
"relation": "department"
"relation": "department",
"scope": {
"fields": [
"id",
"name"
]
}
}
]
}
},
{
"relation": "sip"
"relation": "sip",
"scope": {
"fields": [
"extension"
]
}
}
]
}

View File

@ -36,42 +36,8 @@ class Controller extends Descriptor {
}
loadData() {
const filter = {
include: [
{
relation: 'user',
scope: {
fields: ['name', 'emailVerified'],
include: {
relation: 'emailUser',
scope: {
fields: ['email']
}
}
}
}, {
relation: 'client',
scope: {
fields: ['fi']
}
}, {
relation: 'sip',
scope: {
fields: ['extension']
}
}, {
relation: 'department',
scope: {
include: {
relation: 'department'
}
}
}
]
};
return this.getData(`Workers/${this.id}`, {filter})
.then(res => this.entity = res.data);
return this.getData('Workers/descriptor', {filter: {where: {id: this.id}}})
.then(res => this.entity = res.data[0]);
}
getPassRequirements() {

View File

@ -14,14 +14,14 @@ describe('vnWorkerDescriptor', () => {
describe('loadData()', () => {
it(`should perform a get query to store the worker data into the controller`, () => {
const id = 1;
const response = 'foo';
const response = ['foo'];
$httpBackend.whenGET('UserConfigs/getUserConfig').respond({});
$httpBackend.expectRoute('GET', `Workers/${id}`).respond(response);
$httpBackend.expectRoute('GET', 'Workers/descriptor').respond(response);
controller.id = id;
$httpBackend.flush();
expect(controller.worker).toEqual(response);
expect(controller.worker).toEqual(response[0]);
});
});