diff --git a/logtrans.txt b/logtrans.txt index 3c92b7d..93b297f 100644 --- a/logtrans.txt +++ b/logtrans.txt @@ -483,4 +483,9 @@ Dom 23/03 ORE 22:24: [Circuito RIS Italia]: Inviate Monete da surya1977 a Saldi: surya1977: 88.20 RIS] -GruppoYurta: 6.00 RIS] \ No newline at end of file +GruppoYurta: 6.00 RIS] +Ven 03/10 ORE 15:03: [Euro]: Inviate Monete da paoloar77 a piuchebuono 6 € [causale: Pagato Ordine n.442] + +Saldi: +paoloar77: -312.80 €] +piuchebuono: 10552.82 €] \ No newline at end of file diff --git a/src/server/models/cart.js b/src/server/models/cart.js index 995bee3..b796e41 100755 --- a/src/server/models/cart.js +++ b/src/server/models/cart.js @@ -144,22 +144,27 @@ async function filterValidItems(mycart) { mycart.newitems = []; let haschanged = false; for (let item of mycart.items) { - if ( - item.order && - item.order.hasOwnProperty('idapp') && - (item.order.quantity > 0 || item.order.quantitypreordered > 0) && - (await checkIfExistProduct(item.order.product.productInfo.code)) - ) { - mycart.newitems.push(item); - } else { - const Order = require('./order'); - const OrdersCart = require('./orderscart'); + try { + if ( + item.order && + item.order.hasOwnProperty('idapp') && + item.order.product.productInfo && + (item.order.quantity > 0 || item.order.quantitypreordered > 0) && + (await checkIfExistProduct(item.order.product.productInfo.code)) + ) { + mycart.newitems.push(item); + } else { + const Order = require('./order'); + const OrdersCart = require('./orderscart'); - // Cancella l'ordine su Order e OrderCart e cancella il record su Cart - await OrdersCart.deleteOrderById(item.order._id.toString()); - await Order.deleteOrderById(item.order._id.toString()); + // Cancella l'ordine su Order e OrderCart e cancella il record su Cart + await OrdersCart.deleteOrderById(item.order._id.toString()); + await Order.deleteOrderById(item.order._id.toString()); - haschanged = true; + haschanged = true; + } + } catch (e) { + console.log('err', e); } } mycart.items = [...mycart.newitems]; diff --git a/src/server/models/order.js b/src/server/models/order.js index 10eaab9..83b8ba9 100755 --- a/src/server/models/order.js +++ b/src/server/models/order.js @@ -329,7 +329,7 @@ module.exports.updateTotals = async function (order, codice_sconto) { module.exports.getTotalOrderById = async function (id) { const query = [ - { $match: { _id: new ObjectId(id) } }, + { $match: { _id: new mongoose.Types.ObjectId(id) } }, { $lookup: { from: 'products', diff --git a/src/server/models/orderscart.js b/src/server/models/orderscart.js index 5f7f71c..faec50c 100755 --- a/src/server/models/orderscart.js +++ b/src/server/models/orderscart.js @@ -204,7 +204,7 @@ module.exports.getRecCartByUserId = async function (uid, idapp, numorder) { module.exports.getOrdersCartById = async function (id) { - let query = { _id: new ObjectId(id) }; + let query = { _id: new mongoose.Types.ObjectId(id) }; const arrris = await OrdersCart.getOrdersCartByQuery(query); let myrec = arrris && arrris.length > 0 ? arrris[0] : null; @@ -274,13 +274,6 @@ module.exports.getOrdersCartByQuery = async function (query) { order.items = order.items.map(item => { if (item.order) { try { - if (item.order.idProduct) { - item.order.idProduct.productInfo = item.order.idProduct.productInfo ? item.order.idProduct.productInfo : { ...item.order.idProduct.idProductInfo }; - item.order.idProduct.productInfo.unitstr = tools.getUnitsMeasure(item.order.idProduct.productInfo.unit, true); - // item.order.idProduct.idProductInfo = item.order.idProduct.productInfo ? item.order.idProduct.productInfo._id : ''; - } - const myid = item.order._id; - // console.log('ID ORD', order.numorder, myid, order.user.name); item.order.product = { ...item.order.idProduct }; item.order.idProduct = item.order.product ? item.order.product._id : ''; item.order.producer = item.order.idProducer; diff --git a/src/server/models/product.js b/src/server/models/product.js index 183bb36..1ce9bbd 100755 --- a/src/server/models/product.js +++ b/src/server/models/product.js @@ -308,6 +308,7 @@ const productSchema = new Schema({ maxBookableSinglePersQty: { // quantità massima Pre-ordinabile (singolarmente) type: Number, + default: 1, }, stockQty: { // in magazzino @@ -318,6 +319,7 @@ const productSchema = new Schema({ stockBloccatiQty: { // Prenotati Bloccati type: Number, + default: 0, }, bookedQtyOrdered: { // Quantità Prenotate ordinate (in Lavorazione) @@ -326,12 +328,14 @@ const productSchema = new Schema({ bookedQtyConfirmed: { // Quantità Prenotate Confermate Totali type: Number, + default: 0, }, // GAS: qtyToReachForGas: { // Quantità minima da raggiungere per fare l'ordine GAS type: Number, + default: 0, }, maxbookableGASQty: { // Quantità massima (ancora disponibile) Ordine GAS prenotabile (Complessivamente tra tutti gli ordini) @@ -341,10 +345,12 @@ const productSchema = new Schema({ bookedGASQtyOrdered: { // Quantità Ordine GAS Prenotate Totali type: Number, + default: 0, }, bookedGASQtyConfirmed: { // Quantità Ordine GAS Confermate Totali type: Number, + default: 0, }, bookableGASBloccatiQty: { // Quantità Prenotate Bloccate GAS @@ -354,6 +360,7 @@ const productSchema = new Schema({ quantityLow: { //Soglia disponibilità bassa type: Number, + default: 0, }, visibilityProductOutOfStock: { // Visibilità prodotto "esaurito" @@ -1173,7 +1180,7 @@ module.exports.singlerecconvert_AfterImport_AndSave = async function (idapp, pro } if (!tools.isObjectEmpty(objtoset)) { - ris = await Product.findOneAndUpdate({ _id: new ObjectId(prod._id) }, { $set: objtoset }); + ris = await Product.findOneAndUpdate({ _id: prod._id }, { $set: objtoset }); const objDelete = { cat_name: 1, @@ -1186,7 +1193,7 @@ module.exports.singlerecconvert_AfterImport_AndSave = async function (idapp, pro gas_name: 1, }; - ris = await Product.updateOne({ _id: new ObjectId(prod._id) }, { $unset: objDelete }); + ris = await Product.updateOne({ _id: prod._id }, { $unset: objDelete }); if (ris && ris.modifiedCount > 0) { console.log('Modificato: ', objtoset.name); diff --git a/src/server/modules/Cart.js b/src/server/modules/Cart.js index 2fe4b7e..02452ad 100755 --- a/src/server/modules/Cart.js +++ b/src/server/modules/Cart.js @@ -146,8 +146,11 @@ class Cart { } else { if (myorder.quantitypreordered === minqta) { step = minqta; + } else { + if (myorder.quantitypreordered - step < 0) { + step = myorder.quantitypreordered - step; + } } - step = myorder.quantity - stepΩ; } return step; } catch (e) { diff --git a/src/server/modules/Scraping.js b/src/server/modules/Scraping.js index e555e08..dea62ed 100644 --- a/src/server/modules/Scraping.js +++ b/src/server/modules/Scraping.js @@ -431,8 +431,8 @@ class AmazonBookScraper { }*/ } - if (product.idProductInfo) { - if (!tools.isDateValid(product.idProductInfo.date_pub)) { + if (product.productInfo) { + if (!tools.isDateValid(product.productInfo.date_pub)) { datimancanti = true; } } @@ -458,7 +458,7 @@ class AmazonBookScraper { } includiNelControlloIlRecProduct(product) { - return product.idProductInfo && [1, 4, 34, 45, 46].includes(product.idProductInfo.idStatoProdotto); + return product.productInfo && [1, 4, 34, 45, 46].includes(product.productInfo.idStatoProdotto); } async scrapeMultiple(products, options) { @@ -474,7 +474,7 @@ class AmazonBookScraper { if (this.includiNelControlloIlRecProduct(product)) { if (this.datiMancanti(product) || options.caricatutti) { - // console.log(`${quanti} / ${products.length} - Scraping: ${product.idProductInfo.name}`); + // console.log(`${quanti} / ${products.length} - Scraping: ${product.productInfo.name}`); const data = await this.scrapeISBN(product, isbn, options); if (data?.updated) { @@ -485,7 +485,7 @@ class AmazonBookScraper { if (i % 1 === 0) { const percentuale = ((i / products.length) * 100).toFixed(2); console.log( - `Scraping: ${product.isbn} - ${product.idProductInfo.name} - ${quanti} su ${i + 1} / ${ + `Scraping: ${product.isbn} - ${product.productInfo.name} - ${quanti} su ${i + 1} / ${ products.length } - [${percentuale}%] - ${this.getRemainingTimeToTheEnd(dataorainizio, i, products.length)}` ); @@ -615,9 +615,8 @@ class AmazonBookScraper { const headers = ['isbn', 'titolo', 'pagine', 'misure', 'edizione', 'date_pub' /*'sottotitolo'*/]; try { - // Trova i prodotti e popula 'idProductInfo' + // Trova i prodotti const products = await Product.find({ idapp, scraped_updated: true }) - .populate({ path: 'idProductInfo', select: 'date_pub name sottotitolo' }) .lean(); // Funzione per "appiattire" i dati @@ -634,10 +633,10 @@ class AmazonBookScraper { flattened.ristampa = variation.ristampa || ''; } - // Assicurati che 'idProductInfo' esista prima di usarlo - flattened.date_pub = item.idProductInfo ? item.idProductInfo.date_pub : ''; - flattened.titolo = item.idProductInfo ? item.idProductInfo.name : ''; - // flattened.sottotitolo = item.idProductInfo ? item.idProductInfo.sottotitolo : ''; + // Assicurati che 'productInfo' esista prima di usarlo + flattened.date_pub = item.productInfo ? item.productInfo.date_pub : ''; + flattened.titolo = item.productInfo ? item.productInfo.name : ''; + // flattened.sottotitolo = item.productInfo ? item.productInfo.sottotitolo : ''; return flattened; }); diff --git a/src/server/router/admin_router.js b/src/server/router/admin_router.js index f98b767..f6e7e7e 100755 --- a/src/server/router/admin_router.js +++ b/src/server/router/admin_router.js @@ -916,20 +916,14 @@ function fixURL(url) { return url.replace(/https:\//g, 'https://'); } -async function completaSettaggioProduct_AndProductInfo( - arrcampi_productInfo, - arrcampi_product, - rec, - product, - productInfo -) { +async function completaSettaggioProduct_AndProductInfo(arrcampi_productInfo, arrcampi_product, rec, product) { try { if (shared_consts.CAMPI_PRODUCTINFO_CONVERT.includes('weight_and_unit')) { if (rec.hasOwnProperty('weight_and_unit')) { const ris1 = tools.getWeightAndUnitByText(rec['weight_and_unit']); if (ris1) { - productInfo.weight = ris1.weight; - productInfo.unit = ris1.unit; + product.productInfo.weight = ris1.weight; + product.productInfo.unit = ris1.unit; } } } @@ -938,20 +932,20 @@ async function completaSettaggioProduct_AndProductInfo( if (rec.hasOwnProperty('weight_and_unit_lordo')) { const ris2 = tools.getWeightAndUnitByText(rec['weight_and_unit_lordo']); if (ris2) { - productInfo.weight_lordo = ris2.weight; - productInfo.unit_lordo = ris2.unit; + product.productInfo.weight_lordo = ris2.weight; + product.productInfo.unit_lordo = ris2.unit; } } } if (rec.hasOwnProperty('link_scheda')) { - if (fixURL(rec['link_scheda'])) productInfo['link_scheda'] = fixURL(rec['link_scheda']); + if (fixURL(rec['link_scheda'])) product.productInfo['link_scheda'] = fixURL(rec['link_scheda']); } for (const campo of shared_consts.PRODUCTINFO.CAMPI_FIRST_UPPERCASE) { if (rec.hasOwnProperty(campo)) { let mystr = tools.capitalize(rec[campo]).trim(); - if (mystr) productInfo[campo] = mystr; + if (mystr) product.productInfo[campo] = mystr; } } @@ -962,30 +956,30 @@ async function completaSettaggioProduct_AndProductInfo( } } - if (!rec.hasOwnProperty('img') && product.code) { - productInfo.imagefile = product.code + '.jpg'; + if (!rec.hasOwnProperty('img') && product.productInfo.code) { + product.productInfo.imagefile = product.productInfo.code + '.jpg'; } else { if (rec.hasOwnProperty('img')) { if (rec['img']) { - productInfo.imagefile = rec['img']; + product.productInfo.imagefile = rec['img']; } else { - productInfo.imagefile = ''; + product.productInfo.imagefile = ''; } } } if (rec.hasOwnProperty('productTypes')) { - productInfo.productTypes = productInfo.productTypes; + // product.productInfo.productTypes = product.productInfo.productTypes; } else { - productInfo.productTypes = [shared_consts.PRODUCTTYPE.PRODUCT]; + product.productInfo.productTypes = [shared_consts.PRODUCTTYPE.PRODUCT]; } - return { product, productInfo }; + return { product }; } catch (e) { console.error('Err', e); } - return { product, productInfo }; + return { product }; } function getValoriAndIndice(dati, arrinclude) { @@ -1023,13 +1017,11 @@ function getValoriAndIndice_Product(dati) { async function extractArrayDataFromCSV(idapp, rec) { try { // la prima riga contiene il nome della proprietà: - let productInfo = { - idapp: idapp, - idCatProds: [], - idSubCatProds: [], - }; - let product = { + productInfo: { + idCatProds: [], + idSubCatProds: [], + }, idapp, }; @@ -1041,7 +1033,7 @@ async function extractArrayDataFromCSV(idapp, rec) { const mykey = Object.keys(rec).find((key) => key.toLowerCase() === campoobj.name.toLowerCase()); if (mykey) { let myval = tools.ripulisciCampo(rec[mykey]); - productInfo[campoobj.name] = + product.productInfo[campoobj.name] = myval === 'TRUE' || myval.toUpperCase() === 'SI' ? true : myval === 'FALSE' || myval.toUpperCase() === 'NO' @@ -1054,13 +1046,16 @@ async function extractArrayDataFromCSV(idapp, rec) { if (rec.hasOwnProperty(campoobj)) product[campoobj] = rec[campoobj]; } - const ris = await completaSettaggioProduct_AndProductInfo( - arrcampi_productInfo, - arrcampi_product, - rec, - product, - productInfo - ); + for (const campoconvertiti of shared_consts.CONVERTI_CAMPO) { + if (rec.hasOwnProperty(campoconvertiti.convertito)) { + product[campoconvertiti.originale] = rec[campoconvertiti.convertito]; + } + } + + // Se trovi questi campi, li converti + + + const ris = await completaSettaggioProduct_AndProductInfo(arrcampi_productInfo, arrcampi_product, rec, product); /* // code: product.code, @@ -1209,50 +1204,50 @@ router.post('/import', authenticate, async (req, res) => { let numprod = dataObjects.length; - for (const product of dataObjects) { + for (const productImported of dataObjects) { let isnuovo = false; let setta = false; let importa = true; - if (!product.code) importa = false; + if (!productImported.code) importa = false; if (importa) { let productInfo = { - idapp: product.idapp, - code: product.code, + idapp: productImported.idapp, + code: productImported.code, }; const myproduct = await Product.findOne({ 'productInfo.code': productInfo.code }); // IMPOSTA I VALORI SOLO SE NON ESISTONO ! ALTRIMENTI LASCIA QUELLI GIA' IMPORTATI (O MODIFICATI) - if (getvalueByJsonText(product.url)) { + if (getvalueByJsonText(productImported.url)) { if ((myproduct && !myproduct.productInfo.link_macro) || !myproduct.productInfo) - productInfo.link_macro = getvalueByJsonText(product.url); + productInfo.link_macro = getvalueByJsonText(productImported.url); } - if (getvalueByJsonText(product.descrizione)) { + if (getvalueByJsonText(productImported.descrizione)) { if ((myproduct && !myproduct.productInfo.descrizione_breve_macro) || !myproduct.productInfo) - productInfo.descrizione_breve_macro = getvalueByJsonText(product.descrizione); + productInfo.descrizione_breve_macro = getvalueByJsonText(productImported.descrizione); } - if (getvalueByJsonText(product.descrizione_completa)) { + if (getvalueByJsonText(productImported.descrizione_completa)) { if ((myproduct && !myproduct.productInfo.descrizione_completa_macro) || !myproduct.productInfo) - productInfo.descrizione_completa_macro = getvalueByJsonText(product.descrizione_completa); + productInfo.descrizione_completa_macro = getvalueByJsonText(productImported.descrizione_completa); } - if (getvalueByJsonText(product.sottotitolo)) { + if (getvalueByJsonText(productImported.sottotitolo)) { if ((myproduct && !myproduct.productInfo.sottotitolo) || !myproduct.productInfo) - productInfo.sottotitolo = getvalueByJsonText(product.sottotitolo); + productInfo.sottotitolo = getvalueByJsonText(productImported.sottotitolo); } - if (getvalueByJsonText(product.titolo)) { + if (getvalueByJsonText(productImported.titolo)) { if ((myproduct && !myproduct.productInfo.name) || !myproduct.productInfo) - productInfo.name = getvalueByJsonText(product.titolo); + productInfo.name = getvalueByJsonText(productImported.titolo); } - const pagine = getvalueByJsonText(product.pagine); + const pagine = getvalueByJsonText(productImported.pagine); let recisbn = {}; - const trovato = await ImportaIsbn.findOne({ isbn: product.code }).lean(); + const trovato = await ImportaIsbn.findOne({ isbn: productImported.code }).lean(); if (trovato) { // togli a recisbn l'_id delete trovato._id; @@ -1271,7 +1266,7 @@ router.post('/import', authenticate, async (req, res) => { try { let risisbn = await ImportaIsbn.findOneAndUpdate( - { isbn: product.code }, + { isbn: productImported.code }, { $set: recisbn }, { new: true, upsert: true, strict: false } ); @@ -1393,20 +1388,18 @@ router.post('/import', authenticate, async (req, res) => { { $set: { productInfo: productInfo } }, { new: true, upsert: true } ); - - // .... ANDARE AVANTI DA QUI... .productInfo.... SISTEMARE! - + if (risrecInfo) { productImported.productInfo = risrecInfo._id; - recnewInfo = await Product.findOne({ code: product.code }).lean(); + recnewInfo = await Product.findOne({ code: product.productInfo.code }).lean(); if (risrecInfo._id) { // Record existed, so it was updated let arrfieldchange = tools.differentObjects(productInfo, recnewInfo); if (arrfieldchange && arrfieldchange.length > 0) { // updated++; - console.log('Changed: ', recnewInfo.name + ': ' + arrfieldchange); + console.log('Changed: ', recnewInfo.productInfo.name + ': ' + arrfieldchange); } } @@ -1425,7 +1418,7 @@ router.post('/import', authenticate, async (req, res) => { } let recProductExist = null; - let queryprod = { idProductInfo: productImported.idProductInfo }; + let queryprod = { _id: productImported._id }; if (recGas) { queryprod = { ...queryprod, idGasordine: recGas._id }; @@ -1443,7 +1436,11 @@ router.post('/import', authenticate, async (req, res) => { } // AGGIORNA PRODUCT - let risrec = await Product.findOneAndUpdate(queryprod, { $set: productImported }, { new: true, upsert: true }); + let risrec = await Product.findOneAndUpdate( + queryprod, + { $set: productImported }, + { new: true, upsert: true } + ); let recnew = await Product.findOne(queryprod).lean(); @@ -1453,7 +1450,7 @@ router.post('/import', authenticate, async (req, res) => { let arrfieldchange = tools.differentObjects(productImported, recnew); if (arrfieldchange.length > 0) { updated++; - console.log('Changed:', productImported.idProductInfo + ': ' + arrfieldchange); + console.log('Changed:', productImported.productInfo.name + ': ' + arrfieldchange); } } else { // Record didn't exist, so it was created @@ -1467,7 +1464,7 @@ router.post('/import', authenticate, async (req, res) => { await Product.singlerecconvert_AfterImport_AndSave(idapp, recnew, isnuovo); } else { - console.error('Error ProductInfo: ', productImported.code); + console.error('Error product: ', productImported.code); errors++; } } @@ -1495,7 +1492,6 @@ router.post('/import', authenticate, async (req, res) => { for (const rec of myarrshift) { let risprod = await extractArrayDataFromCSV(idapp, rec); let product = risprod.product; - let productInfo = risprod.productInfo; let isnuovo = false; let setta = false; @@ -1516,7 +1512,7 @@ router.post('/import', authenticate, async (req, res) => { } if (reccateg) { - productInfo.idCatProds.push(reccateg._id); + product.productInfo.idCatProds.push(reccateg._id); } } } @@ -1537,7 +1533,7 @@ router.post('/import', authenticate, async (req, res) => { } if (recsubcateg) { - productInfo.idSubCatProds.push(recsubcateg._id); + product.productInfo.idSubCatProds.push(recsubcateg._id); } } } @@ -1546,27 +1542,27 @@ router.post('/import', authenticate, async (req, res) => { product.active = true; } - if (productInfo.productTypes.length === 1 && productInfo.productTypes[0] === undefined) { - productInfo.productTypes = [shared_consts.PRODUCTTYPE.PRODUCT]; + if (product.productInfo.productTypes.length === 1 && product.productInfo.productTypes[0] === undefined) { + product.productInfo.productTypes = [shared_consts.PRODUCTTYPE.PRODUCT]; } - let esisteindb = await Product.findOne({ code: productInfo.code }).lean(); + let esisteindb = await Product.findOne({ 'productInfo.code': product.productInfo.code }).lean(); // Update Product let risrecInfo = await Product.findOneAndUpdate( - { code: product.code }, + { 'productInfo.code': product.productInfo.code }, { $set: product }, { new: true, upsert: true } ); if (risrecInfo) { - recnewInfo = await Product.findOne({ code: product.code }).lean(); + recnewInfo = await Product.findOne({ 'productInfo.code': product.productInfo.code }).lean(); if (risrecInfo._id) { // Record existed, so it was updated - let arrfieldchange = tools.differentObjects(productInfo, recnewInfo.productInfo); + let arrfieldchange = tools.differentObjects(product.productInfo, recnewInfo.productInfo); if (arrfieldchange && arrfieldchange.length > 0) { // updated++; - console.log('Changed: ', recnewInfo.name + ': ' + arrfieldchange); + console.log('Changed: ', recnewInfo.productInfo.name + ': ' + arrfieldchange); } } @@ -1592,11 +1588,11 @@ router.post('/import', authenticate, async (req, res) => { } let recProductExist = null; - let queryprod = { idProductInfo: product.idProductInfo }; + let queryprod = { 'productInfo.code': product.productInfo.code }; - if (recGas) { - queryprod = { ...queryprod, idGasordine: recGas._id }; - } + //if (recGas) { + // queryprod = { ...queryprod, idGasordine: recGas._id }; + //} recProductExist = await Product.findOne(queryprod).lean(); @@ -1620,7 +1616,7 @@ router.post('/import', authenticate, async (req, res) => { let arrfieldchange = tools.differentObjects(product, recnew); if (arrfieldchange.length > 0) { updated++; - console.log('Changed: ', product.idProductInfo + ': ' + arrfieldchange); + console.log('Changed: ', product._id + ': ' + arrfieldchange); } } else { // Record didn't exist, so it was created @@ -1634,7 +1630,7 @@ router.post('/import', authenticate, async (req, res) => { await Product.singlerecconvert_AfterImport_AndSave(idapp, recnew, isnuovo); } else { - console.error('Error ProductInfo: ', product.code); + console.error('Error ProductInfo: ', product.productInfo.code); errors++; } diff --git a/src/server/router/cart_router.js b/src/server/router/cart_router.js index 6aef757..3b65bd1 100755 --- a/src/server/router/cart_router.js +++ b/src/server/router/cart_router.js @@ -506,7 +506,7 @@ router.post('/:userId/gestord', authenticate, async function (req, res, next) { $match: { idGasordine: { $type: 'objectId', // Checks if the field is of type ObjectId - $eq: new ObjectId(idGasordine), // Compares the value to a specific ObjectId + $eq: new mongoose.Types.ObjectId(idGasordine), // Compares the value to a specific ObjectId }, }, }; diff --git a/src/server/router/index_router.js b/src/server/router/index_router.js index efd2652..4489e80 100755 --- a/src/server/router/index_router.js +++ b/src/server/router/index_router.js @@ -2057,7 +2057,6 @@ async function load(req, res, version = '0') { ? Product.findAllIdApp(idapp, undefined, undefined, req.user ? User.isManager(req.user.perm) : false) : Promise.resolve([]),*/ products: Promise.resolve([]), - productInfos: Promise.resolve([]), catprods: version >= 91 ? Product.getArrCatProds(idapp, shared_consts.PROD.BOTTEGA) : Promise.resolve([]), subcatprods: version >= 91 ? SubCatProd.findAllIdApp(idapp) : Promise.resolve([]), catprods_gas: version >= 91 ? Product.getArrCatProds(idapp, shared_consts.PROD.GAS) : Promise.resolve([]), @@ -2172,7 +2171,6 @@ async function load(req, res, version = '0') { scontisticas: data.scontisticas, gasordines: data.gasordines, products: data.products, - productInfos: data.productInfos, catprods: data.catprods, subcatprods: data.subcatprods, catprods_gas: data.catprods_gas, diff --git a/src/server/tools/shared_nodejs.js b/src/server/tools/shared_nodejs.js index 92d93d3..a5a6dee 100755 --- a/src/server/tools/shared_nodejs.js +++ b/src/server/tools/shared_nodejs.js @@ -197,37 +197,16 @@ module.exports = { // Solo per NODEJS - TABLES_ENABLE_GETREC_BYID: [ - 'mybachecas', - 'myhosps', - 'myskills', - 'mygoods', - 'attivitas', - ], + TABLES_ENABLE_GETREC_BYID: ['mybachecas', 'myhosps', 'myskills', 'mygoods', 'attivitas'], TABLES_USER_INCLUDE_MY: ['mygroups', 'circuits'], TABLES_GETCOMPLETEREC: ['myskills', 'mybachecas', 'myhosps', 'mygoods', 'attivitas'], //++Todo: per abilitare gli utenti ad inserire un Circuito aggiungere 'circuits' alla lista TABLES_PERM_NEWREC - TABLES_PERM_NEWREC: [ - 'skills', - 'goods', - 'subskills', - 'mygroups', - 'myhosps', - 'catalogs', - 'raccoltacataloghis', - ], + TABLES_PERM_NEWREC: ['skills', 'goods', 'subskills', 'mygroups', 'myhosps', 'catalogs', 'raccoltacataloghis'], TABLES_REACTIONS: ['mybachecas', 'myhosps', 'myskills', 'mygoods', 'attivitas'], - TABLES_VISU_STAT_IN_HOME: [ - 'myskills', - 'mybachecas', - 'myhosps', - 'mygoods', - 'mygroups', - 'circuits', - ], + TABLES_VISU_STAT_IN_HOME: ['myskills', 'mybachecas', 'myhosps', 'mygoods', 'mygroups', 'circuits'], TABLES_ADV_NOTIFICATION: ['myskills', 'myhosps', 'mygoods'], TABLES_ORDER_DATE_UPDATED: ['myskills', 'myhosps', 'mygoods'], @@ -1169,6 +1148,17 @@ module.exports = { 'sconto2', ], + CONVERTI_CAMPO: [ + { + originale: 'maxbookableGASQty', + convertito: 'prenotato', + }, + { + originale: 'qtyToReachForGas', + convertito: 'quantita_da_raggiungere', + }, + ], + CAMPI_EURO: ['price', 'price_acquistato'], MAX_QTA_PREORD: 5000,