- fix invio annuncio Bene, funzioni di getCategoriaSkillByRec non prendevano idapp.

This commit is contained in:
Surya Paolo
2024-04-19 18:12:10 +02:00
parent 11955b3242
commit 68b4403138
3 changed files with 40 additions and 23 deletions

View File

@@ -4548,9 +4548,12 @@ module.exports = {
async getInCambioDiByRec(myrec) {
const { Contribtype } = require('../models/contribtype');
const contribtype = await Contribtype.findAllIdApp(idapp);
try {
const idapp = myrec.idapp;
if (!idapp)
return '';
const contribtype = await Contribtype.findAllIdApp(idapp);
let mystr = '';
for (const contribId of myrec.idContribType) {
const reccontr = contribtype.find((rec) => rec._id.toString() === contribId);
@@ -4570,9 +4573,12 @@ module.exports = {
async getStatusSkillByRec(myrec, onlyifNoDiPersona) {
const { StatusSkill } = require('../models/statusSkill');
const statusskill = await StatusSkill.findAllIdApp(idapp);
try {
const idapp = myrec.idapp;
if (!idapp)
return '';
const statusskill = await StatusSkill.findAllIdApp(idapp);
let mystr = '';
if (onlyifNoDiPersona) {
if ((myrec.idStatusSkill.length === 1) && (myrec.idStatusSkill[0] === shared_consts.STATUSSKILL_DI_PERSONA))
@@ -4606,10 +4612,16 @@ module.exports = {
const { Skill } = require('../models/skill');
const { Sector } = require('../models/sector');
const skillrec = await Skill.findAllIdApp(idapp);
const sectorrec = await Sector.findAllIdApp(idapp);
try {
// console.log('myrec', myrec);
const idapp = myrec.idapp;
if (!idapp)
return '';
const skillrec = await Skill.findAllIdApp(idapp);
const sectorrec = await Sector.findAllIdApp(idapp);
let mystr = '';
const recsec = sectorrec.find((rec) => rec._id === myrec.idSector);
if (recsec) {
@@ -4629,9 +4641,13 @@ module.exports = {
// const { Good } = require('../models/good');
// const goodrec = await Good.findAllIdApp(idapp);
const secgoodrec = await SectorGood.findAllIdApp(idapp);
try {
const idapp = myrec.idapp;
if (!idapp)
return '';
const secgoodrec = await SectorGood.findAllIdApp(idapp);
let mystr = '';
const rec = secgoodrec.find((rec) => rec._id === myrec.idSectorGood);
// const rec = goodrec.find((rec) => rec._id === myrec.idSectorGood);