Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into 6861_reservas_retro
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Sergio De la torre 2024-07-15 12:37:40 +02:00
commit 81cd508784
6 changed files with 142 additions and 138 deletions

View File

@ -75,7 +75,7 @@ proc: BEGIN
UPDATE sale
SET quantity = vTotalReservedQuantity
WHERE id = vSaleFk;
END IF
END IF;
LEAVE l;
END IF;

View File

@ -19,8 +19,7 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
(saleFk INT PRIMARY KEY)
SELECT
s.ticketFk,
SELECT s.ticketFk,
s.id saleFk,
s.itemFk,
s.concept,
@ -29,7 +28,7 @@ BEGIN
pb.routeFk,
FLOOR(s.quantity / IF(i.isBoxPickingMode, ish.packing, i.packingOut)) stickers,
IF(i.isBoxPickingMode, ish.packing, i.packingOut) packing,
b.packagingFk
IF(pa.isPackageReturnable, pc.defaultBigPackageFk, b.packagingFk) packagingFk
FROM sale s
JOIN item i ON i.id = s.itemFk
JOIN itemShelving ish ON ish.itemFk = s.itemFk
@ -52,6 +51,8 @@ BEGIN
LEFT JOIN ticketState ts ON ts.ticketFk = s.ticketFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
LEFT JOIN buy b ON b.id = lb.buy_id
LEFT JOIN packaging pa ON pa.id = b.packagingFk
JOIN packagingConfig pc
WHERE IF(i.isBoxPickingMode, ish.packing, i.packingOut)
<= LEAST(s.quantity, ish.visible - IFNULL(tISS.reserve,0))
AND NOT pb.problem

View File

@ -64,8 +64,12 @@ BEGIN
(SELECT vCurTicketFk, p.id, COUNT(*)
FROM expedition e
JOIN packaging p ON p.id = e.packagingFk
JOIN ticket t ON t.id = e.ticketFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
WHERE e.ticketFk = vCurTicketFk AND p.isPackageReturnable
AND vWithPackage
AND NOT dm.`code`= 'PICKUP'
GROUP BY p.itemFk);
-- No retornables o no catalogados

View File

@ -53,7 +53,7 @@
<vn-autocomplete vn-one
ng-model="$ctrl.location.countryFk"
url="Countries"
show-field="country"
show-field="name"
value-field="id"
label="Country">
</vn-autocomplete>

View File

@ -171,8 +171,8 @@ module.exports = Self => {
const address = await models.Address.create({
clientFk: user.id,
street: street,
city: city,
provinceFk: provinceFk,
city,
provinceFk,
postalCode: postcode,
mobile: phone,
nickname: nickname,
@ -193,7 +193,9 @@ module.exports = Self => {
}
await user.updateAttribute('email', email, myOptions);
const {countryFk} = await Self.app.models.Province.findById(provinceFk, {
fields: ['countryFk']
});
await models.Worker.create({
id: user.id,
firstName,
@ -202,6 +204,7 @@ module.exports = Self => {
bossFk,
fi,
birth,
originCountryFk: countryFk
}, myOptions);
@ -212,11 +215,8 @@ module.exports = Self => {
const message = e.sqlMessage;
if (e.message && e.message.includes(`Email already exists`)) throw new UserError(`This personal mail already exists`);
if (code === 'ER_DUP_ENTRY' && message.includes(`CodigoTrabajador_UNIQUE`)) throw new UserError(`This worker code already exists`);
if (code === 'ER_DUP_ENTRY' && message.includes(`PRIMARY`)) throw new UserError(`This worker already exists`);
throw e;
}

View File

@ -27,11 +27,10 @@ module.exports = Self => {
});
async function tinIsValid(err, done) {
const filter = {
const country = await Self.app.models.Country.findOne({
fields: ['code'],
where: {id: this.countryFk}
};
const country = await Self.app.models.Country.findOne(filter);
where: {id: this.originCountryFk}
});
const code = country ? country.code.toLowerCase() : null;
if (!this.fi || !validateTin(this.fi, code))