Compare commits
6 Commits
dev
...
2687_trave
Author | SHA1 | Date |
---|---|---|
Javier Segarra | 94503c803e | |
Javier Segarra | a97b3afe98 | |
Javier Segarra | edcd9baca7 | |
Javier Segarra | f368395912 | |
Carlos Satorres | 5d876deff5 | |
Carlos Satorres | 7e18bd0a12 |
|
@ -27,7 +27,7 @@ BEGIN
|
||||||
DECLARE vEvaNotes VARCHAR(255);
|
DECLARE vEvaNotes VARCHAR(255);
|
||||||
DECLARE vDone BOOL;
|
DECLARE vDone BOOL;
|
||||||
DECLARE vAuxEntryFk INT;
|
DECLARE vAuxEntryFk INT;
|
||||||
DECLARE vTx BOOLEAN DEFAULT !@@in_transaction;
|
DECLARE vTx BOOLEAN DEFAULT @@in_transaction;
|
||||||
DECLARE vRsEntry CURSOR FOR
|
DECLARE vRsEntry CURSOR FOR
|
||||||
SELECT e.id
|
SELECT e.id
|
||||||
FROM entry e
|
FROM entry e
|
||||||
|
@ -41,9 +41,10 @@ BEGIN
|
||||||
CALL util.tx_rollback(vTx);
|
CALL util.tx_rollback(vTx);
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
IF !vTx THEN
|
||||||
|
SET vTx = TRUE;
|
||||||
CALL util.tx_start(vTx);
|
CALL util.tx_start(vTx);
|
||||||
|
END IF;
|
||||||
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
|
INSERT INTO travel (shipped, landed, warehouseInFk, warehouseOutFk, agencyModeFk, `ref`, isDelivered, isReceived, m3, cargoSupplierFk, kg,clonedFrom)
|
||||||
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
|
SELECT vDateStart, vDateEnd, vWarehouseInFk, vWarehouseOutFk, vAgencyModeFk, vRef, isDelivered, isReceived, m3,cargoSupplierFk, kg,vTravelFk
|
||||||
FROM travel
|
FROM travel
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
label="Vehicle"
|
label="Vehicle"
|
||||||
ng-model="$ctrl.route.vehicleFk"
|
ng-model="$ctrl.route.vehicleFk"
|
||||||
url="Vehicles"
|
url="Vehicles"
|
||||||
where="{warehouseFk: $ctrl.vnConfig.warehouseFk}"
|
|
||||||
show-field="numberPlate">
|
show-field="numberPlate">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('Travel cloneWithEntries()', () => {
|
||||||
travelFk: newTravelId
|
travelFk: newTravelId
|
||||||
}
|
}
|
||||||
}, options);
|
}, options);
|
||||||
const newTravel = await models.Travel.findById(travelId);
|
const newTravel = await models.Travel.findById(travelId, options);
|
||||||
|
|
||||||
expect(newTravelId).not.toEqual(travelId);
|
expect(newTravelId).not.toEqual(travelId);
|
||||||
expect(newTravel.ref).toEqual('fifth travel');
|
expect(newTravel.ref).toEqual('fifth travel');
|
||||||
|
@ -27,9 +27,15 @@ describe('Travel cloneWithEntries()', () => {
|
||||||
expect(newTravel.warehouseOutFk).toEqual(warehouseThree);
|
expect(newTravel.warehouseOutFk).toEqual(warehouseThree);
|
||||||
expect(newTravel.agencyModeFk).toEqual(agencyModeOne);
|
expect(newTravel.agencyModeFk).toEqual(agencyModeOne);
|
||||||
expect(travelEntries.length).toBeGreaterThan(0);
|
expect(travelEntries.length).toBeGreaterThan(0);
|
||||||
|
await models.Entry.destroyAll({
|
||||||
|
travelFk: newTravelId
|
||||||
|
}, options);
|
||||||
|
await models.Travel.destroyById(newTravelId, options);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
const travelRemoved = await models.Travel.findById(newTravelId, options);
|
const travelRemoved = await models.Travel.findById(newTravelId);
|
||||||
|
const entries = await models.Entry.find();
|
||||||
|
|
||||||
|
expect(entries.length).toBeGreaterThan(0);
|
||||||
|
|
||||||
expect(travelRemoved).toBeNull();
|
expect(travelRemoved).toBeNull();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue