- Iscrizione Conacreis
- Ordini - Carrello
This commit is contained in:
@@ -58,6 +58,8 @@ const OrdersCart = require('../models/orderscart');
|
||||
const Storehouse = require('../models/storehouse');
|
||||
const Department = require('../models/department');
|
||||
const ShareWithUs = require('../models/sharewithus');
|
||||
const Site = require('../models/site');
|
||||
const IscrittiConacreis = require('../models/iscrittiConacreis');
|
||||
const Group = require('../models/group');
|
||||
const { Todo } = require('../models/todo');
|
||||
const Hours = require('../models/hours');
|
||||
@@ -210,6 +212,10 @@ function getTableByTableName(tablename) {
|
||||
mytable = Department;
|
||||
else if (tablename === 'sharewithus')
|
||||
mytable = ShareWithUs;
|
||||
else if (tablename === 'sites')
|
||||
mytable = Site;
|
||||
else if (tablename === 'iscritticonacreis')
|
||||
mytable = IscrittiConacreis;
|
||||
else if (tablename === 'groups')
|
||||
mytable = Group;
|
||||
else if (tablename === 'todos')
|
||||
@@ -340,6 +346,21 @@ router.post('/gettable', authenticate, (req, res) => {
|
||||
|
||||
});
|
||||
|
||||
router.post('/getpage', async (req, res) => {
|
||||
const params = req.body;
|
||||
const idapp = req.body.idapp;
|
||||
const mypath = params.path;
|
||||
|
||||
return MyPage.findOne({ idapp, path: mypath })
|
||||
.then((ris) => {
|
||||
return res.send({ mypage: ris });
|
||||
}).catch((e) => {
|
||||
console.log(e.message);
|
||||
res.status(400).send(e);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
router.patch('/setlang', authenticate, async (req, res) => {
|
||||
const username = req.body.data.username;
|
||||
@@ -381,7 +402,7 @@ router.patch('/chval', authenticate, async (req, res) => {
|
||||
// tools.mylogshow('PATCH CHVAL: ', id, fieldsvalue);
|
||||
|
||||
// If I change my record...
|
||||
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) && !User.isTraduttrici(req.user.perm) && !User.isTutor(req.user.perm)) && (req.user._id.toString() !== id) && !tools.ModificheConsentite(mydata.table, fieldsvalue)) {
|
||||
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) && !User.isEditor(req.user.perm) && !User.isTutor(req.user.perm)) && (req.user._id.toString() !== id) && !tools.ModificheConsentite(mydata.table, fieldsvalue)) {
|
||||
// If without permissions, exit
|
||||
return res.status(404).send({ code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: '' });
|
||||
}
|
||||
@@ -1138,7 +1159,7 @@ router.get('/loadsite/:userId/:idapp/:sall', authenticate_noerror, (req, res) =>
|
||||
|
||||
let newstosent = Promise.resolve([]);
|
||||
let mailinglist = Promise.resolve([]);
|
||||
let mypage = MyPage.findAllIdApp(idapp);
|
||||
let mypage = MyPage.findOnlyStruttRec(idapp);
|
||||
let calzoom = CalZoom.findAllIdApp(idapp);
|
||||
let gallery = Gallery.findAllIdApp(idapp);
|
||||
let producers = Producer.findAllIdApp(idapp);
|
||||
@@ -1157,7 +1178,12 @@ router.get('/loadsite/:userId/:idapp/:sall', authenticate_noerror, (req, res) =>
|
||||
if (req.user) {
|
||||
calcstat = User.calculateStat(idapp, req.user.username);
|
||||
cart = Cart.getCartByUserId(req.user.id, idapp);
|
||||
orderscart = OrdersCart.getOrdersCartByUserId(req.user.id, idapp, 0);
|
||||
if (User.isManager(req.user.perm)) {
|
||||
// Prende Tutti gli Ordini !
|
||||
orderscart = OrdersCart.getOrdersCartByUserId("ALL", idapp, 0);
|
||||
} else {
|
||||
orderscart = OrdersCart.getOrdersCartByUserId(req.user.id, idapp, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user