Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2023-02-09 09:16:30 +01:00
commit ebee9144b4
31 changed files with 599 additions and 89 deletions

View File

@ -1,2 +1,173 @@
DELETE FROM `salix`.`ACL` WHERE model="SaleChecked";
DROP TABLE IF EXISTS `vn`.`saleChecked`;
DROP PROCEDURE IF EXISTS `vn`.`clean`;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clean`()
BEGIN
DECLARE vDateShort DATETIME;
DECLARE vOneYearAgo DATE;
DECLARE vFourYearsAgo DATE;
DECLARE v18Month DATE;
DECLARE v26Month DATE;
DECLARE v3Month DATE;
DECLARE vTrashId VARCHAR(15);
SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH;
SET vOneYearAgo = util.VN_CURDATE() - INTERVAL 1 YEAR;
SET vFourYearsAgo = util.VN_CURDATE() - INTERVAL 4 YEAR;
SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH;
SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH;
SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH;
DELETE FROM ticketParking WHERE created < vDateShort;
DELETE FROM routesMonitor WHERE dated < vDateShort;
DELETE FROM workerTimeControlLog WHERE created < vDateShort;
DELETE FROM `message` WHERE sendDate < vDateShort;
DELETE FROM messageInbox WHERE sendDate < vDateShort;
DELETE FROM messageInbox WHERE sendDate < vDateShort;
DELETE FROM workerTimeControl WHERE timed < vFourYearsAgo;
DELETE FROM itemShelving WHERE created < util.VN_CURDATE() AND visible = 0;
DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,util.VN_CURDATE());
DELETE FROM entryLog WHERE creationDate < vDateShort;
DELETE IGNORE FROM expedition WHERE created < v26Month;
DELETE FROM sms WHERE created < v18Month;
DELETE FROM saleTracking WHERE created < vOneYearAgo;
DELETE FROM ticketTracking WHERE created < v18Month;
DELETE tobs FROM ticketObservation tobs
JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE());
DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < vOneYearAgo;
DELETE FROM sharingCart where ended < vDateShort;
DELETE FROM sharingClient where ended < vDateShort;
DELETE tw.* FROM ticketWeekly tw
LEFT JOIN sale s ON s.ticketFk = tw.ticketFk WHERE s.itemFk IS NULL;
DELETE FROM claim WHERE ticketCreated < vFourYearsAgo;
DELETE FROM message WHERE sendDate < vDateShort;
-- Robert ubicacion anterior de trevelLog comentario para debug
DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Month;
DELETE bm
FROM buyMark bm
JOIN buy b ON b.id = bm.id
JOIN entry e ON e.id = b.entryFk
JOIN travel t ON t.id = e.travelFk
WHERE t.landed <= vDateShort;
DELETE FROM vn.buy WHERE created < vDateShort AND entryFk = 9200;
DELETE FROM vn.itemShelvingLog WHERE created < vDateShort;
DELETE FROM vn.stockBuyed WHERE creationDate < vDateShort;
DELETE FROM vn.itemCleanLog WHERE created < util.VN_NOW() - INTERVAL 1 YEAR;
DELETE FROM printQueue WHERE statusCode = 'printed' AND created < vDateShort;
-- Equipos duplicados
DELETE w.*
FROM workerTeam w
JOIN (SELECT id, team, workerFk, COUNT(*) - 1 as duplicated
FROM workerTeam
GROUP BY team,workerFk
HAVING duplicated
) d ON d.team = w.team AND d.workerFk = w.workerFk AND d.id != w.id;
DELETE sc
FROM saleComponent sc
JOIN sale s ON s.id= sc.saleFk
JOIN ticket t ON t.id= s.ticketFk
WHERE t.shipped < v18Month;
DELETE c
FROM vn.claim c
JOIN vn.claimState cs ON cs.id = c.claimStateFk
WHERE cs.description = "Anulado" AND
c.created < vDateShort;
DELETE
FROM vn.expeditionTruck
WHERE ETD < v3Month;
-- borrar travels sin entradas
DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete;
CREATE TEMPORARY TABLE tmp.thermographToDelete
SELECT th.id,th.dmsFk
FROM vn.travel t
LEFT JOIN vn.entry e ON e.travelFk = t.id
JOIN vn.travelThermograph th ON th.travelFk = t.id
WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL;
SELECT dt.id INTO vTrashId
FROM vn.dmsType dt
WHERE dt.code = 'trash';
UPDATE tmp.thermographToDelete th
JOIN vn.dms d ON d.id = th.dmsFk
SET d.dmsTypeFk = vTrashId;
DELETE th
FROM tmp.thermographToDelete tmp
JOIN vn.travelThermograph th ON th.id = tmp.id;
DELETE t
FROM vn.travel t
LEFT JOIN vn.entry e ON e.travelFk = t.id
WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL;
UPDATE dms d
JOIN dmsType dt ON dt.id = d.dmsTypeFk
SET d.dmsTypeFk = vTrashId
WHERE created < TIMESTAMPADD(MONTH, -dt.monthToDelete, util.VN_CURDATE());
-- borrar entradas sin compras
DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete;
CREATE TEMPORARY TABLE tmp.entryToDelete
SELECT e.*
FROM vn.entry e
LEFT JOIN vn.buy b ON b.entryFk = e.id
JOIN vn.entryConfig ec ON e.id != ec.defaultEntry
WHERE e.dated < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND b.entryFK IS NULL;
DELETE e
FROM vn.entry e
JOIN tmp.entryToDelete tmp ON tmp.id = e.id;
-- borrar de route registros menores a 4 años
DROP TEMPORARY TABLE IF EXISTS tmp.routeToDelete;
CREATE TEMPORARY TABLE tmp.routeToDelete
SELECT *
FROM vn.route r
WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE());
UPDATE tmp.routeToDelete tmp
JOIN vn.dms d ON d.id = tmp.gestdocFk
SET d.dmsTypeFk = vTrashId;
DELETE r
FROM tmp.routeToDelete tmp
JOIN vn.route r ON r.id = tmp.id;
-- borrar registros de dua y awb menores a 2 años
DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete;
CREATE TEMPORARY TABLE tmp.duaToDelete
SELECT *
FROM vn.dua
WHERE operated < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE());
UPDATE tmp.duaToDelete tm
JOIN vn.dms d ON d.id = tm.gestdocFk
SET d.dmsTypeFk = vTrashId;
DELETE d
FROM tmp.duaToDelete tmp
JOIN vn.dua d ON d.id = tmp.id;
DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE());
-- Borra los registros de collection y ticketcollection
DELETE FROM vn.collection WHERE created < vDateShort;
DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete;
DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete;
DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete;
DELETE FROM travelLog WHERE creationDate < v3Month;
CALL shelving_clean;
END$$
DELIMITER ;

View File

@ -0,0 +1,9 @@
ALTER TABLE `vn`.`itemConfig` ADD defaultTag INT DEFAULT 56 NOT NULL;
ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultTag) REFERENCES vn.tag(id);
ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL;
ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL;
ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos';
INSERT INTO `salix`.`ACL`
(model, property, accessType, permission, principalType, principalId)
VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'buyer');

View File

@ -82,8 +82,6 @@
}
&[type=time],
&[type=date] {
clip-path: inset(0 20px 0 0);
&::-webkit-inner-spin-button,
&::-webkit-clear-button {
display: none;

View File

@ -1,8 +1,8 @@
<vn-dialog
vn-id="instanceLog">
<tpl-body>
<vn-log
class="vn-instance-log"
url="{{$ctrl.url}}"
origin-id="$ctrl.originId"
changed-model="$ctrl.changedModel"

View File

@ -1,13 +1,9 @@
.vn-dialog {
& > .window:not(:has(.empty-rows)) {
width:60%;
vn-log {
vn-log.vn-instance-log {
vn-card {
width: 900px;
visibility: hidden;
& > * {
visibility: visible;
}
}
}
}
}

View File

@ -1,7 +1,7 @@
<h5 class="vn-mb-md vn-mt-lg" translate>Recover password</h5>
<vn-textfield
label="User or recovery email"
ng-model="$ctrl.user"
label="Recovery email"
ng-model="$ctrl.email"
vn-focus>
</vn-textfield>
<div

View File

@ -1,4 +1,4 @@
Recover password: Recuperar contraseña
We will sent you an email to recover your password: Te enviaremos un correo para restablecer tu contraseña
Notification sent!: ¡Notificación enviada!
User or recovery email: Usuario o correo de recuperación
Recovery email: Correo de recuperación

View File

@ -0,0 +1,76 @@
const UserError = require('vn-loopback/util/user-error');
const base64url = require('base64url');
module.exports = Self => {
Self.remoteMethod('confirm', {
description: 'Confirms electronic payment transaction',
accessType: 'WRITE',
accepts: [
{
arg: 'Ds_SignatureVersion',
type: 'string',
required: false,
}, {
arg: 'Ds_MerchantParameters',
type: 'string',
required: true,
}, {
arg: 'Ds_Signature',
type: 'string',
required: true,
}
],
returns: {
type: 'Boolean',
root: true
},
http: {
path: `/confirm`,
verb: 'POST'
}
});
Self.confirm = async(signatureVersion, merchantParameters, signature) => {
const $ = Self.app.models;
const decodedParams = JSON.parse(
base64url.decode(merchantParameters, 'utf8'));
const params = {};
for (const param in decodedParams)
params[param] = decodeURIComponent(decodedParams[param]);
const orderId = params['Ds_Order'];
const merchantId = parseInt(params['Ds_MerchantCode']);
if (!orderId)
throw new UserError('Order id not found');
if (!merchantId)
throw new UserError('Mechant id not found');
const merchant = await $.TpvMerchant.findById(merchantId, {
fields: ['id', 'secretKey']
});
const base64hmac = Self.createSignature(
orderId,
merchant.secretKey,
merchantParameters
);
if (base64hmac !== base64url.toBase64(signature))
throw new UserError('Invalid signature');
await Self.rawSql(
'CALL hedera.tpvTransaction_confirm(?, ?, ?, ?, ?, ?)', [
params['Ds_Amount'],
orderId,
merchantId,
params['Ds_Currency'],
params['Ds_Response'],
params['Ds_ErrorCode']
]);
return true;
};
};

View File

@ -0,0 +1,39 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('end', {
description: 'Ends electronic payment transaction',
accessType: 'WRITE',
accepts: [
{
arg: 'orderId',
type: 'string',
required: true,
}, {
arg: 'status',
type: 'string',
required: true,
}
],
http: {
path: `/end`,
verb: 'POST'
}
});
Self.end = async(ctx, orderId, status) => {
const userId = ctx.req.accessToken.userId;
const transaction = await Self.findById(orderId, {
fields: ['id', 'clientFk']
});
if (transaction?.clientFk != userId)
throw new UserError('Transaction not owned by user');
await Self.rawSql(
'CALL hedera.tpvTransaction_end(?, ?)', [
orderId,
status
]);
};
};

View File

@ -0,0 +1,85 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('start', {
description: 'Starts electronic payment transaction',
accessType: 'WRITE',
accepts: [
{
arg: 'amount',
type: 'Number',
required: true,
}, {
arg: 'companyId',
type: 'Number',
required: false,
}, {
arg: 'urlOk',
type: 'String',
required: false,
}, {
arg: 'urlKo',
type: 'String',
required: false,
}
],
returns: {
type: 'Object',
root: true
},
http: {
path: `/start`,
verb: 'POST'
}
});
Self.start = async(ctx, amount, companyId, urlOk, urlKo) => {
const userId = ctx.req.accessToken.userId;
const [[row]] = await Self.rawSql(
'CALL hedera.tpvTransaction_start(?, ?, ?)', [
amount,
companyId,
userId
]);
if (!row)
throw new UserError('Transaction error');
const orderId = row.transactionId.padStart(12, '0');
const merchantUrl = row.merchantUrl ? row.merchantUrl : '';
urlOk = urlOk ? urlOk.replace('_transactionId_', orderId) : '';
urlKo = urlKo ? urlKo.replace('_transactionId_', orderId) : '';
const params = {
'Ds_Merchant_Amount': amount,
'Ds_Merchant_Order': orderId,
'Ds_Merchant_MerchantCode': row.merchant,
'Ds_Merchant_Currency': row.currency,
'Ds_Merchant_TransactionType': row.transactionType,
'Ds_Merchant_Terminal': row.terminal,
'Ds_Merchant_MerchantURL': merchantUrl,
'Ds_Merchant_UrlOK': urlOk,
'Ds_Merchant_UrlKO': urlKo
};
for (const param in params)
params[param] = encodeURIComponent(params[param]);
const json = JSON.stringify(params);
const merchantParameters = Buffer.from(json).toString('base64');
const signature = Self.createSignature(
orderId,
row.secretKey,
merchantParameters
);
return {
url: row.url,
postValues: {
'Ds_SignatureVersion': 'HMAC_SHA256_V1',
'Ds_MerchantParameters': merchantParameters,
'Ds_Signature': signature
}
};
};
};

View File

@ -0,0 +1,29 @@
const crypto = require('crypto');
module.exports = Self => {
require('../methods/tpv-transaction/confirm')(Self);
require('../methods/tpv-transaction/start')(Self);
require('../methods/tpv-transaction/end')(Self);
Self.createSignature = function(orderId, secretKey, merchantParameters) {
secretKey = Buffer.from(secretKey, 'base64');
const iv = Buffer.alloc(8, 0);
const cipher = crypto.createCipheriv('des-ede3-cbc', secretKey, iv);
cipher.setAutoPadding(false);
const orderKey = Buffer.concat([
cipher.update(zeroPad(orderId, 8)),
cipher.final()
]);
return crypto.createHmac('sha256', orderKey)
.update(merchantParameters)
.digest('base64');
};
function zeroPad(buf, blocksize) {
const buffer = typeof buf === 'string' ? Buffer.from(buf, 'utf8') : buf;
const pad = Buffer.alloc((blocksize - (buffer.length % blocksize)) % blocksize, 0);
return Buffer.concat([buffer, pad]);
}
};

View File

@ -4,7 +4,6 @@ import Dialog from 'core/components/dialog';
class Controller extends Dialog {
constructor($element, $, $transclude, vnReport) {
super($element, $, $transclude);
this.viewReceipt = true;
this.vnReport = vnReport;
this.receipt = {};
}
@ -61,6 +60,7 @@ class Controller extends Dialog {
const accountingType = value.accountingType;
this.receipt.description = [];
this.viewReceipt = accountingType.code == 'cash';
if (accountingType.receiptDescription != null && accountingType.receiptDescription != '')
this.receipt.description.push(accountingType.receiptDescription);
if (this.originalDescription)

View File

@ -75,7 +75,6 @@ describe('Client', () => {
jest.spyOn(controller.vnReport, 'show');
controller.$params = {id: 1101};
controller.viewReceipt = false;
$httpBackend.expect('POST', `Clients/1101/createReceipt`).respond({id: 1});
controller.responseHandler('accept');

View File

@ -94,11 +94,6 @@
"model": "Supplier",
"foreignKey": "supplierFk"
},
"supplierContact": {
"type": "hasMany",
"model": "SupplierContact",
"foreignKey": "supplierFk"
},
"currency": {
"type": "belongsTo",
"model": "Currency",

View File

@ -6,13 +6,15 @@ class Controller extends ModuleCard {
const filter = {
include: [
{
relation: 'supplier'
},
{
relation: 'supplierContact',
relation: 'supplier',
scope: {
include: {
relation: 'contacts',
scope: {
where: {
email: {neq: null}
email: {neq: null},
}
}
}
}
},

View File

@ -40,7 +40,7 @@
</vn-item>
<vn-item
ng-if="$ctrl.isAgricultural()"
ng-click="sendPdfConfirmation.show({email: $ctrl.entity.supplierContact[0].email})"
ng-click="sendPdfConfirmation.show({email: $ctrl.entity.supplier.contacts[0].email})"
translate>
Send agricultural receipt as PDF
</vn-item>

View File

@ -72,4 +72,45 @@ describe('upsertFixedPrice()', () => {
throw e;
}
});
it(`should recalculate rate2 if change rate3`, async() => {
const tx = await models.FixedPrice.beginTransaction({});
const tomorrow = new Date(now);
tomorrow.setDate(tomorrow.getDate() + 1);
const rate2 = 2;
const firstRate3 = 1;
const secondRate3 = 2;
try {
const options = {transaction: tx};
const ctx = {args: {
id: undefined,
itemFk: 1,
warehouseFk: 1,
started: tomorrow,
ended: tomorrow,
rate2: rate2,
rate3: firstRate3,
minPrice: 0,
hasMinPrice: false
}};
// create new fixed price
const newFixedPrice = await models.FixedPrice.upsertFixedPrice(ctx, options);
// change rate3 to same fixed price id
ctx.args.id = newFixedPrice.id;
ctx.args.rate3 = secondRate3;
const result = await models.FixedPrice.upsertFixedPrice(ctx, options);
expect(result.rate2).not.toEqual(rate2);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -72,6 +72,16 @@ module.exports = Self => {
try {
delete args.ctx; // removed unwanted data
if (args.id) {
const beforeFixedPrice = await models.FixedPrice.findById(args.id, {fields: ['rate3']}, myOptions);
const [result] = await Self.rawSql(`SELECT vn.priceFixed_getRate2(?, ?) as rate2`,
[args.id, args.rate3], myOptions);
if (beforeFixedPrice.rate3 != args.rate3 && result && result.rate2)
args.rate2 = result.rate2;
}
const fixedPrice = await models.FixedPrice.upsert(args, myOptions);
const targetItem = await models.Item.findById(args.itemFk, null, myOptions);

View File

@ -131,7 +131,7 @@
class="dense"
vn-focus
ng-model="price.rate3"
on-change="$ctrl.upsertPrice(price); $ctrl.recalculateRate2(price)"
on-change="$ctrl.upsertPrice(price);"
step="0.01"s>
</vn-input-number>
</field>

View File

@ -113,24 +113,6 @@ export default class Controller extends Section {
return {[param]: value};
}
}
recalculateRate2(price) {
if (!price.id || !price.rate3) return;
const query = 'FixedPrices/getRate2';
const params = {
fixedPriceId: price.id,
rate3: price.rate3
};
this.$http.get(query, {params})
.then(res => {
const rate2 = res.data.rate2;
if (rate2) {
price.rate2 = rate2;
this.upsertPrice(price);
}
});
}
}
ngModule.vnComponent('vnFixedPrice', {

View File

@ -85,25 +85,5 @@ describe('fixed price', () => {
expect(controller.$.model.remove).toHaveBeenCalled();
});
});
describe('recalculateRate2()', () => {
it(`should rate2 recalculate`, () => {
jest.spyOn(controller.vnApp, 'showSuccess');
const price = {
id: 1,
itemFk: 1,
rate2: 2,
rate3: 2
};
const response = {rate2: 1};
controller.recalculateRate2(price);
const query = `FixedPrices/getRate2?fixedPriceId=${price.id}&rate3=${price.rate3}`;
$httpBackend.expectGET(query).respond(response);
$httpBackend.flush();
expect(price.rate2).toEqual(response.rate2);
});
});
});
});

View File

@ -26,6 +26,11 @@ module.exports = Self => {
type: 'string',
required: true,
description: `The old version number`
}, {
arg: 'description',
type: 'string',
required: false,
description: `The description of changes`
}, {
arg: 'unlock',
type: 'boolean',
@ -42,8 +47,7 @@ module.exports = Self => {
verb: 'POST'
}
});
Self.upload = async(ctx, appName, toVersion, branch, fromVersion, unlock, options) => {
Self.upload = async(ctx, options) => {
const models = Self.app.models;
const myOptions = {};
const $t = ctx.req.__; // $translate
@ -51,6 +55,12 @@ module.exports = Self => {
const AccessContainer = models.AccessContainer;
const fileOptions = {};
let tx;
const appName = ctx.args.appName;
const toVersion = ctx.args.toVersion;
const branch = ctx.args.branch;
const fromVersion = ctx.args.fromVersion;
let description = ctx.args.description;
const unlock = ctx.args.unlock;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -132,13 +142,46 @@ module.exports = Self => {
await fs.symlink(rootRelative, destinationRoot);
}
}
if (description) {
let formatDesc;
const mainBranches = new Set(['master', 'test', 'dev']);
if (mainBranches.has(branch))
formatDesc = `> :branch_${branch}: `;
else
formatDesc = `> :branch: `;
formatDesc += `*${appName.toUpperCase()}* v.${toVersion} `;
const oldVersion = await models.MdbVersionTree.findOne({
where: {version: fromVersion},
fields: ['branchFk']
}, myOptions);
if (branch == oldVersion.branchFk)
formatDesc += `[*${branch}*]: `;
else
formatDesc += `[*${oldVersion.branchFk}* » *${branch}*]: `;
const params = await models.MdbConfig.findOne(myOptions);
const issueTrackerUrl = params.issueTrackerUrl;
const issueNumberRegex = params.issueNumberRegex;
const chatDestination = params.chatDestination;
const regex = new RegExp(issueNumberRegex, 'g');
formatDesc += description.replace(regex, (match, issueId) => {
const newUrl = issueTrackerUrl.replace('{index}', issueId);
return `[#${issueId}](${newUrl})`;
});
await models.Chat.send(ctx, chatDestination, formatDesc, myOptions);
}
await models.MdbVersionTree.create({
app: appName,
version: toVersion,
branchFk: branch,
fromVersion,
userFk: userId
userFk: userId,
description,
}, myOptions);
await models.MdbVersion.upsert({

View File

@ -11,6 +11,9 @@
"MdbVersionTree": {
"dataSource": "vn"
},
"MdbConfig": {
"dataSource": "vn"
},
"AccessContainer": {
"dataSource": "accessStorage"
}

View File

@ -11,6 +11,11 @@
"id": true,
"type": "string",
"description": "Identifier"
},
"dsName": {
"id": true,
"type": "string",
"description": "ODBC name"
}
}
}

