feat itemShelvingSale refs #6861 #2729

Merged
sergiodt merged 3 commits from 6861_reservas_gettickets into master 2024-07-15 10:34:41 +00:00
3 changed files with 10 additions and 11 deletions
Showing only changes of commit 00a1a84205 - Show all commits

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))