Sistemazioni...

This commit is contained in:
Paolo Arena
2020-07-02 22:00:58 +02:00
parent c939be279e
commit e2cdee1baa
13 changed files with 454 additions and 171 deletions

View File

@@ -94,6 +94,7 @@ function getQueryProj(myfilter) {
username: 1,
'profile.paymenttypes': 1,
'profile.email_paypal': 1,
'profile.revolut': 1,
'profile.link_payment': 1,
'profile.note_payment': 1,
'profile.cell': 1,
@@ -357,7 +358,9 @@ NavePersistenteSchema.statics.changeField = async function (idapp, flotta, field
let myval = {};
if ('date_close' in fieldvalue) {
myval['date_gift_chat_open'] = fieldvalue['date_close'];
myval['date_start'] = fieldvalue['date_close'];
} else if ('date_start' in fieldvalue) {
myval['date_gift_chat_open'] = fieldvalue['date_start'];
} else {
myval = fieldvalue;
}
@@ -378,6 +381,8 @@ NavePersistenteSchema.statics.aggiornaFlottaByNavePersistente = async function (
const { Nave } = require('../models/nave');
const { User } = require('./user');
const { Flotta } = require('./flotta');
let num = 0;
@@ -387,7 +392,7 @@ NavePersistenteSchema.statics.aggiornaFlottaByNavePersistente = async function (
indcolflottaprima = tools.getPrimaColFlotta(naveinput.col1don + 7);
console.log(num, ' -> [', naveinput.riga, '.', naveinput.col, '] indcolflottaprima=', indcolflottaprima);
console.log(num, ' -> [', naveinput.riga, '.', naveinput.col1don, '] indcolflottaprima=', indcolflottaprima);
let ini = Math.ceil(indcolflottaprima / 8);
let fine = ini + 7;
@@ -431,8 +436,8 @@ NavePersistenteSchema.statics.aggiornaFlottaByNavePersistente = async function (
myflotta.msg_inviato = false;
}
myflotta.date_start = navepers.date_start;
myflotta.date_close = navepers.date_gift_chat_open;
myflotta.date_start = navepers.date_gift_chat_open;
myflotta.date_close = navepers.date_start;
let sognatore = await Nave.getSognatoreByRigaColMediatore(idapp, { riga: navepers.riga, col: navepers.col });
if (myflotta.sognatore_nomecognome === '') {
@@ -443,10 +448,12 @@ NavePersistenteSchema.statics.aggiornaFlottaByNavePersistente = async function (
if (nuovo) {
myflotta.email_paypal = '';
myflotta.revolut = '';
myflotta.link_payment = '';
myflotta.note_payment = '';
if (!!sognatore) {
myflotta.email_paypal = sognatore.profile.email_paypal;
myflotta.revolut = sognatore.profile.revolut;
myflotta.link_payment = sognatore.profile.link_payment;
myflotta.note_payment = sognatore.profile.note_payment;
}
@@ -455,6 +462,8 @@ NavePersistenteSchema.statics.aggiornaFlottaByNavePersistente = async function (
if (!!sognatore) {
if (!myflotta.email_paypal)
myflotta.email_paypal = sognatore.profile.email_paypal;
if (!myflotta.revolut)
myflotta.revolut = sognatore.profile.revolut;
if (!myflotta.link_payment)
myflotta.link_payment = sognatore.profile.link_payment;
if (!myflotta.note_payment)