change travel.agencyFk by agencyModeFk
This commit is contained in:
parent
d7ca5a8247
commit
fdf6e04233
|
@ -1340,7 +1340,7 @@ INSERT INTO `vn`.`ticketWeekly`(`ticketFk`, `weekDay`)
|
|||
(4, 4),
|
||||
(5, 6);
|
||||
|
||||
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`)
|
||||
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`)
|
||||
VALUES
|
||||
(1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1),
|
||||
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150, 2000, 'second travel', 2, 2),
|
||||
|
|
|
@ -38642,26 +38642,29 @@ CREATE TABLE `travel` (
|
|||
`warehouseInFk` smallint(6) unsigned DEFAULT NULL,
|
||||
`warehouseOutFk` smallint(6) unsigned DEFAULT NULL,
|
||||
`agencyFk` int(11) DEFAULT NULL,
|
||||
`ref` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`isDelivered` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`isReceived` tinyint(1) NOT NULL DEFAULT '0',
|
||||
`agencyModeFk` int(11) DEFAULT NULL,
|
||||
`ref` varchar(20) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`isDelivered` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`isReceived` tinyint(1) NOT NULL DEFAULT 0,
|
||||
`m3` decimal(10,2) unsigned DEFAULT NULL,
|
||||
`kg` decimal(10,0) unsigned DEFAULT NULL,
|
||||
`cargoSupplierFk` int(11) DEFAULT NULL,
|
||||
`totalEntries` tinyint(4) unsigned DEFAULT '0',
|
||||
`totalEntries` tinyint(4) unsigned DEFAULT 0,
|
||||
`appointment` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `shipment_2` (`shipped`,`landed`,`warehouseInFk`,`warehouseOutFk`,`agencyFk`,`ref`),
|
||||
UNIQUE KEY `shipment_1` (`shipped`,`landed`,`warehouseInFk`,`warehouseOutFk`,`agencyFk`,`agencyModeFk`,`ref`),
|
||||
KEY `agency_id` (`agencyFk`),
|
||||
KEY `shipment` (`shipped`),
|
||||
KEY `landing` (`landed`),
|
||||
KEY `warehouse_landing` (`warehouseInFk`,`landed`),
|
||||
KEY `warehouse_out_shipment` (`warehouseOutFk`,`shipped`),
|
||||
KEY `travel_ibfk_4_idx` (`cargoSupplierFk`),
|
||||
KEY `travel_FK` (`agencyModeFk`),
|
||||
CONSTRAINT `travel_FK` FOREIGN KEY (`agencyModeFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `travel_ibfk_1` FOREIGN KEY (`warehouseInFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `travel_ibfk_2` FOREIGN KEY (`warehouseOutFk`) REFERENCES `warehouse` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `travel_ibfk_3` FOREIGN KEY (`agencyFk`) REFERENCES `agencyMode` (`id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDBDEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=195614 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci ROW_FORMAT=DYNAMIC;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
|
||||
|
@ -38677,6 +38680,15 @@ DELIMITER ;;
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
CALL travel_checkDates(NEW.shipped, NEW.landed);
|
||||
|
||||
-- Actualizar agencyFk y agencyModeFk
|
||||
IF NEW.agencyFk THEN
|
||||
SET NEW.agencyModeFk = NEW.agencyFk;
|
||||
END IF;
|
||||
|
||||
IF NEW.agencyModeFk THEN
|
||||
SET NEW.agencyFk = NEW.agencyModeFk;
|
||||
END IF;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -38700,6 +38712,15 @@ BEGIN
|
|||
OR !(NEW.shipped <=> OLD.shipped) THEN
|
||||
CALL travel_checkDates(NEW.shipped, NEW.landed);
|
||||
END IF;
|
||||
|
||||
-- Actualizar agencyFk y agencyModeFk
|
||||
IF !(NEW.agencyFk <=> OLD.agencyFk)THEN
|
||||
SET NEW.agencyModeFk = NEW.agencyFk;
|
||||
END IF;
|
||||
|
||||
IF !(NEW.agencyModeFk <=> OLD.agencyModeFk) THEN
|
||||
SET NEW.agencyFk = NEW.agencyModeFk;
|
||||
END IF;
|
||||
END */;;
|
||||
DELIMITER ;
|
||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||
|
@ -46762,7 +46783,7 @@ BEGIN
|
|||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
JOIN travel tr ON tr.id = e.travelFk
|
||||
JOIN agencyMode am ON am.id = tr.agencyFk
|
||||
JOIN agencyMode am ON am.id = tr.agencyModeFk
|
||||
JOIN tmp.rate r
|
||||
SET b.freightValue = @PF:=
|
||||
ROUND(IFNULL(((am.m3 * @cm3:= item_getVolume(b.itemFk, b.packageFk)) / 1000000) / b.packing,0),3),
|
||||
|
@ -72251,7 +72272,7 @@ BEGIN
|
|||
END;
|
||||
|
||||
START TRANSACTION;
|
||||
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyFk, `ref`, isDelivered, isReceived, m3, kg)
|
||||
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, kg)
|
||||
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3, kg
|
||||
FROM travel
|
||||
WHERE id = vTravelFk;
|
||||
|
|
|
@ -29,7 +29,7 @@ describe('Entry descriptor path', () => {
|
|||
it('should click the travels button to be redirected to the travels index filtered by the current agency', async() => {
|
||||
await page.waitToClick(selectors.entryDescriptor.travelsQuicklink);
|
||||
await page.expectURL('/travel/index');
|
||||
await page.expectURL('agencyFk');
|
||||
await page.expectURL('agencyModeFk');
|
||||
});
|
||||
|
||||
it('should go back to the entry summary', async() => {
|
||||
|
|
|
@ -43,7 +43,7 @@ module.exports = Self => {
|
|||
'name',
|
||||
'shipped',
|
||||
'landed',
|
||||
'agencyFk',
|
||||
'agencyModeFk',
|
||||
'warehouseOutFk',
|
||||
'warehouseInFk',
|
||||
'isReceived',
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
<vn-horizontal>
|
||||
<vn-autocomplete
|
||||
label="Agency"
|
||||
ng-model="$ctrl.travelFilterParams.agencyFk"
|
||||
ng-model="$ctrl.travelFilterParams.agencyModeFk"
|
||||
url="AgencyModes"
|
||||
show-field="name"
|
||||
value-field="id">
|
||||
|
|
|
@ -46,7 +46,7 @@ class Controller extends Section {
|
|||
if (!value) continue;
|
||||
|
||||
switch (key) {
|
||||
case 'agencyFk':
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseInFk':
|
||||
case 'warehouseOutFk':
|
||||
case 'shipped':
|
||||
|
|
|
@ -14,7 +14,7 @@ class Controller extends ModuleCard {
|
|||
{
|
||||
relation: 'travel',
|
||||
scope: {
|
||||
fields: ['id', 'landed', 'agencyFk', 'warehouseOutFk'],
|
||||
fields: ['id', 'landed', 'agencyModeFk', 'warehouseOutFk'],
|
||||
include: [
|
||||
{
|
||||
relation: 'agency',
|
||||
|
|
|
@ -14,9 +14,9 @@ class Controller extends Descriptor {
|
|||
let travelFilter;
|
||||
const entryTravel = this.entry && this.entry.travel;
|
||||
|
||||
if (entryTravel && entryTravel.agencyFk) {
|
||||
if (entryTravel && entryTravel.agencyModeFk) {
|
||||
travelFilter = this.entry && JSON.stringify({
|
||||
agencyFk: entryTravel.agencyFk
|
||||
agencyModeFk: entryTravel.agencyModeFk
|
||||
});
|
||||
}
|
||||
return travelFilter;
|
||||
|
@ -49,7 +49,7 @@ class Controller extends Descriptor {
|
|||
{
|
||||
relation: 'travel',
|
||||
scope: {
|
||||
fields: ['id', 'landed', 'agencyFk', 'warehouseOutFk'],
|
||||
fields: ['id', 'landed', 'agencyModeFk', 'warehouseOutFk'],
|
||||
include: [
|
||||
{
|
||||
relation: 'agency',
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
|||
'landed',
|
||||
'warehouseInFk',
|
||||
'warehouseOutFk',
|
||||
'agencyFk',
|
||||
'agencyModeFk',
|
||||
'ref'
|
||||
]
|
||||
});
|
||||
|
@ -56,7 +56,7 @@ module.exports = Self => {
|
|||
travel.warehouseOutFk,
|
||||
travel.warehouseInFk,
|
||||
travel.ref,
|
||||
travel.agencyFk
|
||||
travel.agencyModeFk
|
||||
]
|
||||
);
|
||||
stmts.push(stmt);
|
||||
|
@ -76,7 +76,7 @@ module.exports = Self => {
|
|||
'landed',
|
||||
'warehouseInFk',
|
||||
'warehouseOutFk',
|
||||
'agencyFk',
|
||||
'agencyModeFk',
|
||||
'ref'
|
||||
]
|
||||
});
|
||||
|
|
|
@ -34,7 +34,7 @@ module.exports = Self => {
|
|||
description: 'The landed to date filter'
|
||||
},
|
||||
{
|
||||
arg: 'agencyFk',
|
||||
arg: 'agencyModeFk',
|
||||
type: 'number',
|
||||
description: 'The agencyModeFk id'
|
||||
},
|
||||
|
@ -96,7 +96,7 @@ module.exports = Self => {
|
|||
case 'continent':
|
||||
return {'cnt.code': value};
|
||||
case 'id':
|
||||
case 'agencyFk':
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseOutFk':
|
||||
case 'warehouseInFk':
|
||||
case 'totalEntries':
|
||||
|
@ -143,7 +143,7 @@ module.exports = Self => {
|
|||
JOIN warehouse wo ON wo.id = t.warehouseOutFk
|
||||
JOIN country c ON c.id = wo.countryFk
|
||||
LEFT JOIN continent cnt ON cnt.id = c.continentFk
|
||||
JOIN agencyMode am ON am.id = t.agencyFk`
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk`
|
||||
);
|
||||
|
||||
stmt.merge(conn.makeWhere(filter.where));
|
||||
|
|
|
@ -44,7 +44,7 @@ module.exports = Self => {
|
|||
description: 'The landed to date filter',
|
||||
http: {source: 'query'}
|
||||
}, {
|
||||
arg: 'agencyFk',
|
||||
arg: 'agencyModeFk',
|
||||
type: 'number',
|
||||
description: 'The agencyModeFk id',
|
||||
http: {source: 'query'}
|
||||
|
@ -102,7 +102,7 @@ module.exports = Self => {
|
|||
case 'landedTo':
|
||||
return {'t.landed': {lte: value}};
|
||||
case 'id':
|
||||
case 'agencyFk':
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseOutFk':
|
||||
case 'warehouseInFk':
|
||||
case 'totalEntries':
|
||||
|
@ -124,7 +124,7 @@ module.exports = Self => {
|
|||
t.landed,
|
||||
t.warehouseInFk,
|
||||
t.warehouseOutFk,
|
||||
t.agencyFk,
|
||||
t.agencyModeFk,
|
||||
t.ref,
|
||||
t.isDelivered,
|
||||
t.isReceived,
|
||||
|
@ -137,7 +137,7 @@ module.exports = Self => {
|
|||
wout.name warehouseOutName,
|
||||
cnt.code continent
|
||||
FROM vn.travel t
|
||||
JOIN vn.agencyMode am ON am.id = t.agencyFk
|
||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
||||
JOIN vn.warehouse win ON win.id = t.warehouseInFk
|
||||
JOIN vn.warehouse wout ON wout.id = t.warehouseOutFk
|
||||
JOIN warehouse wo ON wo.id = t.warehouseOutFk
|
||||
|
|
|
@ -32,9 +32,9 @@ module.exports = Self => {
|
|||
t.warehouseOutFk,
|
||||
t.landed,
|
||||
t.shipped,
|
||||
t.agencyFk
|
||||
t.agencyModeFk
|
||||
FROM travel t
|
||||
WHERE t.agencyFk = ? LIMIT 50)`, [agencyModeFk]);
|
||||
WHERE t.agencyModeFk = ? LIMIT 50)`, [agencyModeFk]);
|
||||
stmts.push(stmt);
|
||||
|
||||
stmt = new ParameterizedSQL(`
|
||||
|
@ -44,10 +44,10 @@ module.exports = Self => {
|
|||
t.warehouseOutFk,
|
||||
(SELECT ROUND(AVG(DATEDIFF(t.landed, t.shipped )))
|
||||
FROM tmp.travel t
|
||||
WHERE t.agencyFk
|
||||
WHERE t.agencyModeFk
|
||||
ORDER BY id DESC LIMIT 50) AS dayDuration
|
||||
FROM tmp.travel t
|
||||
WHERE t.agencyFk
|
||||
WHERE t.agencyModeFk
|
||||
ORDER BY t.id DESC LIMIT 1`);
|
||||
|
||||
const avgDaysIndex = stmts.push(stmt) - 1;
|
||||
|
|
|
@ -71,7 +71,7 @@ describe('Travel cloneWithEntries()', () => {
|
|||
expect(newTravel.ref).toEqual('fifth travel');
|
||||
expect(newTravel.warehouseInFk).toEqual(warehouseThree);
|
||||
expect(newTravel.warehouseOutFk).toEqual(warehouseThree);
|
||||
expect(newTravel.agencyFk).toEqual(agencyModeOne);
|
||||
expect(newTravel.agencyModeFk).toEqual(agencyModeOne);
|
||||
expect(travelEntries.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -70,10 +70,10 @@ describe('Travel extraCommunityFilter()', () => {
|
|||
expect(result.length).toEqual(3);
|
||||
});
|
||||
|
||||
it('should return the travel matching "agencyFk"', async() => {
|
||||
it('should return the travel matching "agencyModeFk"', async() => {
|
||||
const ctx = {
|
||||
args: {
|
||||
agencyFk: 1
|
||||
agencyModeFk: 1
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -44,17 +44,14 @@
|
|||
"type": "number"
|
||||
},
|
||||
"agencyModeFk": {
|
||||
"type": "number",
|
||||
"mysql": {
|
||||
"columnName": "agencyFk"
|
||||
}
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"agency": {
|
||||
"type": "belongsTo",
|
||||
"model": "AgencyMode",
|
||||
"foreignKey": "agencyFk"
|
||||
"foreignKey": "agencyModeFk"
|
||||
},
|
||||
"warehouseIn": {
|
||||
"type": "belongsTo",
|
||||
|
|
|
@ -25,7 +25,7 @@ class Controller extends Section {
|
|||
'shipped',
|
||||
'landed',
|
||||
'totalEntries',
|
||||
'agencyFk',
|
||||
'agencyModeFk',
|
||||
'warehouseInFk',
|
||||
'warehouseOutFk',
|
||||
'cargoSupplierFk'
|
||||
|
@ -64,7 +64,7 @@ class Controller extends Section {
|
|||
onCloneAccept() {
|
||||
const params = JSON.stringify({
|
||||
ref: this.travel.ref,
|
||||
agencyModeFk: this.travel.agencyFk,
|
||||
agencyModeFk: this.travel.agencyModeFk,
|
||||
shipped: this.travel.shipped,
|
||||
landed: this.travel.landed,
|
||||
warehouseInFk: this.travel.warehouseInFk,
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('Travel Component vnTravelDescriptorMenu', () => {
|
|||
|
||||
controller.travel = {
|
||||
ref: 'the ref',
|
||||
agencyFk: 'the agency',
|
||||
agencyModeFk: 'the agency',
|
||||
shipped: 'the shipped date',
|
||||
landed: 'the landing date',
|
||||
warehouseInFk: 'the receiver warehouse',
|
||||
|
@ -29,7 +29,7 @@ describe('Travel Component vnTravelDescriptorMenu', () => {
|
|||
|
||||
const params = JSON.stringify({
|
||||
ref: controller.travel.ref,
|
||||
agencyModeFk: controller.travel.agencyFk,
|
||||
agencyModeFk: controller.travel.agencyModeFk,
|
||||
shipped: controller.travel.shipped,
|
||||
landed: controller.travel.landed,
|
||||
warehouseInFk: controller.travel.warehouseInFk,
|
||||
|
|
|
@ -14,9 +14,9 @@ class Controller extends Descriptor {
|
|||
let travelFilter;
|
||||
const travel = this.travel;
|
||||
|
||||
if (travel && travel.agencyFk) {
|
||||
if (travel && travel.agencyModeFk) {
|
||||
travelFilter = this.travel && JSON.stringify({
|
||||
agencyFk: this.travel.agencyFk
|
||||
agencyModeFk: this.travel.agencyModeFk
|
||||
});
|
||||
}
|
||||
return travelFilter;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</vn-textfield>
|
||||
<vn-autocomplete vn-one
|
||||
label="Agency"
|
||||
ng-model="filter.agencyFk"
|
||||
ng-model="filter.agencyModeFk"
|
||||
url="AgencyModes"
|
||||
show-field="name"
|
||||
value-field="id">
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<vn-tr>
|
||||
<vn-th field="id" number filter-enabled="false">Id</vn-th>
|
||||
<vn-th field="ref">Reference</vn-th>
|
||||
<vn-th field="agencyFk">Agency</vn-th>
|
||||
<vn-th field="agencyModeFk">Agency</vn-th>
|
||||
<vn-th field="warehouseOutFk">Warehouse Out</vn-th>
|
||||
<vn-th field="shipped" center shrink-date>Shipped</vn-th>
|
||||
<vn-th field="isDelivered" center>Delivered</vn-th>
|
||||
|
|
|
@ -10,7 +10,7 @@ export default class Controller extends Section {
|
|||
onCloneAccept(travel) {
|
||||
const params = JSON.stringify({
|
||||
ref: travel.ref,
|
||||
agencyModeFk: travel.agencyFk,
|
||||
agencyModeFk: travel.agencyModeFk,
|
||||
shipped: travel.shipped,
|
||||
landed: travel.landed,
|
||||
warehouseInFk: travel.warehouseInFk,
|
||||
|
@ -44,7 +44,7 @@ export default class Controller extends Section {
|
|||
case 'landed':
|
||||
return {'t.landed': {between: this.dateRange(value)}};
|
||||
case 'id':
|
||||
case 'agencyFk':
|
||||
case 'agencyModeFk':
|
||||
case 'warehouseOutFk':
|
||||
case 'warehouseInFk':
|
||||
case 'totalEntries':
|
||||
|
|
|
@ -35,11 +35,11 @@ describe('Travel Component vnTravelIndex', () => {
|
|||
|
||||
const travel = {
|
||||
ref: 1,
|
||||
agencyFk: 1
|
||||
agencyModeFk: 1
|
||||
};
|
||||
const travelParams = {
|
||||
ref: travel.ref,
|
||||
agencyModeFk: travel.agencyFk
|
||||
agencyModeFk: travel.agencyModeFk
|
||||
};
|
||||
const queryParams = JSON.stringify(travelParams);
|
||||
controller.onCloneAccept(travel);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</vn-textfield>
|
||||
<vn-autocomplete vn-one
|
||||
label="Agency"
|
||||
ng-model="filter.agencyFk"
|
||||
ng-model="filter.agencyModeFk"
|
||||
url="AgencyModes"
|
||||
show-field="name"
|
||||
value-field="id">
|
||||
|
|
Loading…
Reference in New Issue