feat: check cannot attach more than one pdf
This commit is contained in:
parent
f972afb13e
commit
cff1e6cfbf
|
@ -1,4 +1,5 @@
|
||||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||||
|
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('filter', {
|
Self.remoteMethodCtx('filter', {
|
||||||
|
@ -24,6 +25,10 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.filter = async(ctx, filter, options) => {
|
Self.filter = async(ctx, filter, options) => {
|
||||||
const conn = Self.dataSource.connector;
|
const conn = Self.dataSource.connector;
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
let stmts = [];
|
let stmts = [];
|
||||||
let stmt;
|
let stmt;
|
||||||
|
@ -62,7 +67,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
let agencyTerm = stmts.push(stmt) - 1;
|
let agencyTerm = stmts.push(stmt) - 1;
|
||||||
let sql = ParameterizedSQL.join(stmts, ';');
|
let sql = ParameterizedSQL.join(stmts, ';');
|
||||||
let result = await conn.executeStmt(sql);
|
let result = await conn.executeStmt(sql, myOptions);
|
||||||
|
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
for (let agencyTerm of result)
|
for (let agencyTerm of result)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
import UserError from 'core/lib/user-error';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
constructor($element, $) {
|
constructor($element, $) {
|
||||||
|
@ -81,7 +82,8 @@ class Controller extends Section {
|
||||||
};
|
};
|
||||||
this.$http(options).then(res => {
|
this.$http(options).then(res => {
|
||||||
if (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();
|
this.$.watcher.updateOriginalData();
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
|
|
|
@ -4,3 +4,4 @@ Agency route: Agencia ruta
|
||||||
Agency Agreement: Agencia acuerdo
|
Agency Agreement: Agencia acuerdo
|
||||||
Autonomous: Autónomos
|
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
|
Loading…
Reference in New Issue