View File

@ -0,0 +1,24 @@
{
"name": "MdbConfig",
"base": "VnModel",
"options": {
"mysql": {
"table": "mdbConfig"
}
},
"properties": {
"id": {
"type": "string",
"id": true
},
"issueTrackerUrl": {
"type": "string"
},
"issueNumberRegex": {
"type": "string"
},
"chatDestination": {
"type": "string"
}
}
}

View File

@ -23,6 +23,9 @@
},
"userFk": {
"type": "number"
},
"description": {
"type": "string"
}
},
"relations": {

View File

@ -66,12 +66,15 @@ export default class Controller extends Section {
let today = Date.vnNew();
const tomorrow = new Date(today);
tomorrow.setDate(tomorrow.getDate() + 1);
this.$http.get(`UserConfigs/getUserConfig`)
.then(res => {
this.filterParams = {
dateFuture: tomorrow,
dateToAdvance: today,
warehouseFk: this.vnConfig.warehouseFk
warehouseFk: res.data.warehouseFk
};
this.$.model.applyFilter(null, this.filterParams);
this.$.model.addFilter({}, this.filterParams);
});
}
compareDate(date) {

View File

@ -59,12 +59,15 @@ export default class Controller extends Section {
setDefaultFilter() {
const today = Date.vnNew();
this.$http.get(`UserConfigs/getUserConfig`)
.then(res => {
this.filterParams = {
originDated: today,
futureDated: today,
warehouseFk: this.vnConfig.warehouseFk
warehouseFk: res.data.warehouseFk
};
this.$.model.applyFilter(null, this.filterParams);
});
}
compareDate(date) {

18
package-lock.json generated
View File

@ -1,15 +1,16 @@
{
"name": "salix-back",
"version": "9.0.0",
"version": "23.02.03",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "salix-back",
"version": "9.0.0",
"version": "23.02.03",
"license": "GPL-3.0",
"dependencies": {
"axios": "^1.2.2",
"base64url": "^3.0.1",
"bcrypt": "^5.0.1",
"bmp-js": "^0.1.0",
"compression": "^1.7.3",
@ -4200,6 +4201,14 @@
"node": ">= 0.4"
}
},
"node_modules/base64url": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz",
"integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==",
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/batch": {
"version": "0.6.1",
"dev": true,
@ -29057,6 +29066,11 @@
"base64-js": {
"version": "1.0.2"
},
"base64url": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz",
"integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A=="
},
"batch": {
"version": "0.6.1",
"dev": true

View File

@ -13,6 +13,7 @@
},
"dependencies": {
"axios": "^1.2.2",
"base64url": "^3.0.1",
"bcrypt": "^5.0.1",
"bmp-js": "^0.1.0",
"compression": "^1.7.3",

View File

@ -8,5 +8,4 @@ SELECT
r.payed
FROM client c
JOIN receipt r ON r.clientFk = c.id
JOIN supplier s ON c.fi = s.nif
WHERE r.id = ?