- fix RIS in pendenti, se troppi msg, non compariva piu

- cataloghi, ricerca pickup
This commit is contained in:
Surya Paolo
2024-05-09 23:36:46 +02:00
parent 54443e784e
commit 3b1b2b9c83
13 changed files with 296 additions and 94 deletions

View File

@@ -461,7 +461,7 @@ router.post('/import', authenticate, async (req, res) => {
name: arrrecauthor[i].trim()
}
if (arrrecauthor.length > i + 1) {
surname = arrrecauthor[i + 1].trim()
author.surname = arrrecauthor[i + 1].trim()
}
arrAuthor.push(author);
} catch (e) {
@@ -513,18 +513,22 @@ router.post('/import', authenticate, async (req, res) => {
}
}
if (productInfo.publisher) {
publisher = productInfo.publisher.trim();
// Cerca la Sotto Categoria
let recpublisher = await Publisher.findOne({ idapp, name: publisher }).lean();
if (!recpublisher) {
// Non esiste questo Editore, quindi la creo !
recpublisher = new Publisher({ idapp, name: publisher });
ris = await recpublisher.save();
recpublisher = await Publisher.findOne({ idapp, name: publisher }).lean();
}
try {
publisher = productInfo.publisher.trim();
// Cerca la Sotto Categoria
let recpublisher = await Publisher.findOne({ idapp, name: publisher }).lean();
if (!recpublisher) {
// Non esiste questo Editore, quindi la creo !
recpublisher = new Publisher({ idapp, name: publisher });
ris = await recpublisher.save();
recpublisher = await Publisher.findOne({ idapp, name: publisher }).lean();
}
if (recpublisher) {
productInfo.idPublisher.push(recpublisher._id);
if (recpublisher) {
productInfo.idPublisher = recpublisher._id;
}
} catch (e) {
console.error(e);
}
}