feat: check cannot attach more than one pdf

This commit is contained in:
Vicent Llopis 2022-03-04 11:28:26 +01:00
parent f972afb13e
commit cff1e6cfbf
3 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,5 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
module.exports = Self => {
Self.remoteMethodCtx('filter', {
@ -24,6 +25,10 @@ module.exports = Self => {
Self.filter = async(ctx, filter, options) => {
const conn = Self.dataSource.connector;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
let stmts = [];
let stmt;
@ -62,7 +67,7 @@ module.exports = Self => {
let agencyTerm = stmts.push(stmt) - 1;
let sql = ParameterizedSQL.join(stmts, ';');
let result = await conn.executeStmt(sql);
let result = await conn.executeStmt(sql, myOptions);
const models = Self.app.models;
for (let agencyTerm of result)

View File

@ -1,6 +1,7 @@
import ngModule from '../../module';
import Section from 'salix/components/section';
import './style.scss';
import UserError from 'core/lib/user-error';
class Controller extends Section {
constructor($element, $) {
@ -81,7 +82,8 @@ class Controller extends Section {
};
this.$http(options).then(res => {
if (res) {
let addedDms = res.data;
const addedDms = res.data;
if (addedDms.length > 1) throw new UserError('You cannot attach more than one document');
this.$.watcher.updateOriginalData();
const params = {

View File

@ -3,4 +3,5 @@ Buy requests: Peticiones de compra
Agency route: Agencia ruta
Agency Agreement: Agencia acuerdo
Autonomous: Autónomos
Two autonomous cannot be counted at the same time: Dos autonónomos no pueden ser contabilizados al mismo tiempo
Two autonomous cannot be counted at the same time: Dos autonónomos no pueden ser contabilizados al mismo tiempo
You cannot attach more than one document: No puedes adjuntar más de un documento