Aggiornamento PiuChebuono: lista Totali del Produttore.

This commit is contained in:
Surya Paolo
2025-02-26 19:08:00 +01:00
parent 57679fe649
commit 757bf44c68
5 changed files with 20 additions and 7 deletions

View File

@@ -70,7 +70,7 @@ module.exports.executeQueryTable = function (idapp, params) {
module.exports.findAllIdApp = async function (idapp) {
const myfind = { idapp };
return await Gasordine.find(myfind);
return await Gasordine.find(myfind).sort({dataora_chiusura_ordini: -1}).lean();
};

View File

@@ -27,6 +27,9 @@ const productInfoSchema = new Schema({
unique: true,
required: true,
},
codice: { // codice interno prodotto
type: String,
},
id_wp: { // id in wordpress
type: String,
},

View File

@@ -604,8 +604,11 @@ async function extractArrayDataFromCSV(idapp, rec) {
arrcampi_product = getValoriAndIndice_Product(null);
for (const campoobj of arrcampi_productInfo) {
if (rec.hasOwnProperty(campoobj.name)) {
let myval = tools.ripulisciCampo(rec[campoobj.name]);
// TODO: controlla che il campo rec[campoobj.name] esista anche se minuscolo/maiuscolo
const mykey = Object.keys(rec).find(key => key.toLowerCase() === campoobj.name.toLowerCase());
if (mykey) {
let myval = tools.ripulisciCampo(rec[mykey]);
productInfo[campoobj.name] = (myval === 'TRUE' || myval.toUpperCase() === 'SI') ? true : ((myval === 'FALSE' || myval.toUpperCase() === 'NO') ? false : myval);
}

View File

@@ -1095,6 +1095,7 @@ module.exports = {
CAMPI_PRODUCTINFO: [
{ name: 'name', type: '' },
{ name: 'code', type: '' },
{ name: 'codice', type: '' },
{ name: 'description', type: 1 },
{ name: 'link_scheda', type: '' },
{ name: 'idCatProds', type: '' },